Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/merge/src/network/PacketTypes.h @ 1264

Last change on this file since 1264 was 1264, checked in by scheusso, 16 years ago

merge network3 and camera branch into merge branch

File size: 3.3 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    MOUSE,
51    COMMAND,
52    KEYBOARD,
53    CHAT,
54    GAMESTATE ,
55    CLASSID,
56    WELCOME,
57    CONNECT,
58  };
59
60
61  /**
62  * This struct defines a gamestate:
63  * size: total size of the data in *data
64  * data: pointer to the data allocated in the memory
65  */
66  struct GameState{
67    int id;
68    int size;                       //!< total size of data
69    // new ---- change functions
70    int base_id;                    // if gamestate is diffed this is the id of the old gamestate (base)
71    bool diffed;
72    bool complete;                  // this determines, wheter all objects are in this gamestate (server) or only few objects (client)
73    unsigned char *data;            //!< pointer to data
74  };
75
76  /**
77  * this struct defines a gamestate:
78  * compsize is the size of the compressed data
79  * normsize is the size of the uncompressed data
80  * data are the gamestates
81  */
82  struct GameStateCompressed{
83    int id;
84    int compsize;                   //!< size of compressed data
85    int normsize;                   //!< size of uncompressed data
86    // new ----- change functions
87    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
88    bool diffed;
89    bool complete;                  // this determines, wheter all objects are in this gamestate (server) or only few objects (client)
90    unsigned char *data;            //!< gamestate data
91  };
92
93  struct classid{
94    int id;
95    int length;
96    int clid;
97    const char *message;
98  };
99
100
101  struct ack {
102    int id;
103    int a;
104  };
105
106  struct mouse {
107    int id;
108    double x;
109    double y;
110  };
111
112  struct keyboard {
113    int id;
114    char press;
115  };
116  //only in this class, not PacketGenerator, used as pattern to put incoming
117  //bytes inside
118  struct chat {
119    int id;
120    const char* message;
121  };
122
123  struct welcome {
124    int id;
125    int clientID;
126    int shipID;
127    bool allowed;
128  };
129 
130  struct connectRequest{
131    int id;
132  };
133}
134
135#endif /* _PacketTypes_H__ */
Note: See TracBrowser for help on using the repository browser.