Files
bsdtree
client
common
include
action.H
bbox.H
beam.H
bf_locl.h
bf_pi.h
blowfish.h
bogfile.H
bsdtree.H
cache.H
cellpvs.H
commandparser.H
communicate.H
crossindex.H
crypto.H
direction.H
doublearray.H
exception.H
geometry.H
gos.H
gosmessage.H
gosprotocol.H
hash_map
hash_map.h
inetaddress.H
int.H
intarray.H
keyframe.H
listener.H
manager.H
material.H
matfile.H
matrix.H
message.H
messagelist.H
msgactionlist.H
msggos.H
msgmsg.H
msgserver.H
msgsrvcli.H
msgsrvgos.H
msgvarlength.H
msgworld.H
mudtypes.h
namedb.H
object.H
objectarray.H
objectlist.H
objectqueue.H
option.H
pingpong.H
plane.H
position.H
pvvmud.H
socket.H
spline.H
stl_hash_fun.h
stl_hash_map.h
stl_hashtable.h
stream.H
texture.H
time.H
timekeeper.H
vector.H
vertex.H
viewpoint.H
wacreateobject.H
waobject.H
waremoveobject.H
warotate.H
waupdatedirection.H
waupdatehierarchy.H
waupdateposition.H
worldanimation.H
worldhierarchy.H
worldobject.H
worldworld.H
lib
Makefile.am
Makefile.in
doc
download
gos
lib
mudworld
server
util
worldsrv
.cvsignore
LICENSE
Makefile.am
Makefile.in
README
aclocal.m4
configure
configure.in
install-sh
missing
mkinstalldirs
pvvmud.html
2025-03-05 08:37:43 +01:00

135 lines
4.5 KiB
C++

/*
* 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