Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/src/network/PacketTypes.h @ 859

Last change on this file since 859 was 859, checked in by landauf, 16 years ago

more or less a copy of the trunk

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