Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2007, 12:42:46 PM (16 years ago)
Author:
scheusso
Message:

extended gamestatehandling for diffed and not diffed gamestates (initial states, etc)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/GameStateManager.h

    r425 r436  
    1313#define NETWORK_GAMESTATEMANAGER_H
    1414
    15 #include <vector>
     15#include <map>
    1616
    1717#include "zlib.h"
    1818
     19#include "ClientInformation.h"
    1920#include "Synchronisable.h"
    2021#include "orxonox/core/IdentifierIncludes.h"
     
    2425namespace network {
    2526
    26 
     27#define KEEP_GAMESTATES 20
    2728
    2829/**
     
    4344class GameStateManager{
    4445public:
    45   GameStateManager();
     46  GameStateManager(ClientInformation *head);
    4647  ~GameStateManager();
    4748  void update();
    4849  GameStateCompressed popGameState(int clientID);
    4950  void ackGameState(int clientID, int gamestateID);
    50   void removeClient(int clientID);
    5151private:
    5252  GameState *getSnapshot(int id);
    5353  GameStateCompressed encode(GameState *a, GameState *b);
     54  GameStateCompressed encode(GameState *a);
    5455  GameState diff(GameState *a, GameState *b);
    55   GameStateCompressed compress_(GameState a);
    56   bool deleteUnusedGameState(GameState *state);
     56  GameStateCompressed compress_(GameState *a);
     57  bool deleteUnusedGameState(int gamestateID);
    5758 
    58   std::vector<GameState *> clientGameState;
    59   std::vector<GameState *> idGameState;
     59  std::map<int, GameState*> gameStateMap; //map gsID to gamestate*
     60  std::map<int, int> gameStateUsed; // save the number of clients, that use the specific gamestate
    6061  GameState *reference;
    6162  int id;
     63  ClientInformation *head_;
    6264};
    6365
Note: See TracChangeset for help on using the changeset viewer.