Last change
on this file since 448 was
436,
checked in by scheusso, 16 years ago
|
extended gamestatehandling for diffed and not diffed gamestates (initial states, etc)
|
File size:
1.3 KB
|
Rev | Line | |
---|
[417] | 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 NETWORK_PACKETTYPES_H |
---|
| 14 | #define NETWORK_PACKETTYPES_H |
---|
| 15 | |
---|
| 16 | namespace network{ |
---|
| 17 | enum packet_id { |
---|
| 18 | ACK, |
---|
| 19 | MOUSE, |
---|
| 20 | KEYBOARD, |
---|
| 21 | CHAT, |
---|
| 22 | GAMESTATE , |
---|
| 23 | CLASSID |
---|
| 24 | }; |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * This struct defines a gamestate: |
---|
| 29 | * size: total size of the data in *data |
---|
| 30 | * data: pointer to the data allocated in the memory |
---|
| 31 | */ |
---|
| 32 | struct GameState{ |
---|
| 33 | int id; |
---|
| 34 | int size; |
---|
[436] | 35 | // new ---- change functions |
---|
| 36 | bool diffed; |
---|
[417] | 37 | unsigned char *data; |
---|
| 38 | }; |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * this struct defines a gamestate: |
---|
| 42 | * compsize is the size of the compressed data |
---|
| 43 | * normsize is the size of the uncompressed data |
---|
| 44 | * data are the gamestates |
---|
| 45 | */ |
---|
| 46 | struct GameStateCompressed{ |
---|
| 47 | int id; |
---|
| 48 | int compsize; |
---|
| 49 | int normsize; |
---|
[436] | 50 | // new ----- change functions |
---|
| 51 | bool diffed; |
---|
[417] | 52 | unsigned char *data; |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | struct classid{ |
---|
| 56 | int id; |
---|
| 57 | int length; |
---|
| 58 | int clid; |
---|
| 59 | const char *message; |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | struct ack { |
---|
| 64 | int id; |
---|
| 65 | int a; |
---|
| 66 | }; |
---|
| 67 | |
---|
| 68 | struct mouse { |
---|
| 69 | int id; |
---|
| 70 | double x; |
---|
| 71 | double y; |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | struct keyboard { |
---|
| 75 | int id; |
---|
| 76 | char press; |
---|
| 77 | }; |
---|
| 78 | //only in this class, not PacketGenerator, used as pattern to put incoming |
---|
| 79 | //bytes inside |
---|
| 80 | struct chat { |
---|
| 81 | int id; |
---|
| 82 | const char* message; |
---|
| 83 | }; |
---|
| 84 | |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.