Last change
on this file since 883 was
790,
checked in by nicolasc, 17 years ago
|
merged FICN back into trunk
awaiting release.
|
File size:
1.6 KB
|
Rev | Line | |
---|
[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] | 18 | namespace 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 |
---|
| 39 | bool diffed; |
---|
[592] | 40 | unsigned char *data; //!< pointer to data |
---|
[417] | 41 | }; |
---|
| 42 | |
---|
[592] | 43 | /** |
---|
[777] | 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 | */ |
---|
[417] | 49 | struct GameStateCompressed{ |
---|
[592] | 50 | int id; |
---|
| 51 | int compsize; //!< size of compressed data |
---|
| 52 | int normsize; //!< size of uncompressed data |
---|
[436] | 53 | // new ----- change functions |
---|
| 54 | bool diffed; |
---|
[592] | 55 | unsigned char *data; //!< gamestate data |
---|
[417] | 56 | }; |
---|
| 57 | |
---|
| 58 | struct classid{ |
---|
| 59 | int id; |
---|
| 60 | int length; |
---|
| 61 | int clid; |
---|
| 62 | const char *message; |
---|
| 63 | }; |
---|
[592] | 64 | |
---|
| 65 | |
---|
[417] | 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 | }; |
---|
[777] | 81 | //only in this class, not PacketGenerator, used as pattern to put incoming |
---|
| 82 | //bytes inside |
---|
[417] | 83 | struct chat { |
---|
| 84 | int id; |
---|
| 85 | const char* message; |
---|
| 86 | }; |
---|
| 87 | |
---|
| 88 | } |
---|
| 89 | |
---|
[673] | 90 | #endif /* _PacketTypes_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.