Recovered from microbel
This commit is contained in:
45
common/include/action.H
Normal file
45
common/include/action.H
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _ACTION_H
|
||||
#define _ACTION_H
|
||||
|
||||
#include "object.H"
|
||||
#include "objectlist.H"
|
||||
|
||||
class CAction;
|
||||
|
||||
class CActionList : public CObjectList {
|
||||
int currId;
|
||||
public:
|
||||
CActionList();
|
||||
CAction * getAction(int actionId);
|
||||
void add(CAction * action);
|
||||
};
|
||||
|
||||
class CAction : public CObject {
|
||||
WORD id;
|
||||
public:
|
||||
CAction(char * name);
|
||||
WORD getId(){ return id; }
|
||||
void setId(WORD actionId){ id = actionId; }
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
#endif // _ACTION_H
|
||||
46
common/include/bbox.H
Normal file
46
common/include/bbox.H
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _BBOX_H
|
||||
#define _BBOX_H
|
||||
|
||||
#include <iostream.h>
|
||||
#include "object.H"
|
||||
#include "position.H"
|
||||
#include "vector.H"
|
||||
|
||||
class CBBox: public CObject {
|
||||
CPosition p1,p2;
|
||||
public:
|
||||
CBBox();
|
||||
CBBox(double x1,double y1, double z1, double x2, double y2, double z2);
|
||||
|
||||
const CPosition & getP1() const;
|
||||
const CPosition & getP2() const;
|
||||
|
||||
void initialize(const CPosition & position);
|
||||
void include(const CPosition & position);
|
||||
|
||||
int inside(const CPosition & position) const;
|
||||
int insideXY(const CVector & position) const;
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CBBox& b);
|
||||
|
||||
#endif // _BBOX_H
|
||||
52
common/include/beam.H
Normal file
52
common/include/beam.H
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _BEAM_H
|
||||
#define _BEAM_H
|
||||
|
||||
#include "object.H"
|
||||
#include "vector.H"
|
||||
#include "vertex.H"
|
||||
#include "position.H"
|
||||
#include "matrix.H"
|
||||
#include "bbox.H"
|
||||
|
||||
class CBeam : public CObject {
|
||||
CVector m_point;
|
||||
CVector m_direction;
|
||||
public:
|
||||
CBeam();
|
||||
CBeam(const CVector & point,const CVector & direction);
|
||||
CBeam(const CVertex & point,const CVector & direction);
|
||||
CBeam(const CPosition & point,const CVector & direction);
|
||||
|
||||
const CVector & getPoint() const;
|
||||
const CVector & getDirection() const;
|
||||
|
||||
CBeam operator+ (const CPosition& position) const;
|
||||
|
||||
void transform(const CMatrix & transformation);
|
||||
|
||||
int intersect(const CBBox & bBox) const;
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CBeam& b);
|
||||
|
||||
|
||||
#endif // _BEAM_H
|
||||
242
common/include/bf_locl.h
Normal file
242
common/include/bf_locl.h
Normal file
@@ -0,0 +1,242 @@
|
||||
/* crypto/bf/bf_locl.org */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*
|
||||
* Always modify bf_locl.org since bf_locl.h is automatically generated from
|
||||
* it during SSLeay configuration.
|
||||
*
|
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
*/
|
||||
|
||||
/* Special defines which change the way the code is built depending on the
|
||||
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
|
||||
even newer MIPS CPU's, but at the moment one size fits all for
|
||||
optimization options. Older Sparc's work better with only UNROLL, but
|
||||
there's no way to tell at compile time what it is you're running on */
|
||||
|
||||
#if defined( sun ) /* Newer Sparc's */
|
||||
# define BF_PTR
|
||||
#elif defined( __ultrix ) /* Older MIPS */
|
||||
# define BF_PTR
|
||||
#elif defined( __osf1__ ) /* Alpha */
|
||||
/* None */
|
||||
#elif defined ( _AIX ) /* RS6000 */
|
||||
/* Unknown */
|
||||
#elif defined( __hpux ) /* HP-PA */
|
||||
/* None */
|
||||
#elif defined( __aux ) /* 68K */
|
||||
/* Unknown */
|
||||
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
|
||||
/* Unknown */
|
||||
#elif defined( __sgi ) /* Newer MIPS */
|
||||
# define BF_PTR
|
||||
#elif defined( i386 ) /* x86 boxes, should be gcc */
|
||||
#elif defined( _MSC_VER ) /* x86 boxes, Visual C */
|
||||
#endif /* Systems-specific speed defines */
|
||||
|
||||
#undef c2l
|
||||
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<<24L)
|
||||
|
||||
/* NOTE - c is not incremented as per c2l */
|
||||
#undef c2ln
|
||||
#define c2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 5: l2|=((unsigned long)(*(--(c)))); \
|
||||
case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 1: l1|=((unsigned long)(*(--(c)))); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef l2c
|
||||
#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
|
||||
|
||||
/* NOTE - c is not incremented as per l2c */
|
||||
#undef l2cn
|
||||
#define l2cn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per n2l */
|
||||
#define n2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c)))) ; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 5: l2|=((unsigned long)(*(--(c))))<<24; \
|
||||
case 4: l1 =((unsigned long)(*(--(c)))) ; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 1: l1|=((unsigned long)(*(--(c))))<<24; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per l2n */
|
||||
#define l2nn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef n2l
|
||||
#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++))))
|
||||
|
||||
#undef l2n
|
||||
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff))
|
||||
|
||||
/* This is actually a big endian algorithm, the most significate byte
|
||||
* is used to lookup array 0 */
|
||||
|
||||
/* use BF_PTR2 for intel boxes,
|
||||
* BF_PTR for sparc and MIPS/SGI
|
||||
* use nothing for Alpha and HP.
|
||||
*/
|
||||
#if !defined(BF_PTR) && !defined(BF_PTR2)
|
||||
#define BF_PTR2
|
||||
#endif
|
||||
|
||||
#define BF_M 0x3fc
|
||||
#define BF_0 22L
|
||||
#define BF_1 14L
|
||||
#define BF_2 6L
|
||||
#define BF_3 2L /* left shift */
|
||||
|
||||
#if defined(BF_PTR2)
|
||||
|
||||
/* This is basically a special pentium verson */
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
{ \
|
||||
BF_LONG t,u,v; \
|
||||
u=R>>BF_0; \
|
||||
v=R>>BF_1; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \
|
||||
u=R>>BF_2; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \
|
||||
v=R<<BF_3; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \
|
||||
LL^=P; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \
|
||||
LL^=t; \
|
||||
}
|
||||
|
||||
#elif defined(BF_PTR)
|
||||
|
||||
/* This is normally very good */
|
||||
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
LL^=P; \
|
||||
LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M)));
|
||||
#else
|
||||
|
||||
/* This will always work, even on 64 bit machines and strangly enough,
|
||||
* on the Alpha it is faster than the pointer versions (both 32 and 64
|
||||
* versions of BF_LONG) */
|
||||
|
||||
#define BF_ENC(LL,R,S,P) \
|
||||
LL^=P; \
|
||||
LL^=((( S[ (int)(R>>24L) ] + \
|
||||
S[0x0100+((int)(R>>16L)&0xff)])^ \
|
||||
S[0x0200+((int)(R>> 8L)&0xff)])+ \
|
||||
S[0x0300+((int)(R )&0xff)])&0xffffffffL;
|
||||
#endif
|
||||
325
common/include/bf_pi.h
Normal file
325
common/include/bf_pi.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/* crypto/bf/bf_pi.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
static BF_KEY bf_init= {
|
||||
{
|
||||
0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L,
|
||||
0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L,
|
||||
0x452821e6L, 0x38d01377L, 0xbe5466cfL, 0x34e90c6cL,
|
||||
0xc0ac29b7L, 0xc97c50ddL, 0x3f84d5b5L, 0xb5470917L,
|
||||
0x9216d5d9L, 0x8979fb1b
|
||||
},{
|
||||
0xd1310ba6L, 0x98dfb5acL, 0x2ffd72dbL, 0xd01adfb7L,
|
||||
0xb8e1afedL, 0x6a267e96L, 0xba7c9045L, 0xf12c7f99L,
|
||||
0x24a19947L, 0xb3916cf7L, 0x0801f2e2L, 0x858efc16L,
|
||||
0x636920d8L, 0x71574e69L, 0xa458fea3L, 0xf4933d7eL,
|
||||
0x0d95748fL, 0x728eb658L, 0x718bcd58L, 0x82154aeeL,
|
||||
0x7b54a41dL, 0xc25a59b5L, 0x9c30d539L, 0x2af26013L,
|
||||
0xc5d1b023L, 0x286085f0L, 0xca417918L, 0xb8db38efL,
|
||||
0x8e79dcb0L, 0x603a180eL, 0x6c9e0e8bL, 0xb01e8a3eL,
|
||||
0xd71577c1L, 0xbd314b27L, 0x78af2fdaL, 0x55605c60L,
|
||||
0xe65525f3L, 0xaa55ab94L, 0x57489862L, 0x63e81440L,
|
||||
0x55ca396aL, 0x2aab10b6L, 0xb4cc5c34L, 0x1141e8ceL,
|
||||
0xa15486afL, 0x7c72e993L, 0xb3ee1411L, 0x636fbc2aL,
|
||||
0x2ba9c55dL, 0x741831f6L, 0xce5c3e16L, 0x9b87931eL,
|
||||
0xafd6ba33L, 0x6c24cf5cL, 0x7a325381L, 0x28958677L,
|
||||
0x3b8f4898L, 0x6b4bb9afL, 0xc4bfe81bL, 0x66282193L,
|
||||
0x61d809ccL, 0xfb21a991L, 0x487cac60L, 0x5dec8032L,
|
||||
0xef845d5dL, 0xe98575b1L, 0xdc262302L, 0xeb651b88L,
|
||||
0x23893e81L, 0xd396acc5L, 0x0f6d6ff3L, 0x83f44239L,
|
||||
0x2e0b4482L, 0xa4842004L, 0x69c8f04aL, 0x9e1f9b5eL,
|
||||
0x21c66842L, 0xf6e96c9aL, 0x670c9c61L, 0xabd388f0L,
|
||||
0x6a51a0d2L, 0xd8542f68L, 0x960fa728L, 0xab5133a3L,
|
||||
0x6eef0b6cL, 0x137a3be4L, 0xba3bf050L, 0x7efb2a98L,
|
||||
0xa1f1651dL, 0x39af0176L, 0x66ca593eL, 0x82430e88L,
|
||||
0x8cee8619L, 0x456f9fb4L, 0x7d84a5c3L, 0x3b8b5ebeL,
|
||||
0xe06f75d8L, 0x85c12073L, 0x401a449fL, 0x56c16aa6L,
|
||||
0x4ed3aa62L, 0x363f7706L, 0x1bfedf72L, 0x429b023dL,
|
||||
0x37d0d724L, 0xd00a1248L, 0xdb0fead3L, 0x49f1c09bL,
|
||||
0x075372c9L, 0x80991b7bL, 0x25d479d8L, 0xf6e8def7L,
|
||||
0xe3fe501aL, 0xb6794c3bL, 0x976ce0bdL, 0x04c006baL,
|
||||
0xc1a94fb6L, 0x409f60c4L, 0x5e5c9ec2L, 0x196a2463L,
|
||||
0x68fb6fafL, 0x3e6c53b5L, 0x1339b2ebL, 0x3b52ec6fL,
|
||||
0x6dfc511fL, 0x9b30952cL, 0xcc814544L, 0xaf5ebd09L,
|
||||
0xbee3d004L, 0xde334afdL, 0x660f2807L, 0x192e4bb3L,
|
||||
0xc0cba857L, 0x45c8740fL, 0xd20b5f39L, 0xb9d3fbdbL,
|
||||
0x5579c0bdL, 0x1a60320aL, 0xd6a100c6L, 0x402c7279L,
|
||||
0x679f25feL, 0xfb1fa3ccL, 0x8ea5e9f8L, 0xdb3222f8L,
|
||||
0x3c7516dfL, 0xfd616b15L, 0x2f501ec8L, 0xad0552abL,
|
||||
0x323db5faL, 0xfd238760L, 0x53317b48L, 0x3e00df82L,
|
||||
0x9e5c57bbL, 0xca6f8ca0L, 0x1a87562eL, 0xdf1769dbL,
|
||||
0xd542a8f6L, 0x287effc3L, 0xac6732c6L, 0x8c4f5573L,
|
||||
0x695b27b0L, 0xbbca58c8L, 0xe1ffa35dL, 0xb8f011a0L,
|
||||
0x10fa3d98L, 0xfd2183b8L, 0x4afcb56cL, 0x2dd1d35bL,
|
||||
0x9a53e479L, 0xb6f84565L, 0xd28e49bcL, 0x4bfb9790L,
|
||||
0xe1ddf2daL, 0xa4cb7e33L, 0x62fb1341L, 0xcee4c6e8L,
|
||||
0xef20cadaL, 0x36774c01L, 0xd07e9efeL, 0x2bf11fb4L,
|
||||
0x95dbda4dL, 0xae909198L, 0xeaad8e71L, 0x6b93d5a0L,
|
||||
0xd08ed1d0L, 0xafc725e0L, 0x8e3c5b2fL, 0x8e7594b7L,
|
||||
0x8ff6e2fbL, 0xf2122b64L, 0x8888b812L, 0x900df01cL,
|
||||
0x4fad5ea0L, 0x688fc31cL, 0xd1cff191L, 0xb3a8c1adL,
|
||||
0x2f2f2218L, 0xbe0e1777L, 0xea752dfeL, 0x8b021fa1L,
|
||||
0xe5a0cc0fL, 0xb56f74e8L, 0x18acf3d6L, 0xce89e299L,
|
||||
0xb4a84fe0L, 0xfd13e0b7L, 0x7cc43b81L, 0xd2ada8d9L,
|
||||
0x165fa266L, 0x80957705L, 0x93cc7314L, 0x211a1477L,
|
||||
0xe6ad2065L, 0x77b5fa86L, 0xc75442f5L, 0xfb9d35cfL,
|
||||
0xebcdaf0cL, 0x7b3e89a0L, 0xd6411bd3L, 0xae1e7e49L,
|
||||
0x00250e2dL, 0x2071b35eL, 0x226800bbL, 0x57b8e0afL,
|
||||
0x2464369bL, 0xf009b91eL, 0x5563911dL, 0x59dfa6aaL,
|
||||
0x78c14389L, 0xd95a537fL, 0x207d5ba2L, 0x02e5b9c5L,
|
||||
0x83260376L, 0x6295cfa9L, 0x11c81968L, 0x4e734a41L,
|
||||
0xb3472dcaL, 0x7b14a94aL, 0x1b510052L, 0x9a532915L,
|
||||
0xd60f573fL, 0xbc9bc6e4L, 0x2b60a476L, 0x81e67400L,
|
||||
0x08ba6fb5L, 0x571be91fL, 0xf296ec6bL, 0x2a0dd915L,
|
||||
0xb6636521L, 0xe7b9f9b6L, 0xff34052eL, 0xc5855664L,
|
||||
0x53b02d5dL, 0xa99f8fa1L, 0x08ba4799L, 0x6e85076aL,
|
||||
0x4b7a70e9L, 0xb5b32944L, 0xdb75092eL, 0xc4192623L,
|
||||
0xad6ea6b0L, 0x49a7df7dL, 0x9cee60b8L, 0x8fedb266L,
|
||||
0xecaa8c71L, 0x699a17ffL, 0x5664526cL, 0xc2b19ee1L,
|
||||
0x193602a5L, 0x75094c29L, 0xa0591340L, 0xe4183a3eL,
|
||||
0x3f54989aL, 0x5b429d65L, 0x6b8fe4d6L, 0x99f73fd6L,
|
||||
0xa1d29c07L, 0xefe830f5L, 0x4d2d38e6L, 0xf0255dc1L,
|
||||
0x4cdd2086L, 0x8470eb26L, 0x6382e9c6L, 0x021ecc5eL,
|
||||
0x09686b3fL, 0x3ebaefc9L, 0x3c971814L, 0x6b6a70a1L,
|
||||
0x687f3584L, 0x52a0e286L, 0xb79c5305L, 0xaa500737L,
|
||||
0x3e07841cL, 0x7fdeae5cL, 0x8e7d44ecL, 0x5716f2b8L,
|
||||
0xb03ada37L, 0xf0500c0dL, 0xf01c1f04L, 0x0200b3ffL,
|
||||
0xae0cf51aL, 0x3cb574b2L, 0x25837a58L, 0xdc0921bdL,
|
||||
0xd19113f9L, 0x7ca92ff6L, 0x94324773L, 0x22f54701L,
|
||||
0x3ae5e581L, 0x37c2dadcL, 0xc8b57634L, 0x9af3dda7L,
|
||||
0xa9446146L, 0x0fd0030eL, 0xecc8c73eL, 0xa4751e41L,
|
||||
0xe238cd99L, 0x3bea0e2fL, 0x3280bba1L, 0x183eb331L,
|
||||
0x4e548b38L, 0x4f6db908L, 0x6f420d03L, 0xf60a04bfL,
|
||||
0x2cb81290L, 0x24977c79L, 0x5679b072L, 0xbcaf89afL,
|
||||
0xde9a771fL, 0xd9930810L, 0xb38bae12L, 0xdccf3f2eL,
|
||||
0x5512721fL, 0x2e6b7124L, 0x501adde6L, 0x9f84cd87L,
|
||||
0x7a584718L, 0x7408da17L, 0xbc9f9abcL, 0xe94b7d8cL,
|
||||
0xec7aec3aL, 0xdb851dfaL, 0x63094366L, 0xc464c3d2L,
|
||||
0xef1c1847L, 0x3215d908L, 0xdd433b37L, 0x24c2ba16L,
|
||||
0x12a14d43L, 0x2a65c451L, 0x50940002L, 0x133ae4ddL,
|
||||
0x71dff89eL, 0x10314e55L, 0x81ac77d6L, 0x5f11199bL,
|
||||
0x043556f1L, 0xd7a3c76bL, 0x3c11183bL, 0x5924a509L,
|
||||
0xf28fe6edL, 0x97f1fbfaL, 0x9ebabf2cL, 0x1e153c6eL,
|
||||
0x86e34570L, 0xeae96fb1L, 0x860e5e0aL, 0x5a3e2ab3L,
|
||||
0x771fe71cL, 0x4e3d06faL, 0x2965dcb9L, 0x99e71d0fL,
|
||||
0x803e89d6L, 0x5266c825L, 0x2e4cc978L, 0x9c10b36aL,
|
||||
0xc6150ebaL, 0x94e2ea78L, 0xa5fc3c53L, 0x1e0a2df4L,
|
||||
0xf2f74ea7L, 0x361d2b3dL, 0x1939260fL, 0x19c27960L,
|
||||
0x5223a708L, 0xf71312b6L, 0xebadfe6eL, 0xeac31f66L,
|
||||
0xe3bc4595L, 0xa67bc883L, 0xb17f37d1L, 0x018cff28L,
|
||||
0xc332ddefL, 0xbe6c5aa5L, 0x65582185L, 0x68ab9802L,
|
||||
0xeecea50fL, 0xdb2f953bL, 0x2aef7dadL, 0x5b6e2f84L,
|
||||
0x1521b628L, 0x29076170L, 0xecdd4775L, 0x619f1510L,
|
||||
0x13cca830L, 0xeb61bd96L, 0x0334fe1eL, 0xaa0363cfL,
|
||||
0xb5735c90L, 0x4c70a239L, 0xd59e9e0bL, 0xcbaade14L,
|
||||
0xeecc86bcL, 0x60622ca7L, 0x9cab5cabL, 0xb2f3846eL,
|
||||
0x648b1eafL, 0x19bdf0caL, 0xa02369b9L, 0x655abb50L,
|
||||
0x40685a32L, 0x3c2ab4b3L, 0x319ee9d5L, 0xc021b8f7L,
|
||||
0x9b540b19L, 0x875fa099L, 0x95f7997eL, 0x623d7da8L,
|
||||
0xf837889aL, 0x97e32d77L, 0x11ed935fL, 0x16681281L,
|
||||
0x0e358829L, 0xc7e61fd6L, 0x96dedfa1L, 0x7858ba99L,
|
||||
0x57f584a5L, 0x1b227263L, 0x9b83c3ffL, 0x1ac24696L,
|
||||
0xcdb30aebL, 0x532e3054L, 0x8fd948e4L, 0x6dbc3128L,
|
||||
0x58ebf2efL, 0x34c6ffeaL, 0xfe28ed61L, 0xee7c3c73L,
|
||||
0x5d4a14d9L, 0xe864b7e3L, 0x42105d14L, 0x203e13e0L,
|
||||
0x45eee2b6L, 0xa3aaabeaL, 0xdb6c4f15L, 0xfacb4fd0L,
|
||||
0xc742f442L, 0xef6abbb5L, 0x654f3b1dL, 0x41cd2105L,
|
||||
0xd81e799eL, 0x86854dc7L, 0xe44b476aL, 0x3d816250L,
|
||||
0xcf62a1f2L, 0x5b8d2646L, 0xfc8883a0L, 0xc1c7b6a3L,
|
||||
0x7f1524c3L, 0x69cb7492L, 0x47848a0bL, 0x5692b285L,
|
||||
0x095bbf00L, 0xad19489dL, 0x1462b174L, 0x23820e00L,
|
||||
0x58428d2aL, 0x0c55f5eaL, 0x1dadf43eL, 0x233f7061L,
|
||||
0x3372f092L, 0x8d937e41L, 0xd65fecf1L, 0x6c223bdbL,
|
||||
0x7cde3759L, 0xcbee7460L, 0x4085f2a7L, 0xce77326eL,
|
||||
0xa6078084L, 0x19f8509eL, 0xe8efd855L, 0x61d99735L,
|
||||
0xa969a7aaL, 0xc50c06c2L, 0x5a04abfcL, 0x800bcadcL,
|
||||
0x9e447a2eL, 0xc3453484L, 0xfdd56705L, 0x0e1e9ec9L,
|
||||
0xdb73dbd3L, 0x105588cdL, 0x675fda79L, 0xe3674340L,
|
||||
0xc5c43465L, 0x713e38d8L, 0x3d28f89eL, 0xf16dff20L,
|
||||
0x153e21e7L, 0x8fb03d4aL, 0xe6e39f2bL, 0xdb83adf7L,
|
||||
0xe93d5a68L, 0x948140f7L, 0xf64c261cL, 0x94692934L,
|
||||
0x411520f7L, 0x7602d4f7L, 0xbcf46b2eL, 0xd4a20068L,
|
||||
0xd4082471L, 0x3320f46aL, 0x43b7d4b7L, 0x500061afL,
|
||||
0x1e39f62eL, 0x97244546L, 0x14214f74L, 0xbf8b8840L,
|
||||
0x4d95fc1dL, 0x96b591afL, 0x70f4ddd3L, 0x66a02f45L,
|
||||
0xbfbc09ecL, 0x03bd9785L, 0x7fac6dd0L, 0x31cb8504L,
|
||||
0x96eb27b3L, 0x55fd3941L, 0xda2547e6L, 0xabca0a9aL,
|
||||
0x28507825L, 0x530429f4L, 0x0a2c86daL, 0xe9b66dfbL,
|
||||
0x68dc1462L, 0xd7486900L, 0x680ec0a4L, 0x27a18deeL,
|
||||
0x4f3ffea2L, 0xe887ad8cL, 0xb58ce006L, 0x7af4d6b6L,
|
||||
0xaace1e7cL, 0xd3375fecL, 0xce78a399L, 0x406b2a42L,
|
||||
0x20fe9e35L, 0xd9f385b9L, 0xee39d7abL, 0x3b124e8bL,
|
||||
0x1dc9faf7L, 0x4b6d1856L, 0x26a36631L, 0xeae397b2L,
|
||||
0x3a6efa74L, 0xdd5b4332L, 0x6841e7f7L, 0xca7820fbL,
|
||||
0xfb0af54eL, 0xd8feb397L, 0x454056acL, 0xba489527L,
|
||||
0x55533a3aL, 0x20838d87L, 0xfe6ba9b7L, 0xd096954bL,
|
||||
0x55a867bcL, 0xa1159a58L, 0xcca92963L, 0x99e1db33L,
|
||||
0xa62a4a56L, 0x3f3125f9L, 0x5ef47e1cL, 0x9029317cL,
|
||||
0xfdf8e802L, 0x04272f70L, 0x80bb155cL, 0x05282ce3L,
|
||||
0x95c11548L, 0xe4c66d22L, 0x48c1133fL, 0xc70f86dcL,
|
||||
0x07f9c9eeL, 0x41041f0fL, 0x404779a4L, 0x5d886e17L,
|
||||
0x325f51ebL, 0xd59bc0d1L, 0xf2bcc18fL, 0x41113564L,
|
||||
0x257b7834L, 0x602a9c60L, 0xdff8e8a3L, 0x1f636c1bL,
|
||||
0x0e12b4c2L, 0x02e1329eL, 0xaf664fd1L, 0xcad18115L,
|
||||
0x6b2395e0L, 0x333e92e1L, 0x3b240b62L, 0xeebeb922L,
|
||||
0x85b2a20eL, 0xe6ba0d99L, 0xde720c8cL, 0x2da2f728L,
|
||||
0xd0127845L, 0x95b794fdL, 0x647d0862L, 0xe7ccf5f0L,
|
||||
0x5449a36fL, 0x877d48faL, 0xc39dfd27L, 0xf33e8d1eL,
|
||||
0x0a476341L, 0x992eff74L, 0x3a6f6eabL, 0xf4f8fd37L,
|
||||
0xa812dc60L, 0xa1ebddf8L, 0x991be14cL, 0xdb6e6b0dL,
|
||||
0xc67b5510L, 0x6d672c37L, 0x2765d43bL, 0xdcd0e804L,
|
||||
0xf1290dc7L, 0xcc00ffa3L, 0xb5390f92L, 0x690fed0bL,
|
||||
0x667b9ffbL, 0xcedb7d9cL, 0xa091cf0bL, 0xd9155ea3L,
|
||||
0xbb132f88L, 0x515bad24L, 0x7b9479bfL, 0x763bd6ebL,
|
||||
0x37392eb3L, 0xcc115979L, 0x8026e297L, 0xf42e312dL,
|
||||
0x6842ada7L, 0xc66a2b3bL, 0x12754cccL, 0x782ef11cL,
|
||||
0x6a124237L, 0xb79251e7L, 0x06a1bbe6L, 0x4bfb6350L,
|
||||
0x1a6b1018L, 0x11caedfaL, 0x3d25bdd8L, 0xe2e1c3c9L,
|
||||
0x44421659L, 0x0a121386L, 0xd90cec6eL, 0xd5abea2aL,
|
||||
0x64af674eL, 0xda86a85fL, 0xbebfe988L, 0x64e4c3feL,
|
||||
0x9dbc8057L, 0xf0f7c086L, 0x60787bf8L, 0x6003604dL,
|
||||
0xd1fd8346L, 0xf6381fb0L, 0x7745ae04L, 0xd736fcccL,
|
||||
0x83426b33L, 0xf01eab71L, 0xb0804187L, 0x3c005e5fL,
|
||||
0x77a057beL, 0xbde8ae24L, 0x55464299L, 0xbf582e61L,
|
||||
0x4e58f48fL, 0xf2ddfda2L, 0xf474ef38L, 0x8789bdc2L,
|
||||
0x5366f9c3L, 0xc8b38e74L, 0xb475f255L, 0x46fcd9b9L,
|
||||
0x7aeb2661L, 0x8b1ddf84L, 0x846a0e79L, 0x915f95e2L,
|
||||
0x466e598eL, 0x20b45770L, 0x8cd55591L, 0xc902de4cL,
|
||||
0xb90bace1L, 0xbb8205d0L, 0x11a86248L, 0x7574a99eL,
|
||||
0xb77f19b6L, 0xe0a9dc09L, 0x662d09a1L, 0xc4324633L,
|
||||
0xe85a1f02L, 0x09f0be8cL, 0x4a99a025L, 0x1d6efe10L,
|
||||
0x1ab93d1dL, 0x0ba5a4dfL, 0xa186f20fL, 0x2868f169L,
|
||||
0xdcb7da83L, 0x573906feL, 0xa1e2ce9bL, 0x4fcd7f52L,
|
||||
0x50115e01L, 0xa70683faL, 0xa002b5c4L, 0x0de6d027L,
|
||||
0x9af88c27L, 0x773f8641L, 0xc3604c06L, 0x61a806b5L,
|
||||
0xf0177a28L, 0xc0f586e0L, 0x006058aaL, 0x30dc7d62L,
|
||||
0x11e69ed7L, 0x2338ea63L, 0x53c2dd94L, 0xc2c21634L,
|
||||
0xbbcbee56L, 0x90bcb6deL, 0xebfc7da1L, 0xce591d76L,
|
||||
0x6f05e409L, 0x4b7c0188L, 0x39720a3dL, 0x7c927c24L,
|
||||
0x86e3725fL, 0x724d9db9L, 0x1ac15bb4L, 0xd39eb8fcL,
|
||||
0xed545578L, 0x08fca5b5L, 0xd83d7cd3L, 0x4dad0fc4L,
|
||||
0x1e50ef5eL, 0xb161e6f8L, 0xa28514d9L, 0x6c51133cL,
|
||||
0x6fd5c7e7L, 0x56e14ec4L, 0x362abfceL, 0xddc6c837L,
|
||||
0xd79a3234L, 0x92638212L, 0x670efa8eL, 0x406000e0L,
|
||||
0x3a39ce37L, 0xd3faf5cfL, 0xabc27737L, 0x5ac52d1bL,
|
||||
0x5cb0679eL, 0x4fa33742L, 0xd3822740L, 0x99bc9bbeL,
|
||||
0xd5118e9dL, 0xbf0f7315L, 0xd62d1c7eL, 0xc700c47bL,
|
||||
0xb78c1b6bL, 0x21a19045L, 0xb26eb1beL, 0x6a366eb4L,
|
||||
0x5748ab2fL, 0xbc946e79L, 0xc6a376d2L, 0x6549c2c8L,
|
||||
0x530ff8eeL, 0x468dde7dL, 0xd5730a1dL, 0x4cd04dc6L,
|
||||
0x2939bbdbL, 0xa9ba4650L, 0xac9526e8L, 0xbe5ee304L,
|
||||
0xa1fad5f0L, 0x6a2d519aL, 0x63ef8ce2L, 0x9a86ee22L,
|
||||
0xc089c2b8L, 0x43242ef6L, 0xa51e03aaL, 0x9cf2d0a4L,
|
||||
0x83c061baL, 0x9be96a4dL, 0x8fe51550L, 0xba645bd6L,
|
||||
0x2826a2f9L, 0xa73a3ae1L, 0x4ba99586L, 0xef5562e9L,
|
||||
0xc72fefd3L, 0xf752f7daL, 0x3f046f69L, 0x77fa0a59L,
|
||||
0x80e4a915L, 0x87b08601L, 0x9b09e6adL, 0x3b3ee593L,
|
||||
0xe990fd5aL, 0x9e34d797L, 0x2cf0b7d9L, 0x022b8b51L,
|
||||
0x96d5ac3aL, 0x017da67dL, 0xd1cf3ed6L, 0x7c7d2d28L,
|
||||
0x1f9f25cfL, 0xadf2b89bL, 0x5ad6b472L, 0x5a88f54cL,
|
||||
0xe029ac71L, 0xe019a5e6L, 0x47b0acfdL, 0xed93fa9bL,
|
||||
0xe8d3c48dL, 0x283b57ccL, 0xf8d56629L, 0x79132e28L,
|
||||
0x785f0191L, 0xed756055L, 0xf7960e44L, 0xe3d35e8cL,
|
||||
0x15056dd4L, 0x88f46dbaL, 0x03a16125L, 0x0564f0bdL,
|
||||
0xc3eb9e15L, 0x3c9057a2L, 0x97271aecL, 0xa93a072aL,
|
||||
0x1b3f6d9bL, 0x1e6321f5L, 0xf59c66fbL, 0x26dcf319L,
|
||||
0x7533d928L, 0xb155fdf5L, 0x03563482L, 0x8aba3cbbL,
|
||||
0x28517711L, 0xc20ad9f8L, 0xabcc5167L, 0xccad925fL,
|
||||
0x4de81751L, 0x3830dc8eL, 0x379d5862L, 0x9320f991L,
|
||||
0xea7a90c2L, 0xfb3e7bceL, 0x5121ce64L, 0x774fbe32L,
|
||||
0xa8b6e37eL, 0xc3293d46L, 0x48de5369L, 0x6413e680L,
|
||||
0xa2ae0810L, 0xdd6db224L, 0x69852dfdL, 0x09072166L,
|
||||
0xb39a460aL, 0x6445c0ddL, 0x586cdecfL, 0x1c20c8aeL,
|
||||
0x5bbef7ddL, 0x1b588d40L, 0xccd2017fL, 0x6bb4e3bbL,
|
||||
0xdda26a7eL, 0x3a59ff45L, 0x3e350a44L, 0xbcb4cdd5L,
|
||||
0x72eacea8L, 0xfa6484bbL, 0x8d6612aeL, 0xbf3c6f47L,
|
||||
0xd29be463L, 0x542f5d9eL, 0xaec2771bL, 0xf64e6370L,
|
||||
0x740e0d8dL, 0xe75b1357L, 0xf8721671L, 0xaf537d5dL,
|
||||
0x4040cb08L, 0x4eb4e2ccL, 0x34d2466aL, 0x0115af84L,
|
||||
0xe1b00428L, 0x95983a1dL, 0x06b89fb4L, 0xce6ea048L,
|
||||
0x6f3f3b82L, 0x3520ab82L, 0x011a1d4bL, 0x277227f8L,
|
||||
0x611560b1L, 0xe7933fdcL, 0xbb3a792bL, 0x344525bdL,
|
||||
0xa08839e1L, 0x51ce794bL, 0x2f32c9b7L, 0xa01fbac9L,
|
||||
0xe01cc87eL, 0xbcc7d1f6L, 0xcf0111c3L, 0xa1e8aac7L,
|
||||
0x1a908749L, 0xd44fbd9aL, 0xd0dadecbL, 0xd50ada38L,
|
||||
0x0339c32aL, 0xc6913667L, 0x8df9317cL, 0xe0b12b4fL,
|
||||
0xf79e59b7L, 0x43f5bb3aL, 0xf2d519ffL, 0x27d9459cL,
|
||||
0xbf97222cL, 0x15e6fc2aL, 0x0f91fc71L, 0x9b941525L,
|
||||
0xfae59361L, 0xceb69cebL, 0xc2a86459L, 0x12baa8d1L,
|
||||
0xb6c1075eL, 0xe3056a0cL, 0x10d25065L, 0xcb03a442L,
|
||||
0xe0ec6e0eL, 0x1698db3bL, 0x4c98a0beL, 0x3278e964L,
|
||||
0x9f1f9532L, 0xe0d392dfL, 0xd3a0342bL, 0x8971f21eL,
|
||||
0x1b0a7441L, 0x4ba3348cL, 0xc5be7120L, 0xc37632d8L,
|
||||
0xdf359f8dL, 0x9b992f2eL, 0xe60b6f47L, 0x0fe3f11dL,
|
||||
0xe54cda54L, 0x1edad891L, 0xce6279cfL, 0xcd3e7e6fL,
|
||||
0x1618b166L, 0xfd2c1d05L, 0x848fd2c5L, 0xf6fb2299L,
|
||||
0xf523f357L, 0xa6327623L, 0x93a83531L, 0x56cccd02L,
|
||||
0xacf08162L, 0x5a75ebb5L, 0x6e163697L, 0x88d273ccL,
|
||||
0xde966292L, 0x81b949d0L, 0x4c50901bL, 0x71c65614L,
|
||||
0xe6c6c7bdL, 0x327a140aL, 0x45e1d006L, 0xc3f27b9aL,
|
||||
0xc9aa53fdL, 0x62a80f00L, 0xbb25bfe2L, 0x35bdd2f6L,
|
||||
0x71126905L, 0xb2040222L, 0xb6cbcf7cL, 0xcd769c2bL,
|
||||
0x53113ec0L, 0x1640e3d3L, 0x38abbd60L, 0x2547adf0L,
|
||||
0xba38209cL, 0xf746ce76L, 0x77afa1c5L, 0x20756060L,
|
||||
0x85cbfe4eL, 0x8ae88dd8L, 0x7aaaf9b0L, 0x4cf9aa7eL,
|
||||
0x1948c25cL, 0x02fb8a8cL, 0x01c36ae4L, 0xd6ebe1f9L,
|
||||
0x90d4f869L, 0xa65cdea0L, 0x3f09252dL, 0xc208e69fL,
|
||||
0xb74e6132L, 0xce77e25bL, 0x578fdfe3L, 0x3ac372e6L,
|
||||
}
|
||||
};
|
||||
|
||||
116
common/include/blowfish.h
Normal file
116
common/include/blowfish.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/* crypto/bf/blowfish.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BLOWFISH_H
|
||||
#define HEADER_BLOWFISH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BF_ENCRYPT 1
|
||||
#define BF_DECRYPT 0
|
||||
|
||||
/* If you make this 'unsigned int' the pointer variants will work on
|
||||
* the Alpha, otherwise they will not. Strangly using the '8 byte'
|
||||
* BF_LONG and the default 'non-pointer' inner loop is the best configuration
|
||||
* for the Alpha */
|
||||
#define BF_LONG unsigned long
|
||||
|
||||
#define BF_ROUNDS 16
|
||||
#define BF_BLOCK 8
|
||||
|
||||
typedef struct bf_key_st
|
||||
{
|
||||
BF_LONG P[BF_ROUNDS+2];
|
||||
BF_LONG S[4*256];
|
||||
} BF_KEY;
|
||||
|
||||
#ifndef NOPROTO
|
||||
|
||||
void BF_set_key(BF_KEY *key, int len, unsigned char *data);
|
||||
void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key,
|
||||
int enc);
|
||||
void BF_encrypt(BF_LONG *data,BF_KEY *key);
|
||||
void BF_decrypt(BF_LONG *data,BF_KEY *key);
|
||||
void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
BF_KEY *ks, unsigned char *iv, int enc);
|
||||
void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
|
||||
void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
BF_KEY *schedule, unsigned char *ivec, int *num);
|
||||
char *BF_options(void);
|
||||
|
||||
#else
|
||||
|
||||
void BF_set_key();
|
||||
void BF_ecb_encrypt();
|
||||
void BF_encrypt();
|
||||
void BF_decrypt();
|
||||
void BF_cbc_encrypt();
|
||||
void BF_cfb64_encrypt();
|
||||
void BF_ofb64_encrypt();
|
||||
char *BF_options();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
28
common/include/bogfile.H
Normal file
28
common/include/bogfile.H
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _BOGFILE_H
|
||||
#define _BOGFILE_H
|
||||
|
||||
|
||||
typedef enum {PT_Polygon,PT_Triangles,PT_Quads,PT_Quad_strip,
|
||||
PT_Triangle_strip,PT_Triangle_fan} PolyType_t;
|
||||
|
||||
|
||||
#endif /* _BOGFILE_H */
|
||||
50
common/include/bsdtree.H
Normal file
50
common/include/bsdtree.H
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _BSDTREE_H
|
||||
#define _BSDTREE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "object.H"
|
||||
#include "position.H"
|
||||
|
||||
class CBSDTreeNode : public CObject {
|
||||
double a,b,c,d;
|
||||
CBSDTreeNode *inNode,*outNode;
|
||||
public:
|
||||
CBSDTreeNode(double a, double b, double c, double d);
|
||||
void setInChild(CBSDTreeNode * inNode){ this->inNode = inNode; }
|
||||
void setOutChild(CBSDTreeNode * outNode){ this->outNode = outNode; }
|
||||
|
||||
int inside(double x, double y, double z);
|
||||
};
|
||||
|
||||
class CBSDTree: public CObject {
|
||||
CBSDTreeNode * BSDTree;
|
||||
public:
|
||||
CBSDTree();
|
||||
|
||||
int load(char * fileName);
|
||||
CBSDTreeNode * loadNode(FILE * bsdFile);
|
||||
int inside(double x, double y, double z);
|
||||
int inside(const CPosition & position);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BSDTREE_H
|
||||
46
common/include/cache.H
Normal file
46
common/include/cache.H
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _CACHE_H
|
||||
#define _CACHE_H
|
||||
|
||||
#include "objectlist.H"
|
||||
|
||||
class CCacheItem {
|
||||
int m_id;
|
||||
CObject * m_item;
|
||||
public:
|
||||
CCacheItem(int id,CObject * item) { m_id = id; m_item = item; }
|
||||
|
||||
int getId(){ return m_id; }
|
||||
CObject * setItem(CObject * item){ CObject * old = m_item; m_item = item; return old;}
|
||||
CObject * getItem() { return m_item; }
|
||||
};
|
||||
|
||||
class CCache : public CObject {
|
||||
CObjectList * cache;
|
||||
public:
|
||||
CCache();
|
||||
virtual CObject * failFunc(int id);
|
||||
CObject * add(int id, CObject * item);
|
||||
CObject * get(int id);
|
||||
void clear();
|
||||
};
|
||||
|
||||
#endif /* _CACHE_H */
|
||||
53
common/include/cellpvs.H
Normal file
53
common/include/cellpvs.H
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _CELLPVS_H
|
||||
#define _CELLPVS_H
|
||||
|
||||
#include "objectlist.H"
|
||||
#include "position.H"
|
||||
|
||||
class CWorldWorld;
|
||||
class CWorldObject;
|
||||
|
||||
|
||||
class CPVCell : public CObject {
|
||||
DWORD m_cellId;
|
||||
CPosition m_position;
|
||||
public:
|
||||
CPVCell(DWORD cellId, const CPosition & position);
|
||||
DWORD getCellId();
|
||||
CPosition getPosition();
|
||||
};
|
||||
|
||||
class CCellPVS : private CObjectList {
|
||||
CWorldWorld * m_world;
|
||||
public:
|
||||
CCellPVS(CWorldWorld * world);
|
||||
CWorldWorld * getWorld();
|
||||
|
||||
CPVCell* addPVCell(DWORD cellId, const CPosition & position);
|
||||
CObjectListItem * getFirstPVCell();
|
||||
CPosition getPVCellPosition(CWorldObject * cell);
|
||||
|
||||
CWorldObject * findCell(CPosition * position);
|
||||
|
||||
};
|
||||
|
||||
#endif // _CELLPVS_H
|
||||
61
common/include/commandparser.H
Normal file
61
common/include/commandparser.H
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _COMMANDPARSER_H
|
||||
#define _COMMANDPARSER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class CCommandParser {
|
||||
typedef vector<string> argv_t;
|
||||
|
||||
typedef void (CCommandParser::*CommandFunc_t)(argv_t & argv);
|
||||
|
||||
class CCommand {
|
||||
string m_commandString;
|
||||
CommandFunc_t m_commandFunc;
|
||||
public:
|
||||
CCommand(string & commandString,CommandFunc_t commandFunc);
|
||||
string & getCommandString();
|
||||
void executeCommand(argv_t & argv,CCommandParser * parser);
|
||||
};
|
||||
|
||||
typedef vector<CCommand> CommandList_t;
|
||||
|
||||
CommandList_t m_commandList;
|
||||
char m_commandPrefix;
|
||||
public:
|
||||
CCommandParser();
|
||||
void parseCommand(const string & commandString);
|
||||
|
||||
void setCommandPrefix(char commandPrefix);
|
||||
|
||||
virtual void commandChat(const string & chatMessage);
|
||||
virtual void commandUnknown(const string & commandString);
|
||||
|
||||
protected:
|
||||
void addCommand(string commandString,CommandFunc_t commandFunc);
|
||||
|
||||
private:
|
||||
void createArgv(string & argString, argv_t & argv);
|
||||
|
||||
};
|
||||
|
||||
#endif // _COMMANDPARSER_H
|
||||
76
common/include/communicate.H
Normal file
76
common/include/communicate.H
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _COMMUNICATE_H
|
||||
#define _COMMUNICATE_H
|
||||
|
||||
#include "timekeeper.H"
|
||||
#include "manager.H"
|
||||
#include "stream.H"
|
||||
#include "objectqueue.H"
|
||||
#include "message.H"
|
||||
#include "socket.H"
|
||||
#include "messagelist.H"
|
||||
|
||||
class CBadProtocolException : public CException {
|
||||
public:
|
||||
CBadProtocolException();
|
||||
};
|
||||
|
||||
class CCommunicate : public CTimeKeeperItem {
|
||||
|
||||
CManager * manager;
|
||||
CStream * stream;
|
||||
|
||||
CSocket * m_socket;
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
|
||||
// Write message variables
|
||||
CObjectQueue * msgWriteQueue;
|
||||
CMessage *currWriteMsg;
|
||||
int currWriteDelete;
|
||||
|
||||
// Read message variables
|
||||
CMessageList * msgList;
|
||||
CMessage *currReadMsg;
|
||||
int readStat;
|
||||
|
||||
virtual int timeKeeperFD(int event);
|
||||
|
||||
public:
|
||||
CCommunicate(CSocket * socket,CTimeKeeper * timeKeeper);
|
||||
virtual ~CCommunicate();
|
||||
|
||||
CSocket * getSocket();
|
||||
|
||||
virtual void quit();
|
||||
|
||||
void readyToRead();
|
||||
void readyToWrite();
|
||||
|
||||
void sendMessage(CMessage * message,int del);
|
||||
|
||||
void setManager(CManager * manager);
|
||||
CManager * getManager();
|
||||
|
||||
void addMsg(MsgCreateFunc_t msgCreateFunc);
|
||||
|
||||
};
|
||||
|
||||
#endif // _COMMUNICATE_H
|
||||
52
common/include/crossindex.H
Normal file
52
common/include/crossindex.H
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _CROSSINDEX_H
|
||||
#define _CROSSINDEX_H
|
||||
|
||||
class CCrossIndexItem {
|
||||
CCrossIndexItem * next;
|
||||
int indexA,indexB;
|
||||
public:
|
||||
CCrossIndexItem(int indexA,int indexB);
|
||||
virtual ~CCrossIndexItem() { if(next!=NULL) delete next; }
|
||||
|
||||
void setItem(int indexA,int indexB);
|
||||
int getIndexA() {return indexA;}
|
||||
int getIndexB() {return indexB;}
|
||||
|
||||
void setNext(CCrossIndexItem *next) {this->next=next;}
|
||||
CCrossIndexItem * getNext() {return next;}
|
||||
};
|
||||
|
||||
class CCrossIndex {
|
||||
CCrossIndexItem * first;
|
||||
public:
|
||||
CCrossIndex() { first=NULL; }
|
||||
virtual ~CCrossIndex() { if(first!=NULL) delete first; }
|
||||
|
||||
CCrossIndexItem * add(int indexA,int indexB);
|
||||
int getB(int indexA);
|
||||
int getA(int indexB);
|
||||
|
||||
};
|
||||
|
||||
#endif /* _CROSSINDEX_H */
|
||||
|
||||
|
||||
63
common/include/crypto.H
Normal file
63
common/include/crypto.H
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _CRYPTO_H
|
||||
#define _CRYPTO_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include "pvvmud.H"
|
||||
#include "blowfish.h"
|
||||
|
||||
class CCrypto {
|
||||
|
||||
// Common
|
||||
|
||||
BF_KEY *cryptKey;
|
||||
|
||||
// Reading Part of the code
|
||||
|
||||
unsigned char *cryptBuf_r,
|
||||
cryptIV_r[8];
|
||||
BYTE cryptState_r;
|
||||
int cryptSize_r,
|
||||
cryptPos_r,
|
||||
cryptN_r,
|
||||
cryptCnt_r;
|
||||
|
||||
// Writing Part of the code
|
||||
|
||||
unsigned char *cryptBuf_w,
|
||||
*cryptTempBuf,
|
||||
cryptIV_w[8];
|
||||
BYTE cryptState_w;
|
||||
int cryptSize_w,
|
||||
cryptPos_w,
|
||||
cryptN_w,
|
||||
cryptCnt_w,
|
||||
cryptTempSize,
|
||||
cryptTempPos;
|
||||
public:
|
||||
CCrypto(void);
|
||||
~CCrypto(void);
|
||||
ssize_t write(int fd, void *buf, size_t count);
|
||||
ssize_t read(int fd, char **buf, size_t count);
|
||||
|
||||
};
|
||||
|
||||
#endif _CRYPTO_H
|
||||
57
common/include/direction.H
Normal file
57
common/include/direction.H
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _DIRECTION_H
|
||||
#define _DIRECTION_H
|
||||
|
||||
#include "object.H"
|
||||
#include <iostream.h>
|
||||
|
||||
class CDirection: public CObject {
|
||||
|
||||
double direction[3];
|
||||
|
||||
public:
|
||||
CDirection();
|
||||
CDirection(double * direction);
|
||||
CDirection(double h, double r, double p);
|
||||
|
||||
CDirection& operator= (const CDirection& direction);
|
||||
CDirection& operator+= (const CDirection& direction);
|
||||
CDirection operator+ (const CDirection& direction);
|
||||
CDirection operator- () const;
|
||||
CDirection operator* (double scale) const;
|
||||
|
||||
void normalize();
|
||||
|
||||
double * getVector();
|
||||
double getValue(int ii) const ;
|
||||
void setValue(int ii,double value);
|
||||
double rotateHeading( double deltaHeading );
|
||||
double rotateRoll( double deltaRoll );
|
||||
double rotatePitch( double deltaPitch );
|
||||
double getHeading() const { return direction[0]; }
|
||||
double getRoll() const { return direction[1]; }
|
||||
double getPitch() const { return direction[2]; }
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CDirection& d);
|
||||
|
||||
#endif // _DIRECTION_H
|
||||
43
common/include/doublearray.H
Normal file
43
common/include/doublearray.H
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _DOUBLEARRAY_H
|
||||
#define _DOUBLEARRAY_H
|
||||
|
||||
#include <iostream.h>
|
||||
|
||||
class CDoubleArray {
|
||||
int m_size;
|
||||
int m_num;
|
||||
double * m_array;
|
||||
|
||||
public:
|
||||
CDoubleArray();
|
||||
virtual ~CDoubleArray();
|
||||
int add( double num );
|
||||
int add( CDoubleArray * doubleArray );
|
||||
int insert( double num );
|
||||
double get( int index ) const;
|
||||
void deleteAll();
|
||||
int getNumElements() const;
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CDoubleArray& d);
|
||||
|
||||
#endif // _DOUBLEARRAY_H
|
||||
34
common/include/exception.H
Normal file
34
common/include/exception.H
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _EXCEPTION_H
|
||||
#define _EXCEPTION_H
|
||||
|
||||
#include "object.H"
|
||||
#include <iostream.h>
|
||||
|
||||
class CException : public CObject {
|
||||
public:
|
||||
CException();
|
||||
CException(char * message);
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,CException& e);
|
||||
|
||||
#endif // _EXCEPTION_H
|
||||
254
common/include/geometry.H
Normal file
254
common/include/geometry.H
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _GEOMETRY_H
|
||||
#define _GEOMETRY_H
|
||||
|
||||
#include "object.H"
|
||||
#include "objectarray.H"
|
||||
#include <stdio.h>
|
||||
#include "cache.H"
|
||||
#include "texture.H"
|
||||
#include "material.H"
|
||||
#include "intarray.H"
|
||||
#include "doublearray.H"
|
||||
#include "beam.H"
|
||||
#include "vector.H"
|
||||
#include "plane.H"
|
||||
#include "vertex.H"
|
||||
#include "bbox.H"
|
||||
|
||||
#ifdef HAVE_GL_GL_H
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
#define POLYGON_TRIANGLES GL_TRIANGLES
|
||||
#define POLYGON_TRIANGLE_STRIP GL_TRIANGLE_STRIP
|
||||
#define POLYGON_TRIANGLE_FAN GL_TRIANGLE_FAN
|
||||
#define POLYGON_QUADS GL_QUADS
|
||||
#define POLYGON_QUAD_STRIP GL_QUAD_STRIP
|
||||
#define POLYGON_POLYGON GL_POLYGON
|
||||
|
||||
typedef GLdouble TexCoordCoord_t;
|
||||
typedef GLdouble NormalVector_t;
|
||||
|
||||
#else /* HAVE_GL_GL_H */
|
||||
|
||||
#define POLYGON_TRIANGLES 0x0004
|
||||
#define POLYGON_TRIANGLE_STRIP 0x0005
|
||||
#define POLYGON_TRIANGLE_FAN 0x0006
|
||||
#define POLYGON_QUADS 0x0007
|
||||
#define POLYGON_QUAD_STRIP 0x0008
|
||||
#define POLYGON_POLYGON 0x0009
|
||||
|
||||
typedef double TexCoordCoord_t;
|
||||
typedef double NormalVector_t;
|
||||
|
||||
#endif /* HAVE_GL_GL_H */
|
||||
|
||||
|
||||
class CGeometry;
|
||||
|
||||
class CTexCoord : public CObject{
|
||||
TexCoordCoord_t m_coord[2];
|
||||
public:
|
||||
CTexCoord(double u, double v);
|
||||
TexCoordCoord_t * getCoord();
|
||||
void setCoord(double u, double v);
|
||||
double getU();
|
||||
double getV();
|
||||
};
|
||||
|
||||
class CNormal : public CObject{
|
||||
NormalVector_t m_vector[3];
|
||||
public:
|
||||
CNormal(double x, double y, double z);
|
||||
NormalVector_t * getVector();
|
||||
void setVector(double x, double y, double z);
|
||||
double getX();
|
||||
double getY();
|
||||
double getZ();
|
||||
};
|
||||
|
||||
class CVertexList : public CObjectArray {
|
||||
public:
|
||||
CVertexList(int size);
|
||||
virtual ~CVertexList();
|
||||
int add( double x, double y, double z );
|
||||
void set( int index, double x, double y, double z );
|
||||
void get( int index, double * x, double * y, double * z );
|
||||
VertexCoord_t * get( int index );
|
||||
CVertex * getVertex( int index );
|
||||
int getSize();
|
||||
};
|
||||
|
||||
class CNormalList : public CObjectArray {
|
||||
public:
|
||||
CNormalList(int size);
|
||||
virtual ~CNormalList();
|
||||
int add(double x, double y, double z);
|
||||
void set( int index, double x, double y, double z );
|
||||
void get(int index, double * x, double * y, double * z );
|
||||
NormalVector_t * get( int index );
|
||||
CNormal * getNormal( int index );
|
||||
};
|
||||
|
||||
class CTexCoordList : public CObjectArray {
|
||||
public:
|
||||
CTexCoordList(int size);
|
||||
virtual ~CTexCoordList();
|
||||
int add( double u, double v);
|
||||
void set( int index, double u, double v );
|
||||
void get( int index, double * u, double * v );
|
||||
TexCoordCoord_t * get( int index );
|
||||
CTexCoord * getTexCoord( int index );
|
||||
};
|
||||
|
||||
class CPolygon;
|
||||
|
||||
class CPolygonList : public CObjectArray {
|
||||
CGeometry * m_geometry;
|
||||
public:
|
||||
CPolygonList(CGeometry * geometry,int size);
|
||||
virtual ~CPolygonList();
|
||||
int add( CPolygon * polygon );
|
||||
void set( int index, CPolygon * polygon );
|
||||
CPolygon * get(int index );
|
||||
};
|
||||
|
||||
class CPolygon : public CObject{
|
||||
int m_materialId;
|
||||
int m_type; /* POLYGON_QUADS , POLYGON_POLYGON , etc */
|
||||
CIntArray * m_vertexIndexList;
|
||||
CIntArray * m_normalIndexList;
|
||||
CIntArray * m_texCoordIndexList;
|
||||
|
||||
CGeometry * m_geometry;
|
||||
|
||||
public:
|
||||
CPolygon(int type, int materialId, int numVertices,
|
||||
int numNormals, int numTexCoords);
|
||||
virtual ~CPolygon();
|
||||
void setGeometry(CGeometry * geometry);
|
||||
void get( int * type,
|
||||
int * materialId, int * numVertices,
|
||||
int * numNormals, int * numTexCoords );
|
||||
int getType();
|
||||
void setMaterial( int materialId );
|
||||
int getMaterial();
|
||||
int addVertexIndex( int vertexIndex );
|
||||
void setVertexIndex( int index, int vertexIndex );
|
||||
int getVertexIndex( int index );
|
||||
CVertex * getVertex( int index );
|
||||
int addNormalIndex( int normalIndex );
|
||||
void setNormalIndex( int index, int normalIndex );
|
||||
int getNormalIndex( int index );
|
||||
CNormal * getNormal( int index );
|
||||
int addTexCoordIndex( int texCoordIndex );
|
||||
void setTexCoordIndex( int index, int texCoordIndex );
|
||||
int getTexCoordIndex( int index );
|
||||
CTexCoord * getTexCoord( int index );
|
||||
|
||||
CIntArray * getVertexIList();
|
||||
int getNumVertices();
|
||||
CIntArray * getNormalIList();
|
||||
CIntArray * getTexCoordIList();
|
||||
|
||||
void distances(CDoubleArray & distArray, const CBeam & beam);
|
||||
CDoubleArray* distances(const CBeam & beam);
|
||||
};
|
||||
|
||||
class CGeometry : public CObject{
|
||||
protected:
|
||||
int id,subid;
|
||||
CGeometry * next;
|
||||
CVertexList * vertexList;
|
||||
CNormalList * normalList;
|
||||
CTexCoordList * texCoordList;
|
||||
CPolygonList * polygonList;
|
||||
|
||||
public:
|
||||
CGeometry(int objectGeometryId);
|
||||
CGeometry(int objectGeometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons);
|
||||
virtual ~CGeometry();
|
||||
|
||||
virtual CGeometry * newGeometry(int geometryId);
|
||||
|
||||
void setSize(int numVertices, int numNormals,
|
||||
int numTexCoords, int numPolygons);
|
||||
int getId();
|
||||
void setId(int id);
|
||||
void setSubId( int subid );
|
||||
int getSubId();
|
||||
int getNumSubobjects();
|
||||
void setNext( CGeometry * next );
|
||||
CGeometry * getNext();
|
||||
int addVertex( double x, double y, double z );
|
||||
void getVertex( int index, double * x,
|
||||
double * y, double * z );
|
||||
CVertex * getVertex( int index );
|
||||
void setVertex( int index, double x,
|
||||
double y, double z );
|
||||
int addNormal( double x, double y, double z );
|
||||
void setNormal( int index, double x, double y, double z );
|
||||
void getNormal( int index, double * x,
|
||||
double * y, double * z );
|
||||
CNormal * getNormal( int index );
|
||||
int addTexCoord( double u, double v );
|
||||
void setTexCoord( int index, double u, double v );
|
||||
void getTexCoord( int index, double * u,
|
||||
double * v );
|
||||
CTexCoord * getTexCoord( int index );
|
||||
virtual int draw( CMaterialCache * matCache, CTextureCache * texCache );
|
||||
int addPolygon( CPolygon * polygon );
|
||||
void setPolygon( int index, CPolygon * polygon );
|
||||
CPolygon * getPolygon(int index );
|
||||
int getNumVertices();
|
||||
int getNumNormals();
|
||||
int getNumTexCoords();
|
||||
int getNumPolygons();
|
||||
int scale( double scale );
|
||||
// int ReadBOG(int objId, FILE * bog);
|
||||
|
||||
void distances(CDoubleArray & distArray, const CBeam & beam, double min, double max);
|
||||
CDoubleArray * distances(const CBeam & beam, double min, double max);
|
||||
CBBox calculateBBox();
|
||||
|
||||
void load(char * name);
|
||||
void save(char * name);
|
||||
|
||||
void readBOG(FILE * bog);
|
||||
int writeBOG(FILE * bog);
|
||||
private:
|
||||
int readBOGCore(FILE * bog, int numV, int numN, int numTC, int numP);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CGeometryCache : public CCache {
|
||||
public:
|
||||
CGeometryCache();
|
||||
virtual ~CGeometryCache();
|
||||
CGeometry * add( CGeometry * objGeo );
|
||||
CGeometry * get( int id );
|
||||
};
|
||||
|
||||
|
||||
#endif /* _GEOMETRY_H */
|
||||
53
common/include/gos.H
Normal file
53
common/include/gos.H
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _GOS_H
|
||||
#define _GOS_H
|
||||
|
||||
#include "manager.H"
|
||||
#include "socket.H"
|
||||
#include "geometry.H"
|
||||
#include "material.H"
|
||||
#include "texture.H"
|
||||
#include "timekeeper.H"
|
||||
#include "inetaddress.H"
|
||||
|
||||
class CGOS : public CManager {
|
||||
CClientSocket * socket;
|
||||
public:
|
||||
CGOS(CTimeKeeper * timeKeeper, CInetAddress *addr);
|
||||
|
||||
virtual void quit();
|
||||
|
||||
void request(int requestType,int requestId);
|
||||
virtual void error();
|
||||
virtual void geometry(CGeometry * geometry);
|
||||
virtual void material(CMaterial * material);
|
||||
virtual void texture(CTexture * texture);
|
||||
|
||||
virtual CGeometry * newGeometry(int geometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons);
|
||||
virtual CMaterial * newMaterial(int materialId);
|
||||
virtual CTexture * newTexture(int textureId);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // _GOS_H
|
||||
|
||||
57
common/include/gosmessage.H
Normal file
57
common/include/gosmessage.H
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _GETGOSMESSAGE_H
|
||||
#define _GETGOSMESSAGE_H
|
||||
|
||||
#include "msggos.H"
|
||||
|
||||
class CMsgGOSErrorGetGOS: public CMsgGOSError{
|
||||
public:
|
||||
CMsgGOSErrorGetGOS();
|
||||
static CMsgGOSErrorGetGOS * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgGeometryGetGOS: public CMsgGeometry {
|
||||
public:
|
||||
CMsgGeometryGetGOS();
|
||||
static CMsgGeometryGetGOS * createMsg();
|
||||
virtual int executeMsg();
|
||||
virtual CGeometry * newGeometry(int geometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons);
|
||||
};
|
||||
|
||||
class CMsgMaterialGetGOS: public CMsgMaterial {
|
||||
public:
|
||||
CMsgMaterialGetGOS();
|
||||
static CMsgMaterialGetGOS * createMsg();
|
||||
virtual int executeMsg();
|
||||
virtual CMaterial * newMaterial(int materialId);
|
||||
};
|
||||
|
||||
class CMsgTextureGetGOS: public CMsgTexture {
|
||||
public:
|
||||
CMsgTextureGetGOS();
|
||||
static CMsgTextureGetGOS * createMsg();
|
||||
virtual int executeMsg();
|
||||
virtual CTexture * newTexture(int textureId);
|
||||
};
|
||||
|
||||
#endif // _GETGOSMESSAGE_H
|
||||
35
common/include/gosprotocol.H
Normal file
35
common/include/gosprotocol.H
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _GOSPROTOCOL_H
|
||||
#define _GOSPROTOCOL_H
|
||||
|
||||
#include "communicate.H"
|
||||
#include "socket.H"
|
||||
|
||||
class CGOSProtocol: public CCommunicate {
|
||||
|
||||
public:
|
||||
CGOSProtocol(CSocket * socket,CTimeKeeper * timeKeeper);
|
||||
|
||||
virtual void quit();
|
||||
|
||||
};
|
||||
|
||||
#endif // _GOSPROTOCOL_H
|
||||
40
common/include/hash_map
Normal file
40
common/include/hash_map
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_HASH_MAP
|
||||
#define __SGI_STL_HASH_MAP
|
||||
|
||||
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
#include <stl_hashtable.h>
|
||||
#endif
|
||||
|
||||
#include <stl_hash_map.h>
|
||||
|
||||
#endif /* __SGI_STL_HASH_MAP */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
48
common/include/hash_map.h
Normal file
48
common/include/hash_map.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_HASH_MAP_H
|
||||
#define __SGI_STL_HASH_MAP_H
|
||||
|
||||
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
#include <stl_hashtable.h>
|
||||
#endif
|
||||
|
||||
#include <stl_hash_map.h>
|
||||
|
||||
#ifdef __STL_USE_NAMESPACES
|
||||
using __STD::hash;
|
||||
using __STD::hashtable;
|
||||
using __STD::hash_map;
|
||||
using __STD::hash_multimap;
|
||||
#endif /* __STL_USE_NAMESPACES */
|
||||
|
||||
|
||||
#endif /* __SGI_STL_HASH_MAP_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
49
common/include/inetaddress.H
Normal file
49
common/include/inetaddress.H
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _INETADDRESS_H
|
||||
#define _INETADDRESS_H
|
||||
|
||||
#include "object.H"
|
||||
#include "exception.H"
|
||||
|
||||
class CUnknownHostException : public CException {
|
||||
public:
|
||||
CUnknownHostException();
|
||||
};
|
||||
|
||||
class CInetAddress : public CObject {
|
||||
DWORD m_address;
|
||||
WORD m_port;
|
||||
public:
|
||||
CInetAddress();
|
||||
CInetAddress(DWORD address);
|
||||
CInetAddress(DWORD address,WORD port);
|
||||
CInetAddress(char * hostName,WORD port);
|
||||
CInetAddress(char * hostName);
|
||||
void setAddress(DWORD address,WORD port);
|
||||
char * getHostName();
|
||||
DWORD getAddress() { return m_address; }
|
||||
WORD getPort() { return m_port; }
|
||||
char * getAddressString();
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CInetAddress& address);
|
||||
|
||||
#endif // _INETADDRESS_H
|
||||
30
common/include/int.H
Normal file
30
common/include/int.H
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "object.H"
|
||||
|
||||
class CInt : public CObject{
|
||||
int cInt;
|
||||
public:
|
||||
CInt(int index);
|
||||
~CInt();
|
||||
int getValue();
|
||||
int setValue(int value);
|
||||
|
||||
};
|
||||
45
common/include/intarray.H
Normal file
45
common/include/intarray.H
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _INTARRAY_H
|
||||
#define _INTARRAY_H
|
||||
|
||||
class CIntArray {
|
||||
int m_size;
|
||||
int m_num;
|
||||
int * m_array;
|
||||
public:
|
||||
CIntArray();
|
||||
CIntArray(int size);
|
||||
CIntArray(const CIntArray & array);
|
||||
virtual ~CIntArray();
|
||||
int add( int num );
|
||||
int set( int index, int num);
|
||||
int get( int index ) const;
|
||||
int getNumElements() const;
|
||||
|
||||
int find( int value) const;
|
||||
|
||||
// Set operations
|
||||
CIntArray substracSet( const CIntArray & array ) const;
|
||||
CIntArray unionSet( const CIntArray & array ) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // _INTARRAY_H
|
||||
60
common/include/keyframe.H
Normal file
60
common/include/keyframe.H
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _KEYFRAME_H
|
||||
#define _KEYFRAME_H
|
||||
|
||||
#include <vector>
|
||||
#include <math.h>
|
||||
|
||||
#include "matrix.H"
|
||||
#include "vector.H"
|
||||
|
||||
typedef vector<CVector> ControlVector_t;
|
||||
class CKeyFrame;
|
||||
|
||||
class CInterpolate: public CObject {
|
||||
public:
|
||||
CInterpolate();
|
||||
|
||||
virtual CVector interpolate(double time, ControlVector_t * controlVector);
|
||||
virtual CVector interpolate(int start, double time,
|
||||
ControlVector_t * controlVector);
|
||||
|
||||
virtual void addControlVector(CKeyFrame * keyframe,
|
||||
const ControlVector_t & controlVector);
|
||||
|
||||
};
|
||||
|
||||
class CKeyFrame : public CObject {
|
||||
|
||||
ControlVector_t * m_controlVector;
|
||||
CInterpolate * m_interpolate;
|
||||
|
||||
public:
|
||||
CKeyFrame(CInterpolate * interpolate);
|
||||
virtual ~CKeyFrame();
|
||||
|
||||
void addControlVector(const CVector & vector);
|
||||
void addControlVector(const ControlVector_t & controlVector);
|
||||
|
||||
virtual CVector interpolate(double time);
|
||||
};
|
||||
|
||||
#endif // _KEYFRAME_H
|
||||
41
common/include/listener.H
Normal file
41
common/include/listener.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _LISTENER_H
|
||||
#define _LISTENER_H
|
||||
|
||||
#include "worldanimation.H"
|
||||
|
||||
class CWorldObject;
|
||||
|
||||
class CListener {
|
||||
|
||||
public:
|
||||
CListener();
|
||||
|
||||
virtual void sendAnimation(CWorldAnimation * animation) = 0;
|
||||
|
||||
// virtual void updatePosition(CWorldObject * object) = 0;
|
||||
// virtual void updateDirection(CWorldObject * object) = 0;
|
||||
// virtual void addObject(CWorldObject * object) = 0;
|
||||
// virtual void removeObject(CWorldObject * object) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // _LISTENER_H
|
||||
45
common/include/manager.H
Normal file
45
common/include/manager.H
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MANAGER_H
|
||||
#define _MANAGER_H
|
||||
|
||||
#include "object.H"
|
||||
#include "timekeeper.H"
|
||||
|
||||
class CCommunicate;
|
||||
|
||||
class CManager: public CTimeKeeperItem {
|
||||
CCommunicate * m_communicate;
|
||||
public:
|
||||
CManager();
|
||||
CManager(CCommunicate * communicate);
|
||||
~CManager();
|
||||
|
||||
CCommunicate * getCommunicate(){ return m_communicate; }
|
||||
void setCommunicate(CCommunicate * communicate);
|
||||
/*
|
||||
void addToTimeKeeper(CTimeKeeper * timeKeeper);
|
||||
void removeFromTimeKeeper(CTimeKeeper * timeKeeper);
|
||||
virtual void timeKeeperFD(int event);
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
#endif // _MANAGER_H
|
||||
111
common/include/material.H
Normal file
111
common/include/material.H
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MATERIAL_H
|
||||
#define _MATERIAL_H
|
||||
|
||||
#include "texture.H"
|
||||
|
||||
#define MAT_NOTEXTURE -1
|
||||
|
||||
typedef float RGBA_t[4];
|
||||
typedef float Shininess_t[1];
|
||||
|
||||
|
||||
class CMaterial : public CObject {
|
||||
int m_id;
|
||||
int m_textureId;
|
||||
|
||||
protected:
|
||||
RGBA_t m_ambient;
|
||||
RGBA_t m_diffuse;
|
||||
RGBA_t m_specular;
|
||||
RGBA_t m_emission;
|
||||
Shininess_t m_shininess;
|
||||
public:
|
||||
CMaterial();
|
||||
CMaterial(int materialId);
|
||||
CMaterial(int materialId, char * name);
|
||||
|
||||
virtual ~CMaterial() {}
|
||||
|
||||
int getId(){return m_id;}
|
||||
void setId(int materialId);
|
||||
|
||||
int load(char * fileName);
|
||||
int save(char * fileName);
|
||||
private:
|
||||
int loadBMAT(char * fileName);
|
||||
|
||||
public:
|
||||
void RGBA_SetColor(RGBA_t rgba, float red, float green, float blue, float alpha);
|
||||
void RGBA_Print(RGBA_t rgba);
|
||||
|
||||
//void loadMAT(int id,char * name);
|
||||
// void readMAT(int id,FILE * matFile);
|
||||
void setTextureId(int textureId);
|
||||
int getTextureId();
|
||||
|
||||
void setAmbient(float red, float green, float blue, float alpha);
|
||||
void setDiffuse(float red, float green, float blue, float alpha);
|
||||
void setSpecular(float red, float green, float blue, float alpha);
|
||||
void setShininess(float shininess);
|
||||
void setEmission(float red, float green, float blue, float alpha);
|
||||
|
||||
BYTE getAmbientByte(int num);
|
||||
BYTE getDiffuseByte(int num);
|
||||
BYTE getSpecularByte(int num);
|
||||
BYTE getEmissionByte(int num);
|
||||
BYTE getShininessByte();
|
||||
|
||||
float getAmbientFloat(int num);
|
||||
float getDiffuseFloat(int num);
|
||||
float getSpecularFloat(int num);
|
||||
float getEmissionFloat(int num);
|
||||
float getShininessFloat();
|
||||
|
||||
void setAmbient(int num,BYTE value);
|
||||
void setDiffuse(int num,BYTE value);
|
||||
void setSpecular(int num,BYTE value);
|
||||
void setEmission(int num,BYTE value);
|
||||
void setShininess(BYTE value);
|
||||
|
||||
virtual int exec(CTextureCache * texCache);
|
||||
};
|
||||
|
||||
class CMaterialCache : public CCache {
|
||||
public:
|
||||
CMaterialCache();
|
||||
virtual ~CMaterialCache() {}
|
||||
|
||||
CMaterial * add(CMaterial * material);
|
||||
CMaterial * get(int id);
|
||||
};
|
||||
|
||||
#endif /* _MATERIAL_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
22
common/include/matfile.H
Normal file
22
common/include/matfile.H
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
typedef enum{MAT_TEXTURE,MAT_AMBIENT,MAT_DIFFUSE,MAT_SPECULAR,MAT_EMISSION,MAT_SHININESS} MatFileIds_t;
|
||||
|
||||
59
common/include/matrix.H
Normal file
59
common/include/matrix.H
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MATRIX_H
|
||||
#define _MATRIX_H
|
||||
|
||||
#include "object.H"
|
||||
#include "direction.H"
|
||||
#include "position.H"
|
||||
#include <iostream.h>
|
||||
|
||||
class CVector;
|
||||
|
||||
class CMatrix: public CObject {
|
||||
double m_matrix[16];
|
||||
public:
|
||||
CMatrix();
|
||||
CMatrix(const CMatrix& matrix);
|
||||
CMatrix(double m0, double m4, double m8, double m12,
|
||||
double m1, double m5, double m9, double m13,
|
||||
double m2, double m6, double m10, double m14,
|
||||
double m3, double m7, double m11, double m15);
|
||||
CMatrix(CVector & v0, CVector & v1, CVector & v2, CVector & v3);
|
||||
|
||||
double * getVector();
|
||||
|
||||
void multiply(const CMatrix& matrix);
|
||||
|
||||
void loadIdentity();
|
||||
void rotate(const CDirection & direction);
|
||||
void rotate(double angle, double xx, double yy, double zz);
|
||||
void translate(const CPosition & position);
|
||||
|
||||
void transpose();
|
||||
|
||||
};
|
||||
|
||||
CMatrix operator*(const CMatrix & m1, const CMatrix & m2);
|
||||
|
||||
ostream& operator<<(ostream&s,const CMatrix& m);
|
||||
|
||||
|
||||
#endif // _MATRIX_H
|
||||
134
common/include/message.H
Normal file
134
common/include/message.H
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MESSAGE_H
|
||||
#define _MESSAGE_H
|
||||
|
||||
#include "object.H"
|
||||
#include "stream.H"
|
||||
#include "position.H"
|
||||
#include "direction.H"
|
||||
|
||||
#define MSGCURRPOS -1024
|
||||
|
||||
// Server client messages
|
||||
#define MSG_LOGIN 0
|
||||
#define MSG_HELLO 1
|
||||
#define MSG_BYE 2
|
||||
#define MSG_GETWORLD 3
|
||||
#define MSG_GEOMETRYOBJECT 4
|
||||
#define MSG_UPDATEPOSITION 5
|
||||
#define MSG_UPDATEDIRECTION 6
|
||||
#define MSG_COMMAND 7
|
||||
#define MSG_VIEWPOINT 8
|
||||
#define MSG_SELECTION 9
|
||||
#define MSG_ACTION 10
|
||||
#define MSG_ACTIONLIST 11
|
||||
#define MSG_MSG 12
|
||||
#define MSG_GEOOBJREMOVE 13
|
||||
#define MSG_SERVERINFO 14
|
||||
#define MSG_PLAYERINFO 15
|
||||
#define MSG_PING 16
|
||||
#define MSG_PONG 17
|
||||
|
||||
// Server messages
|
||||
#define MSG_SERVERLOGIN 50
|
||||
|
||||
// GOS client messages
|
||||
#define MSG_GOSREQUEST 100
|
||||
#define MSG_GOSERROR 101
|
||||
#define MSG_GEOMETRY 110
|
||||
#define MSG_MATERIAL 111
|
||||
#define MSG_TEXTURE 112
|
||||
|
||||
// Server Worldsrv messages
|
||||
//#define MSG_WORLDLOGIN 150
|
||||
#define MSG_GOSINFO 151
|
||||
//#define MSG_SECTION 152
|
||||
//#define MSG_CELL 153
|
||||
//#define MSG_REMOVECELL 154
|
||||
#define MSG_OBJECT 155
|
||||
#define MSG_REMOVEOBJECT 156
|
||||
#define MSG_CHANGEMASTERCELL 157
|
||||
#define MSG_PVCELL 158
|
||||
#define MSG_UPDATEHIERARCHY 159
|
||||
#define MSG_ROTATE 160
|
||||
|
||||
|
||||
#define MESSAGE_OK 1
|
||||
#define MESSAGE_BLOCKING 2
|
||||
|
||||
class CManager;
|
||||
|
||||
// Hope this to constant isn't used any more. 19990317
|
||||
// #define MESSAGE_MINLENGTH 0
|
||||
// #define MESSAGE_MAXLENGTH 128
|
||||
|
||||
class CMessage: public CObject {
|
||||
long length; // Message length or Header length when variable length message.
|
||||
CManager * manager;
|
||||
long currpos; // Current position for writing and reading.
|
||||
BYTE * message;
|
||||
long msglength; // Length of message buffer.
|
||||
long writeIndex; // Current write index in message buffer
|
||||
long readIndex; // Current read index in message buffer
|
||||
protected:
|
||||
void reallocMessage(long size);
|
||||
|
||||
// Write functions
|
||||
void writeByte(long index,BYTE byte);
|
||||
void writeWord(long index,WORD word);
|
||||
void writeDWord(long index,DWORD dword);
|
||||
void writeDouble(long index,double value);
|
||||
void writeBuf(long index,BYTE * buf,long size);
|
||||
void writeString(long index,char * str);
|
||||
void writePosition(long index,const CPosition & position);
|
||||
void writeDirection(long index,const CDirection & direction);
|
||||
|
||||
// Read functions
|
||||
BYTE readByte(long index);
|
||||
WORD readWord(long index);
|
||||
DWORD readDWord(long index);
|
||||
double readDouble(long index);
|
||||
void readBuf(long index,BYTE * buf,long size);
|
||||
char * readString(long index);
|
||||
CPosition readPosition(long index);
|
||||
CDirection readDirection(long index);
|
||||
int reciveMessage(CStream * stream,long index, long size);
|
||||
int sendMessage(CStream * stream,long index, long size);
|
||||
long getWriteIndex();
|
||||
long getReadIndex();
|
||||
virtual int reciveHead(CStream * stream);
|
||||
virtual int isVarLength() { return FALSE; }
|
||||
CManager * getManager(){ return manager; }
|
||||
public:
|
||||
CMessage(BYTE id, long length);
|
||||
~CMessage();
|
||||
static CMessage * createMsg();
|
||||
virtual int recive(CStream * stream);
|
||||
virtual void prepareSend(){ readIndex = 0; }
|
||||
virtual int send(CStream * stream);
|
||||
virtual int executeMsg(){ return FALSE; }
|
||||
void setManager(CManager * manager){this->manager = manager;}
|
||||
virtual BYTE getId();
|
||||
virtual long getLength();
|
||||
};
|
||||
|
||||
#endif // _MESSAGE_H
|
||||
|
||||
46
common/include/messagelist.H
Normal file
46
common/include/messagelist.H
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MESSAGELIST_H
|
||||
#define _MESSAGELIST_H
|
||||
|
||||
#include "objectlist.H"
|
||||
#include "message.H"
|
||||
|
||||
typedef CMessage * (*MsgCreateFunc_t)();
|
||||
|
||||
class CMessageItem : public CObject {
|
||||
public:
|
||||
BYTE id;
|
||||
int length;
|
||||
MsgCreateFunc_t msgCreateFunc;
|
||||
public:
|
||||
CMessageItem(BYTE id, int length, MsgCreateFunc_t msgCreateFunc);
|
||||
};
|
||||
|
||||
class CMessageList : public CObjectList {
|
||||
CMessageItem * getItem(BYTE id);
|
||||
public:
|
||||
void addMsg(MsgCreateFunc_t msgCreateFunc);
|
||||
int getLength(BYTE id);
|
||||
CMessage * createMsg(BYTE id);
|
||||
};
|
||||
|
||||
|
||||
#endif // _MESSAGELIST_H
|
||||
40
common/include/msgactionlist.H
Normal file
40
common/include/msgactionlist.H
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGACTIONLIST_H
|
||||
#define _MSGACTIONLIST_H
|
||||
|
||||
#include "msgvarlength.H"
|
||||
#include "objectlist.H"
|
||||
#include "action.H"
|
||||
|
||||
|
||||
class CMsgActionList : public CMsgVarLength {
|
||||
private:
|
||||
void setNumActions(int num);
|
||||
int getNumActions();
|
||||
public:
|
||||
CMsgActionList();
|
||||
CMsgActionList(WORD objectId);
|
||||
CObjectList * getActionList();
|
||||
void addAction(CAction * action);
|
||||
WORD getObjectId();
|
||||
};
|
||||
|
||||
#endif // _MSGACTIONLIST_H
|
||||
85
common/include/msggos.H
Normal file
85
common/include/msggos.H
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGGOS_H
|
||||
#define _MSGGOS_H
|
||||
|
||||
#include "geometry.H"
|
||||
#include "material.H"
|
||||
#include "texture.H"
|
||||
#include "msgvarlength.H"
|
||||
|
||||
#define GOSREQUEST_GEOMETRY 0
|
||||
#define GOSREQUEST_MATERIAL 1
|
||||
#define GOSREQUEST_TEXTURE 2
|
||||
|
||||
class CMsgGOSError : public CMessage {
|
||||
BYTE error;
|
||||
public:
|
||||
CMsgGOSError();
|
||||
CMsgGOSError(BYTE error);
|
||||
BYTE getError();
|
||||
};
|
||||
|
||||
class CMsgGOSRequest : public CMessage {
|
||||
public:
|
||||
CMsgGOSRequest();
|
||||
CMsgGOSRequest(BYTE requestType,WORD objectId);
|
||||
BYTE getRequestType();
|
||||
WORD getObjectId();
|
||||
};
|
||||
|
||||
class CMsgGeometry : public CMsgVarLength {
|
||||
public:
|
||||
CMsgGeometry();
|
||||
CMsgGeometry(CGeometry & geometry);
|
||||
DWORD getGeometryId();
|
||||
CGeometry * getGeometry();
|
||||
virtual CGeometry * newGeometry(int geometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons);
|
||||
};
|
||||
|
||||
class CMsgMaterial : public CMessage {
|
||||
public:
|
||||
CMsgMaterial();
|
||||
CMsgMaterial(CMaterial & material);
|
||||
int getMaterialId();
|
||||
int getTextureId();
|
||||
BYTE getAmbientByte(int num);
|
||||
BYTE getDiffuseByte(int num);
|
||||
BYTE getSpecularByte(int num);
|
||||
BYTE getEmissionByte(int num);
|
||||
BYTE getShininessByte();
|
||||
CMaterial * getMaterial();
|
||||
virtual CMaterial * newMaterial(int materialId);
|
||||
};
|
||||
|
||||
class CMsgTexture : public CMsgVarLength {
|
||||
public:
|
||||
CMsgTexture();
|
||||
CMsgTexture(CTexture & texture);
|
||||
WORD getTextureId();
|
||||
WORD getMapWidth();
|
||||
WORD getMapHeight();
|
||||
CTexture * getTexture();
|
||||
virtual CTexture * newTexture(int textureId);
|
||||
};
|
||||
|
||||
|
||||
#endif // _MSGGOS_H
|
||||
38
common/include/msgmsg.H
Normal file
38
common/include/msgmsg.H
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGMSG_H
|
||||
#define _MSGMSG_H
|
||||
|
||||
#include "msgvarlength.H"
|
||||
|
||||
class CMsgMsg : public CMsgVarLength {
|
||||
|
||||
public:
|
||||
CMsgMsg();
|
||||
CMsgMsg( const char * msg );
|
||||
~CMsgMsg();
|
||||
int getMsgLength(); // Return length including
|
||||
// nullterminator.
|
||||
void getMsg(char * msg); // Copy message to msg.
|
||||
};
|
||||
|
||||
#endif // _MSGMSG_H
|
||||
|
||||
|
||||
34
common/include/msgserver.H
Normal file
34
common/include/msgserver.H
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGSERVER_H
|
||||
#define _MSGSERVER_H
|
||||
|
||||
#include "message.H"
|
||||
#include "inetaddress.H"
|
||||
|
||||
class CMsgServerLogin : public CMessage {
|
||||
|
||||
public:
|
||||
CMsgServerLogin();
|
||||
CMsgServerLogin(CInetAddress & serverAddress);
|
||||
CInetAddress * getAddress();
|
||||
};
|
||||
|
||||
#endif // _MSGSERVER_H
|
||||
179
common/include/msgsrvcli.H
Normal file
179
common/include/msgsrvcli.H
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGSRVCLI_H
|
||||
#define _MSGSRVCLI_H
|
||||
|
||||
#include "message.H"
|
||||
#include "viewpoint.H"
|
||||
#include "inetaddress.H"
|
||||
|
||||
|
||||
class CMsgHello : public CMessage {
|
||||
public:
|
||||
CMsgHello();
|
||||
CMsgHello(WORD version);
|
||||
WORD getVersion();
|
||||
};
|
||||
|
||||
|
||||
#define LOGINNAMELENGTH 32
|
||||
#define LOGINPASSWDLENGTH 32
|
||||
|
||||
class CMsgLogin : public CMessage {
|
||||
public:
|
||||
CMsgLogin();
|
||||
CMsgLogin(char * name, char * passwd, BOOL newUser = FALSE);
|
||||
char * getUserName();
|
||||
char * getPasswd();
|
||||
BOOL getNewUser();
|
||||
};
|
||||
|
||||
|
||||
class CMsgServerInfo : public CMessage {
|
||||
public:
|
||||
CMsgServerInfo();
|
||||
CMsgServerInfo(CInetAddress & worldSrvAddress, CInetAddress & gosAddress);
|
||||
CInetAddress * getWorldSrvAddress();
|
||||
CInetAddress * getGOSAddress();
|
||||
};
|
||||
|
||||
class CMsgGOSInfo : public CMessage {
|
||||
public:
|
||||
CMsgGOSInfo();
|
||||
CMsgGOSInfo(CInetAddress & gosAddress);
|
||||
CInetAddress * getGOSAddress();
|
||||
};
|
||||
|
||||
|
||||
#define MSGBYE_QUIT 1
|
||||
#define MSGBYE_UNKNOWN 2
|
||||
#define MSGBYE_BADPROTOCOL 3
|
||||
|
||||
class CMsgBye : public CMessage {
|
||||
public:
|
||||
CMsgBye();
|
||||
CMsgBye(WORD reason);
|
||||
WORD getReason();
|
||||
char * getReasonString(WORD reason);
|
||||
};
|
||||
|
||||
class CMsgGetWorld : public CMessage {
|
||||
public:
|
||||
CMsgGetWorld();
|
||||
};
|
||||
|
||||
#define MSGCOMMAND_CLIENTCLEARWORLD 1
|
||||
#define MSGCOMMAND_ONLINE 2
|
||||
|
||||
// World commands
|
||||
#define MSGCOMMAND_ADDWORLD 100
|
||||
#define MSGCOMMAND_REMOVEWORLD 101
|
||||
|
||||
#define MSGCOMMAND_PLAYERLOOK 1000
|
||||
#define PLAYERLOOK_DEFAULT (MSGCOMMAND_PLAYERLOOK + 0)
|
||||
#define PLAYERLOOK_UP (MSGCOMMAND_PLAYERLOOK + 1)
|
||||
#define PLAYERLOOK_DOWN (MSGCOMMAND_PLAYERLOOK + 2)
|
||||
#define PLAYERLOOK_RIGHT (MSGCOMMAND_PLAYERLOOK + 3)
|
||||
#define PLAYERLOOK_LEFT (MSGCOMMAND_PLAYERLOOK + 4)
|
||||
#define PLAYERLOOK_FORWARD (MSGCOMMAND_PLAYERLOOK + 5)
|
||||
#define PLAYERLOOK_BACKWARD (MSGCOMMAND_PLAYERLOOK + 7)
|
||||
|
||||
#define MSGCOMMAND_PLAYERMOVE 2000
|
||||
#define PLAYERMOVE_STEPFORWARD (MSGCOMMAND_PLAYERMOVE + 1)
|
||||
#define PLAYERMOVE_STEPBACKWARD (MSGCOMMAND_PLAYERMOVE + 2)
|
||||
#define PLAYERMOVE_STEPLEFT (MSGCOMMAND_PLAYERMOVE + 3)
|
||||
#define PLAYERMOVE_STEPRIGHT (MSGCOMMAND_PLAYERMOVE + 4)
|
||||
#define PLAYERMOVE_MOVEFORWARD (MSGCOMMAND_PLAYERMOVE + 5)
|
||||
#define PLAYERMOVE_MOVEBACKWARD (MSGCOMMAND_PLAYERMOVE + 6)
|
||||
#define PLAYERMOVE_MOVELEFT (MSGCOMMAND_PLAYERMOVE + 7)
|
||||
#define PLAYERMOVE_MOVERIGHT (MSGCOMMAND_PLAYERMOVE + 8)
|
||||
#define PLAYERMOVE_RUNFORWARD (MSGCOMMAND_PLAYERMOVE + 9)
|
||||
#define PLAYERMOVE_RUNBACKWARD (MSGCOMMAND_PLAYERMOVE + 10)
|
||||
#define PLAYERMOVE_RUNLEFT (MSGCOMMAND_PLAYERMOVE + 11)
|
||||
#define PLAYERMOVE_RUNRIGHT (MSGCOMMAND_PLAYERMOVE + 12)
|
||||
|
||||
#define MSGCOMMAND_USERCOMMAND 3000
|
||||
#define USERCOMMAND_0 (MSGCOMMAND_USERCOMMAND + 0)
|
||||
#define USERCOMMAND_1 (MSGCOMMAND_USERCOMMAND + 1)
|
||||
#define USERCOMMAND_2 (MSGCOMMAND_USERCOMMAND + 2)
|
||||
#define USERCOMMAND_3 (MSGCOMMAND_USERCOMMAND + 3)
|
||||
#define USERCOMMAND_4 (MSGCOMMAND_USERCOMMAND + 4)
|
||||
#define USERCOMMAND_5 (MSGCOMMAND_USERCOMMAND + 5)
|
||||
#define USERCOMMAND_6 (MSGCOMMAND_USERCOMMAND + 6)
|
||||
#define USERCOMMAND_7 (MSGCOMMAND_USERCOMMAND + 7)
|
||||
#define USERCOMMAND_8 (MSGCOMMAND_USERCOMMAND + 8)
|
||||
#define USERCOMMAND_9 (MSGCOMMAND_USERCOMMAND + 9)
|
||||
|
||||
class CMsgCommand : public CMessage {
|
||||
public:
|
||||
CMsgCommand();
|
||||
CMsgCommand(WORD command);
|
||||
WORD getCommand();
|
||||
};
|
||||
|
||||
class CMsgViewpoint : public CMessage {
|
||||
public:
|
||||
CMsgViewpoint();
|
||||
CMsgViewpoint(CViewpoint & viewpoint);
|
||||
void getPosition(CPosition & position);
|
||||
void getDirection(CDirection & direction );
|
||||
DWORD getTargetId();
|
||||
};
|
||||
|
||||
class CMsgSelection : public CMessage {
|
||||
public:
|
||||
CMsgSelection();
|
||||
CMsgSelection(WORD objectId);
|
||||
WORD getObjectId();
|
||||
};
|
||||
|
||||
class CMsgAction : public CMessage {
|
||||
public:
|
||||
CMsgAction();
|
||||
CMsgAction(WORD objectId,WORD actionId);
|
||||
WORD getObjectId();
|
||||
WORD getActionId();
|
||||
};
|
||||
|
||||
class CMsgPlayerInfo : public CMessage {
|
||||
public:
|
||||
CMsgPlayerInfo();
|
||||
CMsgPlayerInfo( DWORD masterCellId );
|
||||
DWORD getMasterCellId();
|
||||
};
|
||||
|
||||
class CMsgPing : public CMessage {
|
||||
public:
|
||||
CMsgPing();
|
||||
CMsgPing( BYTE sequenceNumber );
|
||||
BYTE getSequenceNumber();
|
||||
};
|
||||
|
||||
class CMsgPong : public CMessage {
|
||||
public:
|
||||
CMsgPong();
|
||||
CMsgPong( BYTE sequenceNumber, DWORD serverTime );
|
||||
BYTE getSequenceNumber();
|
||||
DWORD getServerTime();
|
||||
};
|
||||
|
||||
|
||||
#endif // _MESSAGE_H
|
||||
|
||||
25
common/include/msgsrvgos.H
Normal file
25
common/include/msgsrvgos.H
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGSRVGOS_H
|
||||
#define _MSGSRVGOS_H
|
||||
|
||||
#include "message.H"
|
||||
|
||||
#endif // _MSGSRVGOS_H
|
||||
43
common/include/msgvarlength.H
Normal file
43
common/include/msgvarlength.H
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGVARLENGTH_H
|
||||
#define _MSGVARLENGTH_H
|
||||
|
||||
#include "message.H"
|
||||
|
||||
class CMsgVarLength: public CMessage {
|
||||
|
||||
|
||||
protected:
|
||||
virtual int isVarLength() { return TRUE; }
|
||||
virtual long getBodyLength();
|
||||
virtual void setBodyLength(DWORD bodyLength);
|
||||
virtual int sendBody(CStream * stream);
|
||||
virtual int reciveBody(CStream * stream);
|
||||
|
||||
public:
|
||||
CMsgVarLength(BYTE id);
|
||||
|
||||
virtual int recive(CStream * stream);
|
||||
virtual int send(CStream * stream);
|
||||
|
||||
};
|
||||
|
||||
#endif // _MSGVARLENGTH_H
|
||||
129
common/include/msgworld.H
Normal file
129
common/include/msgworld.H
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _MSGWORLD_H
|
||||
#define _MSGWORLD_H
|
||||
|
||||
#include "message.H"
|
||||
|
||||
class CPosition;
|
||||
class CDirection;
|
||||
|
||||
/*
|
||||
|
||||
class CMsgSection : public CMessage {
|
||||
public:
|
||||
CMsgSection();
|
||||
CMsgSection( DWORD sectionId ,BOOL create );
|
||||
DWORD getSectionId();
|
||||
BOOL getCreate();
|
||||
};
|
||||
|
||||
class CMsgCell : public CMessage {
|
||||
public:
|
||||
CMsgCell();
|
||||
CMsgCell( DWORD cellId, DWORD geometryId,
|
||||
const CPosition & position );
|
||||
DWORD getCellId();
|
||||
DWORD getGeometryId();
|
||||
CPosition getPosition();
|
||||
};
|
||||
|
||||
class CMsgRemoveCell : public CMessage {
|
||||
public:
|
||||
CMsgRemoveCell();
|
||||
CMsgRemoveCell( DWORD cellId );
|
||||
DWORD getCellId();
|
||||
};
|
||||
*/
|
||||
|
||||
class CMsgObject : public CMessage {
|
||||
public:
|
||||
CMsgObject();
|
||||
CMsgObject( DWORD objectId, DWORD geometryId, DWORD parentId,
|
||||
const CPosition & position,
|
||||
const CDirection & direction );
|
||||
DWORD getObjectId();
|
||||
DWORD getGeometryId();
|
||||
DWORD getParentId();
|
||||
CPosition getPosition();
|
||||
CDirection getDirection();
|
||||
};
|
||||
|
||||
class CMsgRemoveObject : public CMessage {
|
||||
public:
|
||||
CMsgRemoveObject();
|
||||
CMsgRemoveObject( DWORD objectId, DWORD parentId );
|
||||
DWORD getObjectId();
|
||||
DWORD getParentId();
|
||||
};
|
||||
|
||||
class CMsgChangeMasterCell : public CMessage {
|
||||
public:
|
||||
CMsgChangeMasterCell();
|
||||
CMsgChangeMasterCell( DWORD newMasterCellId );
|
||||
DWORD getNewMasterCellId();
|
||||
};
|
||||
|
||||
class CMsgPVCell : public CMessage {
|
||||
public:
|
||||
CMsgPVCell();
|
||||
CMsgPVCell( DWORD cellId, DWORD PVCellId, const CPosition & position );
|
||||
DWORD getCellId();
|
||||
DWORD getPVCellId();
|
||||
CPosition getPosition();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CMsgUpdatePosition : public CMessage {
|
||||
public:
|
||||
CMsgUpdatePosition();
|
||||
CMsgUpdatePosition(DWORD objectId, const CPosition& position);
|
||||
DWORD getObjectId();
|
||||
CPosition getPosition();
|
||||
};
|
||||
|
||||
class CMsgUpdateDirection : public CMessage {
|
||||
public:
|
||||
CMsgUpdateDirection();
|
||||
CMsgUpdateDirection(DWORD objectId, const CDirection& direction);
|
||||
DWORD getObjectId();
|
||||
CDirection getDirection();
|
||||
};
|
||||
|
||||
class CMsgUpdateHierarchy : public CMessage {
|
||||
public:
|
||||
CMsgUpdateHierarchy();
|
||||
CMsgUpdateHierarchy( DWORD objectId, DWORD parentId );
|
||||
DWORD getObjectId();
|
||||
DWORD getParentId();
|
||||
};
|
||||
|
||||
class CMsgRotate : public CMessage {
|
||||
public:
|
||||
CMsgRotate();
|
||||
CMsgRotate(DWORD objectId, const CDirection& angleSpeed);
|
||||
DWORD getObjectId();
|
||||
CDirection getAngleSpeed();
|
||||
};
|
||||
|
||||
#endif // _MSGWORLD_H
|
||||
|
||||
53
common/include/mudtypes.h
Normal file
53
common/include/mudtypes.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef BYTE
|
||||
#define BYTE unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
#define WORD unsigned short int
|
||||
#endif
|
||||
|
||||
#ifndef DWORD
|
||||
#define DWORD unsigned long
|
||||
#endif
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL int
|
||||
#endif
|
||||
|
||||
#define ID_UNKNOWN 0xFFFFFFFF
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265359
|
||||
#endif
|
||||
|
||||
72
common/include/namedb.H
Normal file
72
common/include/namedb.H
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _NAMEDB_H
|
||||
#define _NAMEDB_H
|
||||
|
||||
#include "crossindex.H"
|
||||
|
||||
class CNameDBItem {
|
||||
int id;
|
||||
char * name;
|
||||
CNameDBItem * next;
|
||||
public:
|
||||
CNameDBItem(int id,char *name);
|
||||
|
||||
char * getName() {return name;}
|
||||
int getId() {return id;}
|
||||
|
||||
void setNext(CNameDBItem *next) {this->next=next;}
|
||||
CNameDBItem * getNext() {return next;}
|
||||
};
|
||||
|
||||
class CNameDB {
|
||||
CNameDBItem * first;
|
||||
int currentId;
|
||||
public:
|
||||
CNameDB() {first=NULL;currentId=-1;}
|
||||
CNameDB(FILE *ndbfile) {
|
||||
first=NULL;
|
||||
currentId=-1;
|
||||
readNDB(ndbfile);
|
||||
}
|
||||
|
||||
int insert(char * name);
|
||||
int add(int id, char * name);
|
||||
|
||||
char * findName(int id);
|
||||
int findId(char * name);
|
||||
|
||||
void save(char *fileName);
|
||||
void load(char *fileName);
|
||||
|
||||
void writeNDB(FILE * ndbfile);
|
||||
void readNDB(FILE * ndbfile);
|
||||
|
||||
CCrossIndex * merge(CNameDB * mergeDB);
|
||||
|
||||
CNameDBItem * getFirst() {return first;}
|
||||
};
|
||||
|
||||
#endif /* _NAMEDB_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
common/include/object.H
Normal file
32
common/include/object.H
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _OBJECT_H
|
||||
#define _OBJECT_H
|
||||
|
||||
class CObject {
|
||||
char * m_name;
|
||||
public:
|
||||
CObject();
|
||||
virtual ~CObject();
|
||||
void setName(char * name);
|
||||
char * getName() { return m_name; }
|
||||
};
|
||||
|
||||
#endif /* _OBJECT_H */
|
||||
52
common/include/objectarray.H
Normal file
52
common/include/objectarray.H
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _OBJECTARRAY_H
|
||||
#define _OBJECTARRAY_H
|
||||
|
||||
#include "object.H"
|
||||
|
||||
class CObjectArray : public CObject {
|
||||
int m_size; // Array size
|
||||
int m_num; // Number of objects stored in array
|
||||
int m_grow; // Grow array with this number
|
||||
// 0 : Don't grow array
|
||||
// -1: Double size of array (DEFAULT)
|
||||
CObject **m_array; // Array holding objects
|
||||
public:
|
||||
CObjectArray();
|
||||
CObjectArray(int size);
|
||||
CObjectArray(int size,int grow);
|
||||
virtual ~CObjectArray();
|
||||
void deleteList(); // Delete all list items
|
||||
void deleteAll(); // Delete all list items and objects
|
||||
int add(CObject * obj); // Add object at end of array
|
||||
void insert(int index,CObject * obj);
|
||||
void set(int index,CObject * obj);
|
||||
CObject* getItem(int index);
|
||||
void remove(CObject * obj);
|
||||
void remove(int index);
|
||||
int getNumElements();
|
||||
};
|
||||
|
||||
#endif /* _OBJECTARRAY_H */
|
||||
|
||||
|
||||
|
||||
|
||||
66
common/include/objectlist.H
Normal file
66
common/include/objectlist.H
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _OBJECTLIST_H
|
||||
#define _OBJECTLIST_H
|
||||
|
||||
#include "object.H"
|
||||
|
||||
class CObjectListItem {
|
||||
CObjectListItem *m_next,*m_prev;
|
||||
CObject * m_object;
|
||||
|
||||
public:
|
||||
CObjectListItem();
|
||||
CObjectListItem(CObject * item);
|
||||
|
||||
void setObject(CObject * object);
|
||||
CObject * getObject();
|
||||
|
||||
void setNext(CObjectListItem * next);
|
||||
CObjectListItem * getNext();
|
||||
void setPrev(CObjectListItem * prev);
|
||||
CObjectListItem * getPrev();
|
||||
|
||||
};
|
||||
|
||||
class CObjectList : public CObject {
|
||||
CObjectListItem *m_first, *m_last;
|
||||
public:
|
||||
CObjectList();
|
||||
virtual ~CObjectList();
|
||||
void deleteList(); /* Delete all list items */
|
||||
void deleteAll(); /* Delete all list items and objects */
|
||||
CObjectListItem * addFirst(CObject * obj);
|
||||
CObjectListItem * addLast(CObject * obj);
|
||||
CObjectListItem * removeFirst();
|
||||
CObjectListItem * removeLast();
|
||||
CObjectListItem * getFirst();
|
||||
CObjectListItem * getLast();
|
||||
void remove(CObject * obj);
|
||||
// CObjectListItem * getNext(CObjectListItem * objListItem);
|
||||
CObjectListItem * getItem(int index);
|
||||
int getNumItems();
|
||||
};
|
||||
|
||||
#endif /* _OBJECTLIST_H */
|
||||
|
||||
|
||||
|
||||
|
||||
37
common/include/objectqueue.H
Normal file
37
common/include/objectqueue.H
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _OBJECTQUEUE_H
|
||||
#define _OBJECTQUEUE_H
|
||||
|
||||
#include "objectlist.H"
|
||||
|
||||
class CObjectQueue: public CObjectList {
|
||||
|
||||
public:
|
||||
CObjectQueue();
|
||||
virtual ~CObjectQueue();
|
||||
|
||||
void add(CObject * object);
|
||||
CObject * getFIFO();
|
||||
CObject * getStack();
|
||||
|
||||
};
|
||||
|
||||
#endif // _OBJECTQUEUE_H
|
||||
91
common/include/option.H
Normal file
91
common/include/option.H
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _OPTION_H
|
||||
#define _OPTION_H
|
||||
|
||||
#include "object.H"
|
||||
#include "objectlist.H"
|
||||
#include <stdio.h>
|
||||
|
||||
class COptionItem : public CObject {
|
||||
|
||||
enum {STR_VALUE,INT_VALUE,DOUBLE_VALUE} m_type;
|
||||
|
||||
static char *m_typeString[];
|
||||
|
||||
union {
|
||||
char * strValue;
|
||||
int intValue;
|
||||
double doubleValue;
|
||||
} m_value;
|
||||
|
||||
char m_abbreviation;
|
||||
|
||||
public:
|
||||
COptionItem(char * name, char abbreviation, char * strValue);
|
||||
COptionItem(char * name, char abbreviation, int intValue);
|
||||
COptionItem(char * name, char abbreviation, double doubleValue);
|
||||
|
||||
void setAbbreviation(char abbreviation);
|
||||
char getAbbreviation();
|
||||
|
||||
void setValue(char * strValue);
|
||||
void setValue(int intValue);
|
||||
void setValue(double doubleValue);
|
||||
|
||||
void updateValue(char * valueString);
|
||||
|
||||
char * getString();
|
||||
int getInt();
|
||||
double getDouble();
|
||||
|
||||
void dump();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class COption : private CObjectList {
|
||||
public:
|
||||
COption();
|
||||
|
||||
void setValue(char * name, char abbreviation, char * strValue);
|
||||
void setValue(char * name, char abbreviation, int intValue);
|
||||
void setValue(char * name, char abbreviation, double doubleValue);
|
||||
|
||||
char * getString(char * name);
|
||||
int getInt(char * name);
|
||||
double getDouble(char * name);
|
||||
|
||||
void parseArguments(int argc, char * argv[]);
|
||||
void loadOption(char * fileName);
|
||||
void loadOption(FILE * file);
|
||||
|
||||
private:
|
||||
void updateName(const char * name, char * valueString);
|
||||
void updateAbbreviation(char abbreviation, char * valueString);
|
||||
|
||||
public:
|
||||
void dump();
|
||||
private:
|
||||
COptionItem * findOptionItem(const char * name);
|
||||
COptionItem * findOptionItemByAbbreviation(char abbreviation);
|
||||
};
|
||||
|
||||
#endif // _OPTION_H
|
||||
66
common/include/pingpong.H
Normal file
66
common/include/pingpong.H
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _PINGPONG_H
|
||||
#define _PINGPONG_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#define MAXPINGPONG 21
|
||||
|
||||
#define PS_NOTUSED 0
|
||||
#define PS_OK 1
|
||||
#define PS_WAIT 2
|
||||
#define PS_BAD 3
|
||||
|
||||
typedef vector<DWORD> delta_t;
|
||||
|
||||
class CPingPong {
|
||||
|
||||
typedef struct {
|
||||
BYTE state;
|
||||
DWORD sendTime;
|
||||
DWORD reciveTime;
|
||||
DWORD serverTime;
|
||||
} pingPong_t;
|
||||
|
||||
pingPong_t * m_pingPong;
|
||||
BYTE m_currPing;
|
||||
BYTE m_maxPing;
|
||||
BYTE m_numPing;
|
||||
BOOL m_firstPing;
|
||||
|
||||
private:
|
||||
delta_t getDeltaVector(DWORD * deltaTime);
|
||||
|
||||
public:
|
||||
CPingPong(BYTE maxPing);
|
||||
virtual ~CPingPong();
|
||||
|
||||
BYTE sendPing(DWORD sendTime);
|
||||
long recivePong(DWORD reciveTime, BYTE sequenceNumber, DWORD serverTime);
|
||||
|
||||
friend ostream& operator<<(ostream&s,CPingPong&pingPong);
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,CPingPong&p);
|
||||
|
||||
#endif // _PINGPONG_H
|
||||
48
common/include/plane.H
Normal file
48
common/include/plane.H
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _PLANE_H
|
||||
#define _PLANE_H
|
||||
|
||||
#include "object.H"
|
||||
#include <iostream.h>
|
||||
#include "vector.H"
|
||||
#include "vertex.H"
|
||||
|
||||
class CPlane : public CObject {
|
||||
double m_a,m_b,m_c,m_d;
|
||||
public:
|
||||
CPlane();
|
||||
CPlane(const CVector & point,const CVector & normal);
|
||||
CPlane(const CVertex & point,const CVector & normal);
|
||||
CPlane(const CVertex & v1,const CVertex & v2,const CVertex & v3);
|
||||
|
||||
double getA() const;
|
||||
double getB() const;
|
||||
double getC() const;
|
||||
double getD() const;
|
||||
|
||||
double distance(const CVector & position);
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CPlane& p);
|
||||
|
||||
|
||||
#endif // _PLANE_H
|
||||
59
common/include/position.H
Normal file
59
common/include/position.H
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _POSITION_H
|
||||
#define _POSITION_H
|
||||
|
||||
#include "object.H"
|
||||
#include <iostream.h>
|
||||
|
||||
class CPosition: public CObject {
|
||||
|
||||
double position[3];
|
||||
|
||||
public:
|
||||
CPosition();
|
||||
CPosition(double * position);
|
||||
CPosition(double x, double y, double z);
|
||||
virtual ~CPosition();
|
||||
|
||||
double * getVector();
|
||||
double moveX(double delta) { return position[0] += delta; }
|
||||
double moveY(double delta) { return position[1] += delta; }
|
||||
double moveZ(double delta) { return position[2] += delta; }
|
||||
double getX() const { return position[0]; }
|
||||
double getY() const { return position[1]; }
|
||||
double getZ() const { return position[2]; }
|
||||
double getValue(int ii) const { return position[ii]; }
|
||||
void setValue(int ii,double value) { position[ii] = value; }
|
||||
|
||||
CPosition& operator= (const CPosition& position);
|
||||
CPosition& operator+= (const CPosition& position);
|
||||
int operator< (const CPosition& position) const;
|
||||
int operator> (const CPosition& position) const;
|
||||
int operator<= (const CPosition& position) const;
|
||||
int operator>= (const CPosition& position) const;
|
||||
CPosition operator- (const CPosition& position) const;
|
||||
CPosition operator- () const;
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&s,const CPosition& e);
|
||||
|
||||
#endif // _POSITION_H
|
||||
63
common/include/pvvmud.H
Normal file
63
common/include/pvvmud.H
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _PVVMUD_H
|
||||
#define _PVVMUD_H
|
||||
|
||||
#include "mudtypes.h"
|
||||
|
||||
#define cdebug cerr
|
||||
|
||||
// Added to handle history-system in console
|
||||
#define KEY_UP 120
|
||||
#define KEY_DOWN 121
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (a > b ? a : b)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (a < b ? a : b)
|
||||
#endif
|
||||
|
||||
// PROTOCOL_VERSION 0xAABB give Version AA.BB
|
||||
#define PROTOCOL_VERSION 0x0001 // Version 0.1
|
||||
|
||||
#define SERVER_CLIENT_PORT 4242
|
||||
#define SERVER_GOS_PORT 4243
|
||||
#define SERVER_WORLDSRV_PORT 4244
|
||||
#define GOS_CLIENT_PORT 4252
|
||||
#define GOS_SERVER_PORT 4253
|
||||
#define WORLDSRV_CLIENT_PORT 4262
|
||||
#define WORLDSRV_SERVER_PORT 4263
|
||||
|
||||
#ifdef PVVMUDCLIENT
|
||||
|
||||
#include "client.H"
|
||||
|
||||
#endif // PVVMUDCLIENT
|
||||
|
||||
// Define this if you like all your communication to be crypted
|
||||
// #define CRYPTO
|
||||
|
||||
#endif /* _PVVMUD_H */
|
||||
|
||||
|
||||
|
||||
|
||||
68
common/include/socket.H
Normal file
68
common/include/socket.H
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _SOCKET_H
|
||||
#define _SOCKET_H
|
||||
|
||||
#include "object.H"
|
||||
#include "inetaddress.H"
|
||||
#include "exception.H"
|
||||
#include "stream.H"
|
||||
|
||||
class CSocketException : public CException {
|
||||
public:
|
||||
CSocketException();
|
||||
};
|
||||
|
||||
|
||||
class CSocket : public CObject {
|
||||
int fd;
|
||||
int port;
|
||||
CInetAddress address;
|
||||
int localPort;
|
||||
CInetAddress localAddress;
|
||||
private:
|
||||
void set_fl(int flags);
|
||||
public:
|
||||
CSocket();
|
||||
CSocket(int fd);
|
||||
int getFileDescriptor() { return fd; }
|
||||
CInetAddress & getAddress() { return address; }
|
||||
CInetAddress & getLocalAddress() { return localAddress; }
|
||||
void bind(char *addr,int port);
|
||||
void listen(int number);
|
||||
void connect(unsigned long addr,int port);
|
||||
CStream * getStream();
|
||||
void close();
|
||||
void setNonBlocking();
|
||||
};
|
||||
|
||||
class CClientSocket : public CSocket {
|
||||
public:
|
||||
CClientSocket(unsigned long addr,int port);
|
||||
};
|
||||
|
||||
class CServerSocket : public CSocket {
|
||||
public:
|
||||
CServerSocket(int port);
|
||||
CServerSocket(char *addr,int port);
|
||||
CSocket * accept();
|
||||
};
|
||||
|
||||
#endif /* _SOCKET_H */
|
||||
83
common/include/spline.H
Normal file
83
common/include/spline.H
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _SPLINE_H
|
||||
#define _SPLINE_H
|
||||
|
||||
#include "keyframe.H"
|
||||
|
||||
class CSpline: public CInterpolate {
|
||||
CMatrix * m_basis;
|
||||
public:
|
||||
CSpline(CMatrix * basis);
|
||||
|
||||
virtual CVector interpolate(double time, ControlVector_t * controlVector);
|
||||
|
||||
virtual CVector interpolate(double time, CMatrix & control);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Catmull-Rom
|
||||
// For N segments we need 4+(N-1) control vectors [0..K]
|
||||
// Line pass through all control vector except first and last.
|
||||
// s control the tension of the curve.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class CCatmullRom : public CSpline{
|
||||
public:
|
||||
CCatmullRom(double s = 1.0);
|
||||
|
||||
virtual void addControlVector(CKeyFrame * keyFrame,
|
||||
const ControlVector_t & controlVector);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Bezier
|
||||
// For N segments we need 4+3*(N-1) control vectors [0..K]
|
||||
// Line pass through every 4. control vector including first and last.
|
||||
// Every 2. and 3. points are used to control the curve form.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class CBezier : public CSpline {
|
||||
static CMatrix m_bezier;
|
||||
public:
|
||||
CBezier();
|
||||
|
||||
virtual void addControlVector(CKeyFrame * keyFrame,
|
||||
const ControlVector_t & controlVector);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Hermite
|
||||
// For N segments we need 4+2*(N-1) control vectors [0..K]
|
||||
// Line pass through every odd control vector. Every even contorl vector
|
||||
// is a tangent for the curve.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class CHermite : public CSpline {
|
||||
static CMatrix m_hermite;
|
||||
public:
|
||||
CHermite();
|
||||
|
||||
virtual void addControlVector(CKeyFrame * keyFrame,
|
||||
const ControlVector_t & controlVector);
|
||||
|
||||
};
|
||||
|
||||
#endif // _SPLINE_H
|
||||
93
common/include/stl_hash_fun.h
Normal file
93
common/include/stl_hash_fun.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This is an internal header file, included by other STL headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_HASH_FUN_H
|
||||
#define __SGI_STL_HASH_FUN_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
__STL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Key> struct hash { };
|
||||
|
||||
inline size_t __stl_hash_string(const char* s)
|
||||
{
|
||||
unsigned long h = 0;
|
||||
for ( ; *s; ++s)
|
||||
h = 5*h + *s;
|
||||
|
||||
return size_t(h);
|
||||
}
|
||||
|
||||
__STL_TEMPLATE_NULL struct hash<char*>
|
||||
{
|
||||
size_t operator()(const char* s) const { return __stl_hash_string(s); }
|
||||
};
|
||||
|
||||
__STL_TEMPLATE_NULL struct hash<const char*>
|
||||
{
|
||||
size_t operator()(const char* s) const { return __stl_hash_string(s); }
|
||||
};
|
||||
|
||||
__STL_TEMPLATE_NULL struct hash<char> {
|
||||
size_t operator()(char x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<unsigned char> {
|
||||
size_t operator()(unsigned char x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<signed char> {
|
||||
size_t operator()(unsigned char x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<short> {
|
||||
size_t operator()(short x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<unsigned short> {
|
||||
size_t operator()(unsigned short x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<int> {
|
||||
size_t operator()(int x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<unsigned int> {
|
||||
size_t operator()(unsigned int x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<long> {
|
||||
size_t operator()(long x) const { return x; }
|
||||
};
|
||||
__STL_TEMPLATE_NULL struct hash<unsigned long> {
|
||||
size_t operator()(unsigned long x) const { return x; }
|
||||
};
|
||||
|
||||
__STL_END_NAMESPACE
|
||||
|
||||
#endif /* __SGI_STL_HASH_FUN_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
358
common/include/stl_hash_map.h
Normal file
358
common/include/stl_hash_map.h
Normal file
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This is an internal header file, included by other STL headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_INTERNAL_HASH_MAP_H
|
||||
#define __SGI_STL_INTERNAL_HASH_MAP_H
|
||||
|
||||
|
||||
__STL_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
||||
#pragma set woff 1174
|
||||
#endif
|
||||
|
||||
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
|
||||
template <class Key, class T, class HashFcn = hash<Key>,
|
||||
class EqualKey = equal_to<Key>,
|
||||
class Alloc = alloc>
|
||||
#else
|
||||
template <class Key, class T, class HashFcn, class EqualKey,
|
||||
class Alloc = alloc>
|
||||
#endif
|
||||
class hash_map
|
||||
{
|
||||
private:
|
||||
typedef hashtable<pair<const Key, T>, Key, HashFcn,
|
||||
select1st<pair<const Key, T> >, EqualKey, Alloc> ht;
|
||||
ht rep;
|
||||
|
||||
public:
|
||||
typedef typename ht::key_type key_type;
|
||||
typedef T data_type;
|
||||
typedef T mapped_type;
|
||||
typedef typename ht::value_type value_type;
|
||||
typedef typename ht::hasher hasher;
|
||||
typedef typename ht::key_equal key_equal;
|
||||
|
||||
typedef typename ht::size_type size_type;
|
||||
typedef typename ht::difference_type difference_type;
|
||||
typedef typename ht::pointer pointer;
|
||||
typedef typename ht::const_pointer const_pointer;
|
||||
typedef typename ht::reference reference;
|
||||
typedef typename ht::const_reference const_reference;
|
||||
|
||||
typedef typename ht::iterator iterator;
|
||||
typedef typename ht::const_iterator const_iterator;
|
||||
|
||||
hasher hash_funct() const { return rep.hash_funct(); }
|
||||
key_equal key_eq() const { return rep.key_eq(); }
|
||||
|
||||
public:
|
||||
hash_map() : rep(100, hasher(), key_equal()) {}
|
||||
explicit hash_map(size_type n) : rep(n, hasher(), key_equal()) {}
|
||||
hash_map(size_type n, const hasher& hf) : rep(n, hf, key_equal()) {}
|
||||
hash_map(size_type n, const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) {}
|
||||
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class InputIterator>
|
||||
hash_map(InputIterator f, InputIterator l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_map(InputIterator f, InputIterator l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_map(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_unique(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_map(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_unique(f, l); }
|
||||
|
||||
#else
|
||||
hash_map(const value_type* f, const value_type* l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const value_type* f, const value_type* l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const value_type* f, const value_type* l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const value_type* f, const value_type* l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_unique(f, l); }
|
||||
|
||||
hash_map(const_iterator f, const_iterator l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const_iterator f, const_iterator l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const_iterator f, const_iterator l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_unique(f, l); }
|
||||
hash_map(const_iterator f, const_iterator l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_unique(f, l); }
|
||||
#endif /*__STL_MEMBER_TEMPLATES */
|
||||
|
||||
public:
|
||||
size_type size() const { return rep.size(); }
|
||||
size_type max_size() const { return rep.max_size(); }
|
||||
bool empty() const { return rep.empty(); }
|
||||
void swap(hash_map& hs) { rep.swap(hs.rep); }
|
||||
friend bool
|
||||
operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
|
||||
|
||||
iterator begin() { return rep.begin(); }
|
||||
iterator end() { return rep.end(); }
|
||||
const_iterator begin() const { return rep.begin(); }
|
||||
const_iterator end() const { return rep.end(); }
|
||||
|
||||
public:
|
||||
pair<iterator, bool> insert(const value_type& obj)
|
||||
{ return rep.insert_unique(obj); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator f, InputIterator l) { rep.insert_unique(f,l); }
|
||||
#else
|
||||
void insert(const value_type* f, const value_type* l) {
|
||||
rep.insert_unique(f,l);
|
||||
}
|
||||
void insert(const_iterator f, const_iterator l) { rep.insert_unique(f, l); }
|
||||
#endif /*__STL_MEMBER_TEMPLATES */
|
||||
pair<iterator, bool> insert_noresize(const value_type& obj)
|
||||
{ return rep.insert_unique_noresize(obj); }
|
||||
|
||||
iterator find(const key_type& key) { return rep.find(key); }
|
||||
const_iterator find(const key_type& key) const { return rep.find(key); }
|
||||
|
||||
T& operator[](const key_type& key) {
|
||||
return rep.find_or_insert(value_type(key, T())).second;
|
||||
}
|
||||
|
||||
size_type count(const key_type& key) const { return rep.count(key); }
|
||||
|
||||
pair<iterator, iterator> equal_range(const key_type& key)
|
||||
{ return rep.equal_range(key); }
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& key) const
|
||||
{ return rep.equal_range(key); }
|
||||
|
||||
size_type erase(const key_type& key) {return rep.erase(key); }
|
||||
void erase(iterator it) { rep.erase(it); }
|
||||
void erase(iterator f, iterator l) { rep.erase(f, l); }
|
||||
void clear() { rep.clear(); }
|
||||
|
||||
public:
|
||||
void resize(size_type hint) { rep.resize(hint); }
|
||||
size_type bucket_count() const { return rep.bucket_count(); }
|
||||
size_type max_bucket_count() const { return rep.max_bucket_count(); }
|
||||
size_type elems_in_bucket(size_type n) const
|
||||
{ return rep.elems_in_bucket(n); }
|
||||
};
|
||||
|
||||
template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
|
||||
inline bool operator==(const hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm1,
|
||||
const hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm2)
|
||||
{
|
||||
return hm1.rep == hm2.rep;
|
||||
}
|
||||
|
||||
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
|
||||
|
||||
template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
|
||||
inline void swap(hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm1,
|
||||
hash_map<Key, T, HashFcn, EqualKey, Alloc>& hm2)
|
||||
{
|
||||
hm1.swap(hm2);
|
||||
}
|
||||
|
||||
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
|
||||
|
||||
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
|
||||
template <class Key, class T, class HashFcn = hash<Key>,
|
||||
class EqualKey = equal_to<Key>,
|
||||
class Alloc = alloc>
|
||||
#else
|
||||
template <class Key, class T, class HashFcn, class EqualKey,
|
||||
class Alloc = alloc>
|
||||
#endif
|
||||
class hash_multimap
|
||||
{
|
||||
private:
|
||||
typedef hashtable<pair<const Key, T>, Key, HashFcn,
|
||||
select1st<pair<const Key, T> >, EqualKey, Alloc> ht;
|
||||
ht rep;
|
||||
|
||||
public:
|
||||
typedef typename ht::key_type key_type;
|
||||
typedef T data_type;
|
||||
typedef T mapped_type;
|
||||
typedef typename ht::value_type value_type;
|
||||
typedef typename ht::hasher hasher;
|
||||
typedef typename ht::key_equal key_equal;
|
||||
|
||||
typedef typename ht::size_type size_type;
|
||||
typedef typename ht::difference_type difference_type;
|
||||
typedef typename ht::pointer pointer;
|
||||
typedef typename ht::const_pointer const_pointer;
|
||||
typedef typename ht::reference reference;
|
||||
typedef typename ht::const_reference const_reference;
|
||||
|
||||
typedef typename ht::iterator iterator;
|
||||
typedef typename ht::const_iterator const_iterator;
|
||||
|
||||
hasher hash_funct() const { return rep.hash_funct(); }
|
||||
key_equal key_eq() const { return rep.key_eq(); }
|
||||
|
||||
public:
|
||||
hash_multimap() : rep(100, hasher(), key_equal()) {}
|
||||
explicit hash_multimap(size_type n) : rep(n, hasher(), key_equal()) {}
|
||||
hash_multimap(size_type n, const hasher& hf) : rep(n, hf, key_equal()) {}
|
||||
hash_multimap(size_type n, const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) {}
|
||||
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class InputIterator>
|
||||
hash_multimap(InputIterator f, InputIterator l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_multimap(InputIterator f, InputIterator l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_multimap(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_equal(f, l); }
|
||||
template <class InputIterator>
|
||||
hash_multimap(InputIterator f, InputIterator l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_equal(f, l); }
|
||||
|
||||
#else
|
||||
hash_multimap(const value_type* f, const value_type* l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const value_type* f, const value_type* l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const value_type* f, const value_type* l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const value_type* f, const value_type* l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_equal(f, l); }
|
||||
|
||||
hash_multimap(const_iterator f, const_iterator l)
|
||||
: rep(100, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const_iterator f, const_iterator l, size_type n)
|
||||
: rep(n, hasher(), key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const_iterator f, const_iterator l, size_type n,
|
||||
const hasher& hf)
|
||||
: rep(n, hf, key_equal()) { rep.insert_equal(f, l); }
|
||||
hash_multimap(const_iterator f, const_iterator l, size_type n,
|
||||
const hasher& hf, const key_equal& eql)
|
||||
: rep(n, hf, eql) { rep.insert_equal(f, l); }
|
||||
#endif /*__STL_MEMBER_TEMPLATES */
|
||||
|
||||
public:
|
||||
size_type size() const { return rep.size(); }
|
||||
size_type max_size() const { return rep.max_size(); }
|
||||
bool empty() const { return rep.empty(); }
|
||||
void swap(hash_multimap& hs) { rep.swap(hs.rep); }
|
||||
friend bool
|
||||
operator== __STL_NULL_TMPL_ARGS (const hash_multimap&, const hash_multimap&);
|
||||
|
||||
iterator begin() { return rep.begin(); }
|
||||
iterator end() { return rep.end(); }
|
||||
const_iterator begin() const { return rep.begin(); }
|
||||
const_iterator end() const { return rep.end(); }
|
||||
|
||||
public:
|
||||
iterator insert(const value_type& obj) { return rep.insert_equal(obj); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class InputIterator>
|
||||
void insert(InputIterator f, InputIterator l) { rep.insert_equal(f,l); }
|
||||
#else
|
||||
void insert(const value_type* f, const value_type* l) {
|
||||
rep.insert_equal(f,l);
|
||||
}
|
||||
void insert(const_iterator f, const_iterator l) { rep.insert_equal(f, l); }
|
||||
#endif /*__STL_MEMBER_TEMPLATES */
|
||||
iterator insert_noresize(const value_type& obj)
|
||||
{ return rep.insert_equal_noresize(obj); }
|
||||
|
||||
iterator find(const key_type& key) { return rep.find(key); }
|
||||
const_iterator find(const key_type& key) const { return rep.find(key); }
|
||||
|
||||
size_type count(const key_type& key) const { return rep.count(key); }
|
||||
|
||||
pair<iterator, iterator> equal_range(const key_type& key)
|
||||
{ return rep.equal_range(key); }
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& key) const
|
||||
{ return rep.equal_range(key); }
|
||||
|
||||
size_type erase(const key_type& key) {return rep.erase(key); }
|
||||
void erase(iterator it) { rep.erase(it); }
|
||||
void erase(iterator f, iterator l) { rep.erase(f, l); }
|
||||
void clear() { rep.clear(); }
|
||||
|
||||
public:
|
||||
void resize(size_type hint) { rep.resize(hint); }
|
||||
size_type bucket_count() const { return rep.bucket_count(); }
|
||||
size_type max_bucket_count() const { return rep.max_bucket_count(); }
|
||||
size_type elems_in_bucket(size_type n) const
|
||||
{ return rep.elems_in_bucket(n); }
|
||||
};
|
||||
|
||||
template <class Key, class T, class HF, class EqKey, class Alloc>
|
||||
inline bool operator==(const hash_multimap<Key, T, HF, EqKey, Alloc>& hm1,
|
||||
const hash_multimap<Key, T, HF, EqKey, Alloc>& hm2)
|
||||
{
|
||||
return hm1.rep == hm2.rep;
|
||||
}
|
||||
|
||||
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
|
||||
|
||||
template <class Key, class T, class HashFcn, class EqualKey, class Alloc>
|
||||
inline void swap(hash_multimap<Key, T, HashFcn, EqualKey, Alloc>& hm1,
|
||||
hash_multimap<Key, T, HashFcn, EqualKey, Alloc>& hm2)
|
||||
{
|
||||
hm1.swap(hm2);
|
||||
}
|
||||
|
||||
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
|
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
||||
#pragma reset woff 1174
|
||||
#endif
|
||||
|
||||
__STL_END_NAMESPACE
|
||||
|
||||
#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
948
common/include/stl_hashtable.h
Normal file
948
common/include/stl_hashtable.h
Normal file
@@ -0,0 +1,948 @@
|
||||
/*
|
||||
* Copyright (c) 1996,1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This is an internal header file, included by other STL headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
#define __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
|
||||
// Hashtable class, used to implement the hashed associative containers
|
||||
// hash_set, hash_map, hash_multiset, and hash_multimap.
|
||||
|
||||
#include <stl_algobase.h>
|
||||
#include <stl_alloc.h>
|
||||
#include <stl_construct.h>
|
||||
#include <stl_tempbuf.h>
|
||||
#include <stl_algo.h>
|
||||
#include <stl_uninitialized.h>
|
||||
#include <stl_function.h>
|
||||
#include <stl_vector.h>
|
||||
#include <stl_hash_fun.h>
|
||||
|
||||
__STL_BEGIN_NAMESPACE
|
||||
|
||||
template <class Value>
|
||||
struct __hashtable_node
|
||||
{
|
||||
__hashtable_node* next;
|
||||
Value val;
|
||||
};
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey, class Alloc = alloc>
|
||||
class hashtable;
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey, class Alloc>
|
||||
struct __hashtable_iterator;
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey, class Alloc>
|
||||
struct __hashtable_const_iterator;
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey, class Alloc>
|
||||
struct __hashtable_iterator {
|
||||
typedef hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>
|
||||
hashtable;
|
||||
typedef __hashtable_iterator<Value, Key, HashFcn,
|
||||
ExtractKey, EqualKey, Alloc>
|
||||
iterator;
|
||||
typedef __hashtable_const_iterator<Value, Key, HashFcn,
|
||||
ExtractKey, EqualKey, Alloc>
|
||||
const_iterator;
|
||||
typedef __hashtable_node<Value> node;
|
||||
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef Value value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef Value& reference;
|
||||
typedef Value* pointer;
|
||||
|
||||
node* cur;
|
||||
hashtable* ht;
|
||||
|
||||
__hashtable_iterator(node* n, hashtable* tab) : cur(n), ht(tab) {}
|
||||
__hashtable_iterator() {}
|
||||
reference operator*() const { return cur->val; }
|
||||
#ifndef __SGI_STL_NO_ARROW_OPERATOR
|
||||
pointer operator->() const { return &(operator*()); }
|
||||
#endif /* __SGI_STL_NO_ARROW_OPERATOR */
|
||||
iterator& operator++();
|
||||
iterator operator++(int);
|
||||
bool operator==(const iterator& it) const { return cur == it.cur; }
|
||||
bool operator!=(const iterator& it) const { return cur != it.cur; }
|
||||
};
|
||||
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey, class Alloc>
|
||||
struct __hashtable_const_iterator {
|
||||
typedef hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>
|
||||
hashtable;
|
||||
typedef __hashtable_iterator<Value, Key, HashFcn,
|
||||
ExtractKey, EqualKey, Alloc>
|
||||
iterator;
|
||||
typedef __hashtable_const_iterator<Value, Key, HashFcn,
|
||||
ExtractKey, EqualKey, Alloc>
|
||||
const_iterator;
|
||||
typedef __hashtable_node<Value> node;
|
||||
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef Value value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef const Value& reference;
|
||||
typedef const Value* pointer;
|
||||
|
||||
const node* cur;
|
||||
const hashtable* ht;
|
||||
|
||||
__hashtable_const_iterator(const node* n, const hashtable* tab)
|
||||
: cur(n), ht(tab) {}
|
||||
__hashtable_const_iterator() {}
|
||||
__hashtable_const_iterator(const iterator& it) : cur(it.cur), ht(it.ht) {}
|
||||
reference operator*() const { return cur->val; }
|
||||
#ifndef __SGI_STL_NO_ARROW_OPERATOR
|
||||
pointer operator->() const { return &(operator*()); }
|
||||
#endif /* __SGI_STL_NO_ARROW_OPERATOR */
|
||||
const_iterator& operator++();
|
||||
const_iterator operator++(int);
|
||||
bool operator==(const const_iterator& it) const { return cur == it.cur; }
|
||||
bool operator!=(const const_iterator& it) const { return cur != it.cur; }
|
||||
};
|
||||
|
||||
// Note: assumes long is at least 32 bits.
|
||||
static const int __stl_num_primes = 28;
|
||||
static const unsigned long __stl_prime_list[__stl_num_primes] =
|
||||
{
|
||||
53, 97, 193, 389, 769,
|
||||
1543, 3079, 6151, 12289, 24593,
|
||||
49157, 98317, 196613, 393241, 786433,
|
||||
1572869, 3145739, 6291469, 12582917, 25165843,
|
||||
50331653, 100663319, 201326611, 402653189, 805306457,
|
||||
1610612741ul, 3221225473ul, 4294967291ul
|
||||
};
|
||||
|
||||
inline unsigned long __stl_next_prime(unsigned long n)
|
||||
{
|
||||
const unsigned long* first = __stl_prime_list;
|
||||
const unsigned long* last = __stl_prime_list + __stl_num_primes;
|
||||
const unsigned long* pos = lower_bound(first, last, n);
|
||||
return pos == last ? *(last - 1) : *pos;
|
||||
}
|
||||
|
||||
|
||||
template <class Value, class Key, class HashFcn,
|
||||
class ExtractKey, class EqualKey,
|
||||
class Alloc>
|
||||
class hashtable {
|
||||
public:
|
||||
typedef Key key_type;
|
||||
typedef Value value_type;
|
||||
typedef HashFcn hasher;
|
||||
typedef EqualKey key_equal;
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
hasher hash_funct() const { return hash; }
|
||||
key_equal key_eq() const { return equals; }
|
||||
|
||||
private:
|
||||
hasher hash;
|
||||
key_equal equals;
|
||||
ExtractKey get_key;
|
||||
|
||||
typedef __hashtable_node<Value> node;
|
||||
typedef simple_alloc<node, Alloc> node_allocator;
|
||||
|
||||
vector<node*,Alloc> buckets;
|
||||
size_type num_elements;
|
||||
|
||||
public:
|
||||
typedef __hashtable_iterator<Value, Key, HashFcn, ExtractKey, EqualKey,
|
||||
Alloc>
|
||||
iterator;
|
||||
|
||||
typedef __hashtable_const_iterator<Value, Key, HashFcn, ExtractKey, EqualKey,
|
||||
Alloc>
|
||||
const_iterator;
|
||||
|
||||
friend struct
|
||||
__hashtable_iterator<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>;
|
||||
friend struct
|
||||
__hashtable_const_iterator<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>;
|
||||
|
||||
public:
|
||||
hashtable(size_type n,
|
||||
const HashFcn& hf,
|
||||
const EqualKey& eql,
|
||||
const ExtractKey& ext)
|
||||
: hash(hf), equals(eql), get_key(ext), num_elements(0)
|
||||
{
|
||||
initialize_buckets(n);
|
||||
}
|
||||
|
||||
hashtable(size_type n,
|
||||
const HashFcn& hf,
|
||||
const EqualKey& eql)
|
||||
: hash(hf), equals(eql), get_key(ExtractKey()), num_elements(0)
|
||||
{
|
||||
initialize_buckets(n);
|
||||
}
|
||||
|
||||
hashtable(const hashtable& ht)
|
||||
: hash(ht.hash), equals(ht.equals), get_key(ht.get_key), num_elements(0)
|
||||
{
|
||||
copy_from(ht);
|
||||
}
|
||||
|
||||
hashtable& operator= (const hashtable& ht)
|
||||
{
|
||||
if (&ht != this) {
|
||||
clear();
|
||||
hash = ht.hash;
|
||||
equals = ht.equals;
|
||||
get_key = ht.get_key;
|
||||
copy_from(ht);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
~hashtable() { clear(); }
|
||||
|
||||
size_type size() const { return num_elements; }
|
||||
size_type max_size() const { return size_type(-1); }
|
||||
bool empty() const { return size() == 0; }
|
||||
|
||||
void swap(hashtable& ht)
|
||||
{
|
||||
__STD::swap(hash, ht.hash);
|
||||
__STD::swap(equals, ht.equals);
|
||||
__STD::swap(get_key, ht.get_key);
|
||||
buckets.swap(ht.buckets);
|
||||
__STD::swap(num_elements, ht.num_elements);
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
for (size_type n = 0; n < buckets.size(); ++n)
|
||||
if (buckets[n])
|
||||
return iterator(buckets[n], this);
|
||||
return end();
|
||||
}
|
||||
|
||||
iterator end() { return iterator(0, this); }
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
for (size_type n = 0; n < buckets.size(); ++n)
|
||||
if (buckets[n])
|
||||
return const_iterator(buckets[n], this);
|
||||
return end();
|
||||
}
|
||||
|
||||
const_iterator end() const { return const_iterator(0, this); }
|
||||
|
||||
friend bool
|
||||
operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&);
|
||||
|
||||
public:
|
||||
|
||||
size_type bucket_count() const { return buckets.size(); }
|
||||
|
||||
size_type max_bucket_count() const
|
||||
{ return __stl_prime_list[__stl_num_primes - 1]; }
|
||||
|
||||
size_type elems_in_bucket(size_type bucket) const
|
||||
{
|
||||
size_type result = 0;
|
||||
for (node* cur = buckets[bucket]; cur; cur = cur->next)
|
||||
result += 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
pair<iterator, bool> insert_unique(const value_type& obj)
|
||||
{
|
||||
resize(num_elements + 1);
|
||||
return insert_unique_noresize(obj);
|
||||
}
|
||||
|
||||
iterator insert_equal(const value_type& obj)
|
||||
{
|
||||
resize(num_elements + 1);
|
||||
return insert_equal_noresize(obj);
|
||||
}
|
||||
|
||||
pair<iterator, bool> insert_unique_noresize(const value_type& obj);
|
||||
iterator insert_equal_noresize(const value_type& obj);
|
||||
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class InputIterator>
|
||||
void insert_unique(InputIterator f, InputIterator l)
|
||||
{
|
||||
insert_unique(f, l, iterator_category(f));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void insert_equal(InputIterator f, InputIterator l)
|
||||
{
|
||||
insert_equal(f, l, iterator_category(f));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void insert_unique(InputIterator f, InputIterator l,
|
||||
input_iterator_tag)
|
||||
{
|
||||
for ( ; f != l; ++f)
|
||||
insert_unique(*f);
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void insert_equal(InputIterator f, InputIterator l,
|
||||
input_iterator_tag)
|
||||
{
|
||||
for ( ; f != l; ++f)
|
||||
insert_equal(*f);
|
||||
}
|
||||
|
||||
template <class ForwardIterator>
|
||||
void insert_unique(ForwardIterator f, ForwardIterator l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type n = 0;
|
||||
distance(f, l, n);
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_unique_noresize(*f);
|
||||
}
|
||||
|
||||
template <class ForwardIterator>
|
||||
void insert_equal(ForwardIterator f, ForwardIterator l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type n = 0;
|
||||
distance(f, l, n);
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_equal_noresize(*f);
|
||||
}
|
||||
|
||||
#else /* __STL_MEMBER_TEMPLATES */
|
||||
void insert_unique(const value_type* f, const value_type* l)
|
||||
{
|
||||
size_type n = l - f;
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_unique_noresize(*f);
|
||||
}
|
||||
|
||||
void insert_equal(const value_type* f, const value_type* l)
|
||||
{
|
||||
size_type n = l - f;
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_equal_noresize(*f);
|
||||
}
|
||||
|
||||
void insert_unique(const_iterator f, const_iterator l)
|
||||
{
|
||||
size_type n = 0;
|
||||
distance(f, l, n);
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_unique_noresize(*f);
|
||||
}
|
||||
|
||||
void insert_equal(const_iterator f, const_iterator l)
|
||||
{
|
||||
size_type n = 0;
|
||||
distance(f, l, n);
|
||||
resize(num_elements + n);
|
||||
for ( ; n > 0; --n, ++f)
|
||||
insert_equal_noresize(*f);
|
||||
}
|
||||
#endif /*__STL_MEMBER_TEMPLATES */
|
||||
|
||||
reference find_or_insert(const value_type& obj);
|
||||
|
||||
iterator find(const key_type& key)
|
||||
{
|
||||
size_type n = bkt_num_key(key);
|
||||
node* first;
|
||||
for ( first = buckets[n];
|
||||
first && !equals(get_key(first->val), key);
|
||||
first = first->next)
|
||||
{}
|
||||
return iterator(first, this);
|
||||
}
|
||||
|
||||
const_iterator find(const key_type& key) const
|
||||
{
|
||||
size_type n = bkt_num_key(key);
|
||||
const node* first;
|
||||
for ( first = buckets[n];
|
||||
first && !equals(get_key(first->val), key);
|
||||
first = first->next)
|
||||
{}
|
||||
return const_iterator(first, this);
|
||||
}
|
||||
|
||||
size_type count(const key_type& key) const
|
||||
{
|
||||
const size_type n = bkt_num_key(key);
|
||||
size_type result = 0;
|
||||
|
||||
for (const node* cur = buckets[n]; cur; cur = cur->next)
|
||||
if (equals(get_key(cur->val), key))
|
||||
++result;
|
||||
return result;
|
||||
}
|
||||
|
||||
pair<iterator, iterator> equal_range(const key_type& key);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& key) const;
|
||||
|
||||
size_type erase(const key_type& key);
|
||||
void erase(const iterator& it);
|
||||
void erase(iterator first, iterator last);
|
||||
|
||||
void erase(const const_iterator& it);
|
||||
void erase(const_iterator first, const_iterator last);
|
||||
|
||||
void resize(size_type num_elements_hint);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
size_type next_size(size_type n) const { return __stl_next_prime(n); }
|
||||
|
||||
void initialize_buckets(size_type n)
|
||||
{
|
||||
const size_type n_buckets = next_size(n);
|
||||
buckets.reserve(n_buckets);
|
||||
buckets.insert(buckets.end(), n_buckets, (node*) 0);
|
||||
num_elements = 0;
|
||||
}
|
||||
|
||||
size_type bkt_num_key(const key_type& key) const
|
||||
{
|
||||
return bkt_num_key(key, buckets.size());
|
||||
}
|
||||
|
||||
size_type bkt_num(const value_type& obj) const
|
||||
{
|
||||
return bkt_num_key(get_key(obj));
|
||||
}
|
||||
|
||||
size_type bkt_num_key(const key_type& key, size_t n) const
|
||||
{
|
||||
return hash(key) % n;
|
||||
}
|
||||
|
||||
size_type bkt_num(const value_type& obj, size_t n) const
|
||||
{
|
||||
return bkt_num_key(get_key(obj), n);
|
||||
}
|
||||
|
||||
node* new_node(const value_type& obj)
|
||||
{
|
||||
node* n = node_allocator::allocate();
|
||||
n->next = 0;
|
||||
__STL_TRY {
|
||||
construct(&n->val, obj);
|
||||
return n;
|
||||
}
|
||||
__STL_UNWIND(node_allocator::deallocate(n));
|
||||
}
|
||||
|
||||
void delete_node(node* n)
|
||||
{
|
||||
destroy(&n->val);
|
||||
node_allocator::deallocate(n);
|
||||
}
|
||||
|
||||
void erase_bucket(const size_type n, node* first, node* last);
|
||||
void erase_bucket(const size_type n, node* last);
|
||||
|
||||
void copy_from(const hashtable& ht);
|
||||
|
||||
};
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class A>
|
||||
__hashtable_iterator<V, K, HF, ExK, EqK, A>&
|
||||
__hashtable_iterator<V, K, HF, ExK, EqK, A>::operator++()
|
||||
{
|
||||
const node* old = cur;
|
||||
cur = cur->next;
|
||||
if (!cur) {
|
||||
size_type bucket = ht->bkt_num(old->val);
|
||||
while (!cur && ++bucket < ht->buckets.size())
|
||||
cur = ht->buckets[bucket];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class A>
|
||||
inline __hashtable_iterator<V, K, HF, ExK, EqK, A>
|
||||
__hashtable_iterator<V, K, HF, ExK, EqK, A>::operator++(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class A>
|
||||
__hashtable_const_iterator<V, K, HF, ExK, EqK, A>&
|
||||
__hashtable_const_iterator<V, K, HF, ExK, EqK, A>::operator++()
|
||||
{
|
||||
const node* old = cur;
|
||||
cur = cur->next;
|
||||
if (!cur) {
|
||||
size_type bucket = ht->bkt_num(old->val);
|
||||
while (!cur && ++bucket < ht->buckets.size())
|
||||
cur = ht->buckets[bucket];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class A>
|
||||
inline __hashtable_const_iterator<V, K, HF, ExK, EqK, A>
|
||||
__hashtable_const_iterator<V, K, HF, ExK, EqK, A>::operator++(int)
|
||||
{
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline forward_iterator_tag
|
||||
iterator_category(const __hashtable_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return forward_iterator_tag();
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline V* value_type(const __hashtable_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return (V*) 0;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline hashtable<V, K, HF, ExK, EqK, All>::difference_type*
|
||||
distance_type(const __hashtable_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return (hashtable<V, K, HF, ExK, EqK, All>::difference_type*) 0;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline forward_iterator_tag
|
||||
iterator_category(const __hashtable_const_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return forward_iterator_tag();
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline V*
|
||||
value_type(const __hashtable_const_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return (V*) 0;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class ExK, class EqK, class All>
|
||||
inline hashtable<V, K, HF, ExK, EqK, All>::difference_type*
|
||||
distance_type(const __hashtable_const_iterator<V, K, HF, ExK, EqK, All>&)
|
||||
{
|
||||
return (hashtable<V, K, HF, ExK, EqK, All>::difference_type*) 0;
|
||||
}
|
||||
|
||||
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
bool operator==(const hashtable<V, K, HF, Ex, Eq, A>& ht1,
|
||||
const hashtable<V, K, HF, Ex, Eq, A>& ht2)
|
||||
{
|
||||
typedef typename hashtable<V, K, HF, Ex, Eq, A>::node node;
|
||||
if (ht1.buckets.size() != ht2.buckets.size())
|
||||
return false;
|
||||
for (int n = 0; n < ht1.buckets.size(); ++n) {
|
||||
node* cur1 = ht1.buckets[n];
|
||||
node* cur2 = ht2.buckets[n];
|
||||
for ( ; cur1 && cur2 && cur1->val == cur2->val;
|
||||
cur1 = cur1->next, cur2 = cur2->next)
|
||||
{}
|
||||
if (cur1 || cur2)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
|
||||
|
||||
template <class Val, class Key, class HF, class Extract, class EqKey, class A>
|
||||
inline void swap(hashtable<Val, Key, HF, Extract, EqKey, A>& ht1,
|
||||
hashtable<Val, Key, HF, Extract, EqKey, A>& ht2) {
|
||||
ht1.swap(ht2);
|
||||
}
|
||||
|
||||
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
|
||||
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
pair<typename hashtable<V, K, HF, Ex, Eq, A>::iterator, bool>
|
||||
hashtable<V, K, HF, Ex, Eq, A>::insert_unique_noresize(const value_type& obj)
|
||||
{
|
||||
const size_type n = bkt_num(obj);
|
||||
node* first = buckets[n];
|
||||
|
||||
for (node* cur = first; cur; cur = cur->next)
|
||||
if (equals(get_key(cur->val), get_key(obj)))
|
||||
return pair<iterator, bool>(iterator(cur, this), false);
|
||||
|
||||
node* tmp = new_node(obj);
|
||||
tmp->next = first;
|
||||
buckets[n] = tmp;
|
||||
++num_elements;
|
||||
return pair<iterator, bool>(iterator(tmp, this), true);
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
typename hashtable<V, K, HF, Ex, Eq, A>::iterator
|
||||
hashtable<V, K, HF, Ex, Eq, A>::insert_equal_noresize(const value_type& obj)
|
||||
{
|
||||
const size_type n = bkt_num(obj);
|
||||
node* first = buckets[n];
|
||||
|
||||
for (node* cur = first; cur; cur = cur->next)
|
||||
if (equals(get_key(cur->val), get_key(obj))) {
|
||||
node* tmp = new_node(obj);
|
||||
tmp->next = cur->next;
|
||||
cur->next = tmp;
|
||||
++num_elements;
|
||||
return iterator(tmp, this);
|
||||
}
|
||||
|
||||
node* tmp = new_node(obj);
|
||||
tmp->next = first;
|
||||
buckets[n] = tmp;
|
||||
++num_elements;
|
||||
return iterator(tmp, this);
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
typename hashtable<V, K, HF, Ex, Eq, A>::reference
|
||||
hashtable<V, K, HF, Ex, Eq, A>::find_or_insert(const value_type& obj)
|
||||
{
|
||||
resize(num_elements + 1);
|
||||
|
||||
size_type n = bkt_num(obj);
|
||||
node* first = buckets[n];
|
||||
|
||||
for (node* cur = first; cur; cur = cur->next)
|
||||
if (equals(get_key(cur->val), get_key(obj)))
|
||||
return cur->val;
|
||||
|
||||
node* tmp = new_node(obj);
|
||||
tmp->next = first;
|
||||
buckets[n] = tmp;
|
||||
++num_elements;
|
||||
return tmp->val;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
pair<typename hashtable<V, K, HF, Ex, Eq, A>::iterator,
|
||||
typename hashtable<V, K, HF, Ex, Eq, A>::iterator>
|
||||
hashtable<V, K, HF, Ex, Eq, A>::equal_range(const key_type& key)
|
||||
{
|
||||
typedef pair<iterator, iterator> pii;
|
||||
const size_type n = bkt_num_key(key);
|
||||
|
||||
for (node* first = buckets[n]; first; first = first->next) {
|
||||
if (equals(get_key(first->val), key)) {
|
||||
for (node* cur = first->next; cur; cur = cur->next)
|
||||
if (!equals(get_key(cur->val), key))
|
||||
return pii(iterator(first, this), iterator(cur, this));
|
||||
for (size_type m = n + 1; m < buckets.size(); ++m)
|
||||
if (buckets[m])
|
||||
return pii(iterator(first, this),
|
||||
iterator(buckets[m], this));
|
||||
return pii(iterator(first, this), end());
|
||||
}
|
||||
}
|
||||
return pii(end(), end());
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
pair<typename hashtable<V, K, HF, Ex, Eq, A>::const_iterator,
|
||||
typename hashtable<V, K, HF, Ex, Eq, A>::const_iterator>
|
||||
hashtable<V, K, HF, Ex, Eq, A>::equal_range(const key_type& key) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> pii;
|
||||
const size_type n = bkt_num_key(key);
|
||||
|
||||
for (const node* first = buckets[n] ; first; first = first->next) {
|
||||
if (equals(get_key(first->val), key)) {
|
||||
for (const node* cur = first->next; cur; cur = cur->next)
|
||||
if (!equals(get_key(cur->val), key))
|
||||
return pii(const_iterator(first, this),
|
||||
const_iterator(cur, this));
|
||||
for (size_type m = n + 1; m < buckets.size(); ++m)
|
||||
if (buckets[m])
|
||||
return pii(const_iterator(first, this),
|
||||
const_iterator(buckets[m], this));
|
||||
return pii(const_iterator(first, this), end());
|
||||
}
|
||||
}
|
||||
return pii(end(), end());
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
typename hashtable<V, K, HF, Ex, Eq, A>::size_type
|
||||
hashtable<V, K, HF, Ex, Eq, A>::erase(const key_type& key)
|
||||
{
|
||||
const size_type n = bkt_num_key(key);
|
||||
node* first = buckets[n];
|
||||
size_type erased = 0;
|
||||
|
||||
if (first) {
|
||||
node* cur = first;
|
||||
node* next = cur->next;
|
||||
while (next) {
|
||||
if (equals(get_key(next->val), key)) {
|
||||
cur->next = next->next;
|
||||
delete_node(next);
|
||||
next = cur->next;
|
||||
++erased;
|
||||
--num_elements;
|
||||
}
|
||||
else {
|
||||
cur = next;
|
||||
next = cur->next;
|
||||
}
|
||||
}
|
||||
if (equals(get_key(first->val), key)) {
|
||||
buckets[n] = first->next;
|
||||
delete_node(first);
|
||||
++erased;
|
||||
--num_elements;
|
||||
}
|
||||
}
|
||||
return erased;
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::erase(const iterator& it)
|
||||
{
|
||||
if (node* const p = it.cur) {
|
||||
const size_type n = bkt_num(p->val);
|
||||
node* cur = buckets[n];
|
||||
|
||||
if (cur == p) {
|
||||
buckets[n] = cur->next;
|
||||
delete_node(cur);
|
||||
--num_elements;
|
||||
}
|
||||
else {
|
||||
node* next = cur->next;
|
||||
while (next) {
|
||||
if (next == p) {
|
||||
cur->next = next->next;
|
||||
delete_node(next);
|
||||
--num_elements;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
cur = next;
|
||||
next = cur->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::erase(iterator first, iterator last)
|
||||
{
|
||||
size_type f_bucket = first.cur ? bkt_num(first.cur->val) : buckets.size();
|
||||
size_type l_bucket = last.cur ? bkt_num(last.cur->val) : buckets.size();
|
||||
|
||||
if (first.cur == last.cur)
|
||||
return;
|
||||
else if (f_bucket == l_bucket)
|
||||
erase_bucket(f_bucket, first.cur, last.cur);
|
||||
else {
|
||||
erase_bucket(f_bucket, first.cur, 0);
|
||||
for (size_type n = f_bucket + 1; n < l_bucket; ++n)
|
||||
erase_bucket(n, 0);
|
||||
if (l_bucket != buckets.size())
|
||||
erase_bucket(l_bucket, last.cur);
|
||||
}
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
inline void
|
||||
hashtable<V, K, HF, Ex, Eq, A>::erase(const_iterator first,
|
||||
const_iterator last)
|
||||
{
|
||||
erase(iterator(const_cast<node*>(first.cur),
|
||||
const_cast<hashtable*>(first.ht)),
|
||||
iterator(const_cast<node*>(last.cur),
|
||||
const_cast<hashtable*>(last.ht)));
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
inline void
|
||||
hashtable<V, K, HF, Ex, Eq, A>::erase(const const_iterator& it)
|
||||
{
|
||||
erase(iterator(const_cast<node*>(it.cur),
|
||||
const_cast<hashtable*>(it.ht)));
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::resize(size_type num_elements_hint)
|
||||
{
|
||||
const size_type old_n = buckets.size();
|
||||
if (num_elements_hint > old_n) {
|
||||
const size_type n = next_size(num_elements_hint);
|
||||
if (n > old_n) {
|
||||
vector<node*, A> tmp(n, (node*) 0);
|
||||
__STL_TRY {
|
||||
for (size_type bucket = 0; bucket < old_n; ++bucket) {
|
||||
node* first = buckets[bucket];
|
||||
while (first) {
|
||||
size_type new_bucket = bkt_num(first->val, n);
|
||||
buckets[bucket] = first->next;
|
||||
first->next = tmp[new_bucket];
|
||||
tmp[new_bucket] = first;
|
||||
first = buckets[bucket];
|
||||
}
|
||||
}
|
||||
buckets.swap(tmp);
|
||||
}
|
||||
# ifdef __STL_USE_EXCEPTIONS
|
||||
catch(...) {
|
||||
for (size_type bucket = 0; bucket < tmp.size(); ++bucket) {
|
||||
while (tmp[bucket]) {
|
||||
node* next = tmp[bucket]->next;
|
||||
delete_node(tmp[bucket]);
|
||||
tmp[bucket] = next;
|
||||
}
|
||||
}
|
||||
throw;
|
||||
}
|
||||
# endif /* __STL_USE_EXCEPTIONS */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n,
|
||||
node* first, node* last)
|
||||
{
|
||||
node* cur = buckets[n];
|
||||
if (cur == first)
|
||||
erase_bucket(n, last);
|
||||
else {
|
||||
node* next;
|
||||
for (next = cur->next; next != first; cur = next, next = cur->next)
|
||||
;
|
||||
while (next) {
|
||||
cur->next = next->next;
|
||||
delete_node(next);
|
||||
next = cur->next;
|
||||
--num_elements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void
|
||||
hashtable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* last)
|
||||
{
|
||||
node* cur = buckets[n];
|
||||
while (cur != last) {
|
||||
node* next = cur->next;
|
||||
delete_node(cur);
|
||||
cur = next;
|
||||
buckets[n] = cur;
|
||||
--num_elements;
|
||||
}
|
||||
}
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::clear()
|
||||
{
|
||||
for (size_type i = 0; i < buckets.size(); ++i) {
|
||||
node* cur = buckets[i];
|
||||
while (cur != 0) {
|
||||
node* next = cur->next;
|
||||
delete_node(cur);
|
||||
cur = next;
|
||||
}
|
||||
buckets[i] = 0;
|
||||
}
|
||||
num_elements = 0;
|
||||
}
|
||||
|
||||
|
||||
template <class V, class K, class HF, class Ex, class Eq, class A>
|
||||
void hashtable<V, K, HF, Ex, Eq, A>::copy_from(const hashtable& ht)
|
||||
{
|
||||
buckets.clear();
|
||||
buckets.reserve(ht.buckets.size());
|
||||
buckets.insert(buckets.end(), ht.buckets.size(), (node*) 0);
|
||||
__STL_TRY {
|
||||
for (size_type i = 0; i < ht.buckets.size(); ++i) {
|
||||
if (const node* cur = ht.buckets[i]) {
|
||||
node* copy = new_node(cur->val);
|
||||
buckets[i] = copy;
|
||||
|
||||
for (node* next = cur->next; next; cur = next, next = cur->next) {
|
||||
copy->next = new_node(next->val);
|
||||
copy = copy->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
num_elements = ht.num_elements;
|
||||
}
|
||||
__STL_UNWIND(clear());
|
||||
}
|
||||
|
||||
__STL_END_NAMESPACE
|
||||
|
||||
#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
73
common/include/stream.H
Normal file
73
common/include/stream.H
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _STREAM_H
|
||||
#define _STREAM_H
|
||||
|
||||
#define STREAMSIZE 4*1024
|
||||
#define READBUFSIZE 1024
|
||||
|
||||
|
||||
#include "exception.H"
|
||||
#include "crypto.H"
|
||||
|
||||
class CEmptyStreamException : public CException {
|
||||
public:
|
||||
CEmptyStreamException();
|
||||
};
|
||||
|
||||
class CEOFException : public CException {
|
||||
public:
|
||||
CEOFException();
|
||||
};
|
||||
|
||||
class CIOException : public CException {
|
||||
public:
|
||||
CIOException();
|
||||
};
|
||||
|
||||
|
||||
#ifdef CRYPTO
|
||||
class CStream : CCrypto {
|
||||
#else
|
||||
class CStream {
|
||||
#endif
|
||||
int fd;
|
||||
|
||||
int m_rbuf_size;
|
||||
char *m_rbuf;
|
||||
|
||||
char buf[STREAMSIZE];
|
||||
int start,stop,size;
|
||||
|
||||
int writeInBuf(char * msg, int length);
|
||||
int getInStreamSize(){return size;}
|
||||
int fillBuf();
|
||||
|
||||
public:
|
||||
CStream(int fd);
|
||||
~CStream();
|
||||
|
||||
BYTE peepByte();
|
||||
int readBuf(BYTE * msg, int length);
|
||||
int writeBuf(BYTE * buf,int length);
|
||||
|
||||
};
|
||||
|
||||
#endif // _STREAM_H
|
||||
85
common/include/texture.H
Normal file
85
common/include/texture.H
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _TEXTURE_H
|
||||
#define _TEXTURE_H
|
||||
|
||||
#include "mudtypes.h"
|
||||
#include "cache.H"
|
||||
|
||||
|
||||
#define TEX_STATE_LOADED 0x0001
|
||||
|
||||
class CTextureMap: public CObject {
|
||||
WORD m_width, m_height;
|
||||
BYTE *m_data;
|
||||
public:
|
||||
CTextureMap();
|
||||
CTextureMap(WORD width, WORD height, BYTE* data);
|
||||
~CTextureMap();
|
||||
|
||||
WORD getWidth();
|
||||
WORD getHeight();
|
||||
BYTE * getData();
|
||||
void setMap(WORD width, WORD height, BYTE* data);
|
||||
|
||||
void load(char * fileName);
|
||||
void save(char * fileName);
|
||||
void loadRGB(char * name);
|
||||
void loadTIFF(char * name);
|
||||
void saveTIFF(char * name);
|
||||
void loadTEX(char * name);
|
||||
void saveTEX(char * name);
|
||||
};
|
||||
|
||||
class CTexture : public CObject {
|
||||
int m_id;
|
||||
int m_state;
|
||||
CTextureMap *m_textureMap;
|
||||
|
||||
public:
|
||||
CTexture();
|
||||
CTexture(int id);
|
||||
~CTexture();
|
||||
int getId(){ return m_id; }
|
||||
int loaded();
|
||||
virtual void setTextureMap(CTextureMap * textureMap);
|
||||
CTextureMap * getTextureMap();
|
||||
virtual int exec();
|
||||
void load(char * fileName);
|
||||
void save(char * fileName);
|
||||
};
|
||||
|
||||
class CTextureCache : public CCache {
|
||||
public:
|
||||
CTextureCache();
|
||||
CTexture * add(CTexture * texture);
|
||||
CTexture * get(int id);
|
||||
};
|
||||
|
||||
|
||||
#endif /* _TEXTURE_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
37
common/include/time.H
Normal file
37
common/include/time.H
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _PVVMUD_TIME_H
|
||||
#define _PVVMUD_TIME_H
|
||||
|
||||
class CTime {
|
||||
long sec;
|
||||
long msec;
|
||||
|
||||
public:
|
||||
CTime();
|
||||
void getTime();
|
||||
void add(long msec);
|
||||
long diff(const CTime & time);
|
||||
|
||||
CTime& operator= (const CTime & time);
|
||||
};
|
||||
|
||||
#endif // _PVVMUD_TIME_H
|
||||
|
||||
119
common/include/timekeeper.H
Normal file
119
common/include/timekeeper.H
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _TIMEKEEPER_H
|
||||
#define _TIMEKEEPER_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// BUGS + KNOWN PROBLEMS
|
||||
//
|
||||
// When using TIMEKEEPER_OUT to notify a write queue, poll never suspend
|
||||
// when idle. Have to create some functions that can controll this flag
|
||||
// and remove TIMEKEEPER_OUT when not needed.
|
||||
//
|
||||
|
||||
#include <poll.h>
|
||||
#include <sys/time.h>
|
||||
#include "object.H"
|
||||
|
||||
// valid events:
|
||||
// #define TIMEKEEPER_PRI POLLPRI
|
||||
#define TIMEKEEPER_IN (POLLIN | POLLPRI)
|
||||
#define TIMEKEEPER_OUT POLLOUT
|
||||
#define TIMEKEEPER_ERR POLLERR
|
||||
#define TIMEKEEPER_HUP POLLHUP
|
||||
#define TIMEKEEPER_NVAL POLLNVAL
|
||||
|
||||
class CTimeKeeper;
|
||||
|
||||
class CTimeKeeperItem : public CObject {
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
public:
|
||||
void timeKeeperSetTimeKeeper(CTimeKeeper * timeKeeper){ m_timeKeeper = timeKeeper; }
|
||||
virtual int timeKeeperFD(int event);
|
||||
int timeKeeperSetEvents(int event);
|
||||
virtual int timeKeeperHB();
|
||||
};
|
||||
|
||||
struct heartbeat {
|
||||
CTimeKeeperItem * fn;
|
||||
int timeout; /* millisecounds */
|
||||
};
|
||||
|
||||
class CTimeKeeper {
|
||||
struct heartbeat *hbs;
|
||||
int num_hbs, size_hbs;
|
||||
|
||||
int mintimeout;
|
||||
int num;
|
||||
|
||||
struct pollfd *fds;
|
||||
CTimeKeeperItem ** timeKeeperFD;
|
||||
int num_fdns, size_fds;
|
||||
//, size_fns;
|
||||
|
||||
int running;
|
||||
struct timeval lasttime;
|
||||
|
||||
void setTime();
|
||||
int getTime();
|
||||
|
||||
public:
|
||||
|
||||
CTimeKeeper();
|
||||
~CTimeKeeper();
|
||||
|
||||
/* Listen for events on fd, and call with the pending events
|
||||
as parameter. Returns 1 successfull, 0 othervise. */
|
||||
int addFd(int fd, CTimeKeeperItem * fn, short events);
|
||||
|
||||
/* Do not listen for events on fd.
|
||||
Returns 1 successfull, 0 othervise. */
|
||||
int rmFd(int fd);
|
||||
|
||||
int setEvents(CTimeKeeperItem * fn,short events);
|
||||
|
||||
/* Add heartbeat function fn, to be run every timeout millisecounds.
|
||||
timeout is rounded down to nearest 2^n.
|
||||
Returns 1 successfull, 0 othervise. */
|
||||
int addHeartBeat(int timeout, CTimeKeeperItem * fn);
|
||||
|
||||
/* Removes heartbeat function fn.
|
||||
Returns 1 successfull, 0 othervise. */
|
||||
int rmHeartBeat(CTimeKeeperItem * fn);
|
||||
|
||||
/* Run the mainLoop. Listening for events on registered fds, and
|
||||
running heartbeatfunctions. */
|
||||
void mainLoop();
|
||||
|
||||
/* If running the mainLoop isn't possible. Poll for events on registered fds, and
|
||||
running heartbeatfunctions. */
|
||||
void poll(int timeOut);
|
||||
|
||||
/* Stop the Loop now. */
|
||||
void stopLoop();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _TIMEKEEPER_H
|
||||
|
||||
|
||||
|
||||
|
||||
59
common/include/vector.H
Normal file
59
common/include/vector.H
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _VECTOR_H
|
||||
#define _VECTOR_H
|
||||
|
||||
#include "object.H"
|
||||
#include <iostream.h>
|
||||
#include "matrix.H"
|
||||
|
||||
class CVertex;
|
||||
|
||||
class CVector : public CObject {
|
||||
double m_vector[4];
|
||||
public:
|
||||
CVector();
|
||||
CVector(const CVector & vector);
|
||||
CVector(double x,double y,double z);
|
||||
CVector(double x,double y,double z,double d);
|
||||
CVector(const CVertex & vertex);
|
||||
double getX() const;
|
||||
double getY() const;
|
||||
double getZ() const;
|
||||
|
||||
CVector cross( const CVector & vector );
|
||||
|
||||
CVector& operator+=( const CVector & vector );
|
||||
CVector operator+( const CVector & vector ) const;
|
||||
CVector operator*( double scale ) const;
|
||||
CVector operator-( const CVector & vector ) const;
|
||||
|
||||
void transform(const CMatrix & transformation);
|
||||
|
||||
friend CVector operator*(const CMatrix & m1, const CVector & v1);
|
||||
|
||||
};
|
||||
|
||||
CVector operator*(const CMatrix & m1, const CVector & m2);
|
||||
|
||||
ostream& operator<<(ostream&s,const CVector& v);
|
||||
|
||||
|
||||
#endif // _VECTOR_H
|
||||
40
common/include/vertex.H
Normal file
40
common/include/vertex.H
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _VERTEX_H
|
||||
#define _VERTEX_H
|
||||
|
||||
#include "object.H"
|
||||
#include "vector.H"
|
||||
|
||||
typedef double VertexCoord_t;
|
||||
|
||||
class CVertex : public CObject{
|
||||
VertexCoord_t m_coord[3];
|
||||
public:
|
||||
CVertex(double x, double y, double z);
|
||||
VertexCoord_t * getCoord();
|
||||
double getX() const;
|
||||
double getY() const;
|
||||
double getZ() const;
|
||||
void setCoord(double x, double y, double z);
|
||||
CVector operator-(const CVertex & vertex) const;
|
||||
};
|
||||
|
||||
#endif // _VERTEX_H
|
||||
42
common/include/viewpoint.H
Normal file
42
common/include/viewpoint.H
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _VIEWPOINT_H
|
||||
#define _VIEWPOINT_H
|
||||
|
||||
#include "position.H"
|
||||
#include "direction.H"
|
||||
|
||||
class CViewpoint {
|
||||
CPosition position;
|
||||
CDirection direction;
|
||||
DWORD m_targetId;
|
||||
public:
|
||||
CViewpoint();
|
||||
|
||||
void setPosition( const CPosition & position );
|
||||
CPosition & getPosition();
|
||||
void setDirection( const CDirection & direction );
|
||||
CDirection & getDirection();
|
||||
void setTargetId(DWORD targetId);
|
||||
DWORD getTargetId();
|
||||
|
||||
};
|
||||
|
||||
#endif /* _VIEWPOINT_H */
|
||||
41
common/include/wacreateobject.H
Normal file
41
common/include/wacreateobject.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WACREATEOBJECT_H
|
||||
#define _WACREATEOBJECT_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWACreateObject : public CWAObject {
|
||||
CWorldObject * m_object;
|
||||
DWORD m_geometryId;
|
||||
DWORD m_parentId;
|
||||
CPosition m_position;
|
||||
CDirection m_direction;
|
||||
char * m_objectType;
|
||||
public:
|
||||
CWACreateObject( CWorldObject * object );
|
||||
CWACreateObject( char * objectType, DWORD objectId , DWORD geometryId, DWORD parentId, const CPosition & position, const CDirection & direction);
|
||||
virtual ~CWACreateObject();
|
||||
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WACREATEOBJECT_H
|
||||
37
common/include/waobject.H
Normal file
37
common/include/waobject.H
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAOBJECT_H
|
||||
#define _WAOBJECT_H
|
||||
|
||||
#include "worldanimation.H"
|
||||
#include "worldobject.H"
|
||||
|
||||
|
||||
class CWAObject : public CWorldAnimation {
|
||||
// DWORD m_objectId;
|
||||
public:
|
||||
CWAObject( DWORD objectId );
|
||||
|
||||
// DWORD getObjectId();
|
||||
// CWorldObject * getObject();
|
||||
|
||||
};
|
||||
|
||||
#endif // _WAOBJECT_H
|
||||
34
common/include/waremoveobject.H
Normal file
34
common/include/waremoveobject.H
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAREMOVEOBJECT_H
|
||||
#define _WAREMOVEOBJECT_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWARemoveObject : public CWAObject {
|
||||
DWORD m_parentId;
|
||||
public:
|
||||
CWARemoveObject( DWORD objectId , DWORD parentId );
|
||||
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAREMOVEOBJECT_H
|
||||
33
common/include/warotate.H
Normal file
33
common/include/warotate.H
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAROTATE_H
|
||||
#define _WAROTATE_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWARotate : public CWAObject {
|
||||
CDirection m_angleSpeed;
|
||||
public:
|
||||
CWARotate( DWORD objectId, const CDirection & angleSpeed );
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time, DWORD deltaTime );
|
||||
};
|
||||
|
||||
#endif // _WAROTATE_H
|
||||
33
common/include/waupdatedirection.H
Normal file
33
common/include/waupdatedirection.H
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAUPDATEDIRECTION_H
|
||||
#define _WAUPDATEDIRECTION_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWAUpdateDirection : public CWAObject {
|
||||
CDirection m_direction;
|
||||
public:
|
||||
CWAUpdateDirection( DWORD objectId, const CDirection & direction );
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAUPDATEDIRECTION_H
|
||||
34
common/include/waupdatehierarchy.H
Normal file
34
common/include/waupdatehierarchy.H
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAUPDATEHIERARCHY_H
|
||||
#define _WAUPDATEHIERARCHY_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWAUpdateHierarchy : public CWAObject {
|
||||
DWORD m_parentId;
|
||||
public:
|
||||
CWAUpdateHierarchy( DWORD objectId , DWORD parentId );
|
||||
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAUPDATEHIERARCHY_H
|
||||
33
common/include/waupdateposition.H
Normal file
33
common/include/waupdateposition.H
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WAUPDATEPOSITION_H
|
||||
#define _WAUPDATEPOSITION_H
|
||||
|
||||
#include "waobject.H"
|
||||
|
||||
class CWAUpdatePosition : public CWAObject {
|
||||
CPosition m_position;
|
||||
public:
|
||||
CWAUpdatePosition( DWORD objectId, const CPosition & position );
|
||||
virtual CMessage * createMessage();
|
||||
virtual int animate( DWORD time );
|
||||
};
|
||||
|
||||
#endif // _WAUPDATEPOSITION_H
|
||||
65
common/include/worldanimation.H
Normal file
65
common/include/worldanimation.H
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDANIMATION_H
|
||||
#define _WORLDANIMATION_H
|
||||
|
||||
#include "objectlist.H"
|
||||
#include "message.H"
|
||||
|
||||
class CWorldAnimation;
|
||||
class CWorldWorld;
|
||||
class CWorldObject;
|
||||
class CListener;
|
||||
|
||||
class CWorldAnimationList : private CObjectList {
|
||||
DWORD m_lastTime;
|
||||
public:
|
||||
CWorldAnimationList();
|
||||
void add( CWorldAnimation * worldAnimation, DWORD time );
|
||||
void animate( DWORD time );
|
||||
void clearList();
|
||||
void sendObjectAnimation( DWORD objectId, CListener * listener);
|
||||
};
|
||||
|
||||
class CWorldAnimation : public CObject {
|
||||
CWorldWorld * m_world;
|
||||
DWORD m_objectId;
|
||||
|
||||
DWORD m_startTime;
|
||||
DWORD m_stopTime;
|
||||
public:
|
||||
CWorldAnimation(DWORD objectId);
|
||||
virtual ~CWorldAnimation();
|
||||
|
||||
CWorldWorld * getWorld();
|
||||
void setWorld( CWorldWorld * world );
|
||||
|
||||
DWORD getObjectId();
|
||||
CWorldObject * getObject();
|
||||
|
||||
DWORD getStartTime(){ return m_startTime; }
|
||||
DWORD getStopTime(){ return m_stopTime; }
|
||||
|
||||
virtual int animate( DWORD time, DWORD deltaTime );
|
||||
virtual int animate( DWORD time );
|
||||
virtual CMessage * createMessage() = 0;
|
||||
};
|
||||
|
||||
#endif // _WORLDANIMATION_H
|
||||
90
common/include/worldhierarchy.H
Normal file
90
common/include/worldhierarchy.H
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDHIERARCHY_H
|
||||
#define _WORLDHIERARCHY_H
|
||||
|
||||
#include "objectlist.H"
|
||||
#include "listener.H"
|
||||
|
||||
class CWorldWorld;
|
||||
class CWorldObject;
|
||||
|
||||
class CWorldHierarchy : public CObjectList {
|
||||
friend class CWACreateObject;
|
||||
friend class CWARemoveObject;
|
||||
friend class CWAUpdateHierarchy;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Uniq identifyer for every object in the world system.
|
||||
// World have id -1;
|
||||
|
||||
DWORD m_objectId;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Hierarchical atributes
|
||||
|
||||
CWorldHierarchy * m_parent;
|
||||
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Constructor and destructor
|
||||
CWorldHierarchy(DWORD objectId, CWorldHierarchy * parent);
|
||||
virtual ~CWorldHierarchy();
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Attribute access function
|
||||
|
||||
DWORD getObjectId();
|
||||
|
||||
CWorldHierarchy * getParent();
|
||||
DWORD getParentId();
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Listener functions
|
||||
|
||||
virtual CListener * getListener() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Hierarchical functions
|
||||
|
||||
virtual CWorldWorld * getWorld();
|
||||
|
||||
private:
|
||||
// This function actualy do the work
|
||||
|
||||
void _addObject(CWorldObject * object);
|
||||
void _removeObject(CWorldObject * object);
|
||||
void _setParent(CWorldHierarchy * parent);
|
||||
|
||||
public:
|
||||
// Used as virtual redirect function for animation system.
|
||||
|
||||
virtual void addObject(CWorldObject * object);
|
||||
virtual void removeObject(CWorldObject * object);
|
||||
virtual void setParent(CWorldObject * parent);
|
||||
|
||||
// Find a object
|
||||
CWorldObject * getObject( DWORD objectId );
|
||||
CWorldObject * getObject( char * name );
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDHIERARCHY_H
|
||||
137
common/include/worldobject.H
Normal file
137
common/include/worldobject.H
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDOBJECT_H
|
||||
#define _WORLDOBJECT_H
|
||||
|
||||
#include "worldhierarchy.H"
|
||||
#include "position.H"
|
||||
#include "direction.H"
|
||||
#include "bbox.H"
|
||||
#include "bsdtree.H"
|
||||
#include "matrix.H"
|
||||
#include "doublearray.H"
|
||||
#include "beam.H"
|
||||
#include "geometry.H"
|
||||
#include "cellpvs.H"
|
||||
|
||||
|
||||
class CWorldWorld;
|
||||
|
||||
class CWorldObject : public CWorldHierarchy {
|
||||
|
||||
friend class CWAUpdatePosition;
|
||||
friend class CWAUpdateDirection;
|
||||
friend class CWACreateObject;
|
||||
friend class CWARotate;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Visual atributes
|
||||
|
||||
DWORD m_geometryId;
|
||||
|
||||
CPosition m_position;
|
||||
CDirection m_direction;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Physical atributes
|
||||
|
||||
BYTE m_collidable;
|
||||
|
||||
CBBox * m_bBox;
|
||||
CBSDTree * m_BSDTree;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Hierarchical atributes
|
||||
|
||||
CCellPVS * m_cellPVS;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Constructor and destructor
|
||||
|
||||
CWorldObject(DWORD objectId, CWorldHierarchy * parent, DWORD geometryId,
|
||||
const CPosition & position, const CDirection & direction);
|
||||
virtual ~CWorldObject();
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Visual functions
|
||||
|
||||
virtual CGeometry * getGeometry();
|
||||
DWORD getGeometryId();
|
||||
|
||||
CPosition & getPosition();
|
||||
CDirection & getDirection();
|
||||
|
||||
virtual void updatePosition( const CPosition & position );
|
||||
virtual void updateDirection( const CDirection & direction );
|
||||
virtual void rotate( const CDirection & angleSpeed );
|
||||
|
||||
private:
|
||||
void _updatePosition( const CPosition & position );
|
||||
void _updateDirection( const CDirection & direction );
|
||||
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Hierarchical functions
|
||||
|
||||
virtual char * getObjectType();
|
||||
|
||||
virtual CWorldObject * getMasterCell();
|
||||
|
||||
CPVCell* addPVCell(DWORD PVCellId, const CPosition & position);
|
||||
CCellPVS * getPVS();
|
||||
|
||||
CWorldObject * createObject(char * objectName, DWORD objectId, DWORD geometryId, const CPosition & position, const CDirection & direction );
|
||||
|
||||
virtual int moveTo( CWorldObject * parent );
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Physical functions
|
||||
|
||||
void setBBox( CBBox * bBox );
|
||||
CBBox * getBBox();
|
||||
|
||||
void setCollidable(BYTE coll);
|
||||
BYTE getCollidable();
|
||||
|
||||
void setBSDTree( CBSDTree * tree );
|
||||
CBSDTree * getBSDTree();
|
||||
|
||||
int checkPosition( const CPosition & position );
|
||||
|
||||
void getGlobalTransform( CMatrix & transform );
|
||||
void getTransform( CMatrix & transform );
|
||||
void getInvGlobalTransform( CMatrix & transform );
|
||||
void getInvTransform( CMatrix & transform );
|
||||
|
||||
void distances(CDoubleArray & distArray, const CBeam & beam,
|
||||
double min, double max);
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Utility functions
|
||||
|
||||
virtual void dump(int tab);
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDOBJECT_H
|
||||
89
common/include/worldworld.H
Normal file
89
common/include/worldworld.H
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* PVVMUD a 3D MUD
|
||||
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef _WORLDWORLD_H
|
||||
#define _WORLDWORLD_H
|
||||
|
||||
#include "worldhierarchy.H"
|
||||
|
||||
#include "worldanimation.H"
|
||||
#include "worldobject.H"
|
||||
#include "cellpvs.H"
|
||||
|
||||
class CWorldWorld : public CWorldHierarchy {
|
||||
|
||||
CWorldAnimationList * m_animationList;
|
||||
DWORD m_startTimeSec;
|
||||
DWORD m_timeOffset;
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor and destructor
|
||||
|
||||
CWorldWorld();
|
||||
virtual ~CWorldWorld();
|
||||
|
||||
virtual CWorldWorld * getWorld();
|
||||
CWorldAnimationList * getAnimationList();
|
||||
|
||||
DWORD getTime();
|
||||
void fixTime(long deltaTime);
|
||||
|
||||
void clearWorld();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Internal callback functions for creating new world elements
|
||||
|
||||
virtual CWorldObject * newObject(char * objectName, DWORD objectId, CWorldObject * parent, DWORD geometryId, const CPosition & position, const CDirection & direction) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// External interfaces used to manipulate world
|
||||
|
||||
CWorldObject * createObject( DWORD parentId, char * objectName,
|
||||
DWORD objectId, DWORD geometryId,
|
||||
const CPosition & position,
|
||||
const CDirection & direction );
|
||||
void removeObject( DWORD objectId, DWORD parentId );
|
||||
|
||||
CPVCell* addPVCell( DWORD cellId, DWORD PVCellId,
|
||||
const CPosition & position );
|
||||
|
||||
void updatePosition( DWORD objectId, const CPosition & position );
|
||||
void updateDirection( DWORD objectId, const CDirection & direction );
|
||||
void rotate( DWORD objectId, const CDirection & angleSpeed );
|
||||
|
||||
void updateHierarchy( DWORD objectId, DWORD parentId );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Animate functions
|
||||
|
||||
void addAnimation( CWorldAnimation * animation, CWorldHierarchy * object );
|
||||
void animate( );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Utility functions
|
||||
|
||||
virtual void dump();
|
||||
|
||||
};
|
||||
|
||||
#endif // _WORLDWORLD_H
|
||||
Reference in New Issue
Block a user