Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network2/src/network/PacketTypes.h @ 1163

Last change on this file since 1163 was 1098, checked in by rgrieder, 16 years ago

merged network branch into new network2 branch (from trunk)

File size: 2.7 KB
RevLine 
[1056]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
[417]29//
30// C++ Interface: PacketTypes
31//
[592]32// Description:
[417]33//
34//
35// Author:  <>, (C) 2007
36//
37// Copyright: See COPYING file that comes with this distribution
38//
39//
40
[673]41#ifndef _PacketTypes_H__
42#define _PacketTypes_H__
[417]43
[777]44#include "NetworkPrereqs.h"
[417]45
[777]46namespace network
47{
48  enum packet_id {
49    ACK,
50    MOUSE,
51    KEYBOARD,
52    CHAT,
53    GAMESTATE ,
54    CLASSID
55  };
[417]56
[777]57
[592]58  /**
[777]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  */
[417]63  struct GameState{
64    int id;
[592]65    int size;                       //!< total size of data
[436]66    // new ---- change functions
[1098]67    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
[436]68    bool diffed;
[592]69    unsigned char *data;            //!< pointer to data
[417]70  };
71
[592]72  /**
[777]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  */
[417]78  struct GameStateCompressed{
[592]79    int id;
80    int compsize;                   //!< size of compressed data
81    int normsize;                   //!< size of uncompressed data
[436]82    // new ----- change functions
[1098]83    int base_id;                  // if gamestate is diffed this is the id of the old gamestate (base)
[436]84    bool diffed;
[592]85    unsigned char *data;            //!< gamestate data
[417]86  };
87
88  struct classid{
89    int id;
90    int length;
91    int clid;
92    const char *message;
93  };
[592]94
95
[417]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  };
[777]111  //only in this class, not PacketGenerator, used as pattern to put incoming
112  //bytes inside
[417]113  struct chat {
114    int id;
115    const char* message;
116  };
117
118}
119
[673]120#endif /* _PacketTypes_H__ */
Note: See TracBrowser for help on using the repository browser.