Last change
on this file since 1047 was
986,
checked in by scheusso, 16 years ago
|
some changes in packetgenerator/decoder and gamestatemanager
|
File size:
1.8 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 | |
---|
18 | namespace 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 | int base_id; // if gamestate is diffed this is the id of the old gamestate (base) |
---|
40 | bool diffed; |
---|
41 | unsigned char *data; //!< pointer to data |
---|
42 | }; |
---|
43 | |
---|
44 | /** |
---|
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 | */ |
---|
50 | struct GameStateCompressed{ |
---|
51 | int id; |
---|
52 | int compsize; //!< size of compressed data |
---|
53 | int normsize; //!< size of uncompressed data |
---|
54 | // new ----- change functions |
---|
55 | int base_id; // if gamestate is diffed this is the id of the old gamestate (base) |
---|
56 | bool diffed; |
---|
57 | unsigned char *data; //!< gamestate data |
---|
58 | }; |
---|
59 | |
---|
60 | struct classid{ |
---|
61 | int id; |
---|
62 | int length; |
---|
63 | int clid; |
---|
64 | const char *message; |
---|
65 | }; |
---|
66 | |
---|
67 | |
---|
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 | }; |
---|
83 | //only in this class, not PacketGenerator, used as pattern to put incoming |
---|
84 | //bytes inside |
---|
85 | struct chat { |
---|
86 | int id; |
---|
87 | const char* message; |
---|
88 | }; |
---|
89 | |
---|
90 | } |
---|
91 | |
---|
92 | #endif /* _PacketTypes_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.