1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * ... |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | // |
---|
30 | // C++ Interface: PacketTypes |
---|
31 | // |
---|
32 | // Description: |
---|
33 | // |
---|
34 | // |
---|
35 | // Author: <>, (C) 2007 |
---|
36 | // |
---|
37 | // Copyright: See COPYING file that comes with this distribution |
---|
38 | // |
---|
39 | // |
---|
40 | |
---|
41 | #ifndef _PacketTypes_H__ |
---|
42 | #define _PacketTypes_H__ |
---|
43 | |
---|
44 | #include "NetworkPrereqs.h" |
---|
45 | |
---|
46 | namespace network |
---|
47 | { |
---|
48 | enum packet_id { |
---|
49 | ACK, |
---|
50 | MOUSE, |
---|
51 | KEYBOARD, |
---|
52 | CHAT, |
---|
53 | GAMESTATE , |
---|
54 | CLASSID |
---|
55 | }; |
---|
56 | |
---|
57 | |
---|
58 | /** |
---|
59 | * This struct defines a gamestate: |
---|
60 | * size: total size of the data in *data |
---|
61 | * data: pointer to the data allocated in the memory |
---|
62 | */ |
---|
63 | struct GameState{ |
---|
64 | int id; |
---|
65 | int size; //!< total size of data |
---|
66 | // new ---- change functions |
---|
67 | int base_id; // if gamestate is diffed this is the id of the old gamestate (base) |
---|
68 | bool diffed; |
---|
69 | unsigned char *data; //!< pointer to data |
---|
70 | }; |
---|
71 | |
---|
72 | /** |
---|
73 | * this struct defines a gamestate: |
---|
74 | * compsize is the size of the compressed data |
---|
75 | * normsize is the size of the uncompressed data |
---|
76 | * data are the gamestates |
---|
77 | */ |
---|
78 | struct GameStateCompressed{ |
---|
79 | int id; |
---|
80 | int compsize; //!< size of compressed data |
---|
81 | int normsize; //!< size of uncompressed data |
---|
82 | // new ----- change functions |
---|
83 | int base_id; // if gamestate is diffed this is the id of the old gamestate (base) |
---|
84 | bool diffed; |
---|
85 | unsigned char *data; //!< gamestate data |
---|
86 | }; |
---|
87 | |
---|
88 | struct classid{ |
---|
89 | int id; |
---|
90 | int length; |
---|
91 | int clid; |
---|
92 | const char *message; |
---|
93 | }; |
---|
94 | |
---|
95 | |
---|
96 | struct ack { |
---|
97 | int id; |
---|
98 | int a; |
---|
99 | }; |
---|
100 | |
---|
101 | struct mouse { |
---|
102 | int id; |
---|
103 | double x; |
---|
104 | double y; |
---|
105 | }; |
---|
106 | |
---|
107 | struct keyboard { |
---|
108 | int id; |
---|
109 | char press; |
---|
110 | }; |
---|
111 | //only in this class, not PacketGenerator, used as pattern to put incoming |
---|
112 | //bytes inside |
---|
113 | struct chat { |
---|
114 | int id; |
---|
115 | const char* message; |
---|
116 | }; |
---|
117 | |
---|
118 | } |
---|
119 | |
---|
120 | #endif /* _PacketTypes_H__ */ |
---|