Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/PacketTypes.h @ 1016

Last change on this file since 1016 was 986, checked in by scheusso, 16 years ago

some changes in packetgenerator/decoder and gamestatemanager

File size: 1.8 KB
RevLine 
[417]1//
2// C++ Interface: PacketTypes
3//
[592]4// Description:
[417]5//
6//
7// Author:  <>, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12
[673]13#ifndef _PacketTypes_H__
14#define _PacketTypes_H__
[417]15
[777]16#include "NetworkPrereqs.h"
[417]17
[777]18namespace network
19{
20  enum packet_id {
21    ACK,
22    MOUSE,
23    KEYBOARD,
24    CHAT,
25    GAMESTATE ,
26    CLASSID
27  };
[417]28
[777]29
[592]30  /**
[777]31  * This struct defines a gamestate:
32  * size: total size of the data in *data
33  * data: pointer to the data allocated in the memory
34  */
[417]35  struct GameState{
36    int id;
[592]37    int size;                       //!< total size of data
[436]38    // new ---- change functions
[986]39    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
[436]40    bool diffed;
[592]41    unsigned char *data;            //!< pointer to data
[417]42  };
43
[592]44  /**
[777]45  * this struct defines a gamestate:
46  * compsize is the size of the compressed data
47  * normsize is the size of the uncompressed data
48  * data are the gamestates
49  */
[417]50  struct GameStateCompressed{
[592]51    int id;
52    int compsize;                   //!< size of compressed data
53    int normsize;                   //!< size of uncompressed data
[436]54    // new ----- change functions
[986]55    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
[436]56    bool diffed;
[592]57    unsigned char *data;            //!< gamestate data
[417]58  };
59
60  struct classid{
61    int id;
62    int length;
63    int clid;
64    const char *message;
65  };
[592]66
67
[417]68  struct ack {
69    int id;
70    int a;
71  };
72
73  struct mouse {
74    int id;
75    double x;
76    double y;
77  };
78
79  struct keyboard {
80    int id;
81    char press;
82  };
[777]83  //only in this class, not PacketGenerator, used as pattern to put incoming
84  //bytes inside
[417]85  struct chat {
86    int id;
87    const char* message;
88  };
89
90}
91
[673]92#endif /* _PacketTypes_H__ */
Note: See TracBrowser for help on using the repository browser.