Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/PacketTypes.h @ 1497

Last change on this file since 1497 was 1494, checked in by rgrieder, 16 years ago
  • set the svn:eol-style property to all files so, that where ever you check out, you'll get the right line endings (had to change every file with mixed endings to windows in order to set the property)
  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
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
46namespace network
47{
48  enum packet_id {
49    ACK,
50    COMMAND,
51    CHAT,
52    GAMESTATE ,
53    CLASSID,
54    WELCOME,
55    CONNECT,
56  };
57
58
59  /**
60  * This struct defines a gamestate:
61  * size: total size of the data in *data
62  * data: pointer to the data allocated in the memory
63  */
64  struct GameState{
65    int id;
66    int size;                       //!< total size of data
67    // new ---- change functions
68    int base_id;                    // if gamestate is diffed this is the id of the old gamestate (base)
69    bool diffed;
70    bool complete;                  // this determines, wheter all objects are in this gamestate (server) or only few objects (client)
71    unsigned char *data;            //!< pointer to data
72  };
73
74  /**
75  * this struct defines a gamestate:
76  * compsize is the size of the compressed data
77  * normsize is the size of the uncompressed data
78  * data are the gamestates
79  */
80  struct GameStateCompressed{
81    int id;
82    int compsize;                   //!< size of compressed data
83    int normsize;                   //!< size of uncompressed data
84    // new ----- change functions
85    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
86    bool diffed;
87    bool complete;                  // this determines, wheter all objects are in this gamestate (server) or only few objects (client)
88    unsigned char *data;            //!< gamestate data
89  };
90
91  struct classid{
92    int id;
93    int length;
94    int clid;
95    const char *message;
96  };
97
98
99  struct ack {
100    int id;
101    int a;
102  };
103
104  //only in this class, not PacketGenerator, used as pattern to put incoming
105  //bytes inside
106  struct chat {
107    int id;
108    const char* message;
109  };
110
111  struct welcome {
112    int id;
113    int clientID;
114    int shipID;
115    bool allowed;
116  };
117 
118  struct connectRequest{
119    int id;
120  };
121}
122
123#endif /* _PacketTypes_H__ */
Note: See TracBrowser for help on using the repository browser.