Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/GameStateManager.h @ 247

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

added GameStateManager class:

  • gets snapshots of the universe (gamestate) and returns them
  • processes snapshots and loads them to the universe

modified Synchronisable

  • added a function getData(usigned char *data), which puts the data to

the already given pointer (more efficient memory handling for the
GameState class)

  • added a function getSize(), which tells you the total size of the

current gamestate (so that you can allocate enough memory and give it to
getData

File size: 814 bytes
Line 
1//
2// C++ Interface: GameStateManager
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef NETWORK_GAMESTATEMANAGER_H
13#define NETWORK_GAMESTATEMANAGER_H
14
15namespace network {
16
17/**
18 * This struct defines a gamestate:
19 * size: total size of the data in *data
20 * data: pointer to the data allocated in the memory
21 */
22struct GameState{
23  int size;
24  unsigned char *data;
25};
26
27/**
28 * This Class implements a manager for gamestates:
29 * - creating snapshots of gamestates
30 * - writing gamestates to universe
31 * - diffing gamestates ?
32 * @author Oliver Scheuss
33*/
34class GameStateManager{
35public:
36  GameStateManager();
37  ~GameStateManager();
38  GameState getSnapshot();
39  bool loadSnapshot(GameState state);
40private:
41 
42};
43
44}
45
46#endif
Note: See TracBrowser for help on using the repository browser.