Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/GameStateClient.h @ 1504

Last change on this file since 1504 was 1504, checked in by rgrieder, 17 years ago

Once again, set all the svn:eol-style property to native. I really hope this doesn't pose more problems than it solves..

  • Property eol-style set to native
File size: 2.8 KB
RevLine 
[1168]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:
[1502]23 *      Oliver Scheuss
[1168]24 *   Co-authors:
[1502]25 *      Dumeni Manatschal
[1168]26 *
27 */
28
[1199]29//
30// C++ Interface: GameStateClient
31//
32// Description:
33//
34//
[1502]35// Author:  Oliver Scheuss, (C) 2007
[1199]36//
37// Copyright: See COPYING file that comes with this distribution
38//
39//
40#ifndef _GameStateClient_H__
41#define _GameStateClient_H__
42
43#include <map>
[1232]44//
[1199]45#include "NetworkPrereqs.h"
46#include "core/CorePrereqs.h"
47#include "PacketTypes.h"
[1502]48#include "objects/SpaceShip.h"
[1199]49
[1232]50
[1502]51#define GAMESTATEID_INITIAL -1
52
[1199]53namespace network
54{
55  class GameStateClient
56  {
57  public:
58    GameStateClient();
59    ~GameStateClient();
[1232]60   
[1502]61    void addGameState(GameStateCompressed *gs);
62    int processGameState();
[1232]63    GameStateCompressed *popPartialGameState();
[1502]64    void cleanup();
[1199]65  private:
[1502]66    bool pushGameState(GameStateCompressed *compstate);
[1199]67    bool loadSnapshot(GameState *state);
[1232]68    GameState *getPartialSnapshot();
[1199]69    GameState *undiff(GameState *old, GameState *diff);
[1232]70    GameStateCompressed *compress_(GameState *a);
[1199]71    GameState *decompress(GameStateCompressed *a);
72    GameState *decode(GameState *old, GameStateCompressed *diff);
73    GameState *decode(GameStateCompressed *x);
74    void removeObject(orxonox::Iterator<Synchronisable> &it);
75    void printGameStateMap();
[1502]76    bool saveShipCache();
77    bool loadShipCache();
[1199]78
79    int           last_diff_;
[1360]80    int           last_gamestate_;
[1199]81    std::map<int, GameState *> gameStateMap;
[1502]82    GameStateCompressed *tempGameState_; // we save the received gamestates here during processQueue
83    orxonox::SpaceShip *myShip_;
84    syncData shipCache_;
[1232]85   
86   
87   
88   
89  public:
90    //#### ADDED FOR TESTING PURPOSE ####
91    GameState* testDecompress( GameStateCompressed* gc );
92    GameState* testUndiff( GameState* g_old, GameState* g_diffed );
93    //#### END TESTING PURPOSE ####
[1199]94  };
95
96}
97
98#endif /* _GameStateClient_H__ */
Note: See TracBrowser for help on using the repository browser.