- Timestamp:
- Dec 21, 2010, 6:09:09 PM (14 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/network3 (added) merged: 7333,7336-7337,7344 /code/branches/network4 (added) merged: 7497,7718,7753-7755 /code/branches/network5 (added) merged: 7757-7759,7772-7778,7780-7781
- Property svn:mergeinfo changed
-
code/branches/presentation2/src/libraries/network/GamestateManager.h
r7163 r7788 46 46 #include "GamestateHandler.h" 47 47 #include "core/CorePrereqs.h" 48 #include "packet/Gamestate.h" 49 #include <boost/concept_check.hpp> 48 50 49 51 namespace orxonox … … 66 68 * @author Oliver Scheuss 67 69 */ 68 class _NetworkExport GamestateManager: public GamestateHandler{ 70 class _NetworkExport GamestateManager: public GamestateHandler 71 { 72 struct peerInfo 73 { 74 uint32_t peerID; 75 uint32_t lastProcessedGamestateID; 76 uint32_t lastAckedGamestateID; 77 bool isSynched; 78 std::map< uint32_t, packet::Gamestate* > gamestates; 79 }; 80 69 81 public: 82 70 83 GamestateManager(); 71 84 ~GamestateManager(); 72 85 73 bool add(packet::Gamestate *gs, unsigned int clientID); 86 virtual bool addGamestate(packet::Gamestate *gs, unsigned int peerID); 87 virtual bool ackGamestate(unsigned int gamestateID, unsigned int peerID); 88 virtual uint32_t getLastProcessedGamestateID( unsigned int peerID ); 89 virtual uint32_t getCurrentGamestateID(){ return currentGamestate_->getID(); } 90 74 91 bool processGamestates(); 92 bool sendAck(unsigned int gamestateID, uint32_t peerID); 75 93 bool update(); 76 void sendGamestates(); 77 // packet::Gamestate *popGameState(unsigned int clientID); 78 void finishGamestate( unsigned int clientID, packet::Gamestate*& destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ); 94 std::vector<packet::Gamestate*> getGamestates(); 95 void finishGamestate( unsigned int peerID, packet::Gamestate*& destgamestate, packet::Gamestate* base, packet::Gamestate* gamestate ); 79 96 80 97 bool getSnapshot(); 81 98 82 bool ack(unsigned int gamestateID, unsigned int clientID); 83 void removeClient(ClientInformation *client); 99 void addPeer( uint32_t peerID ); 100 void setSynched( uint32_t peerID ) 101 { assert(peerMap_.find(peerID)!=peerMap_.end()); peerMap_[peerID].isSynched = true; } 102 void removePeer( uint32_t peerID ); 103 // void removeClient(ClientInformation *client); 104 protected: 105 virtual bool sendPacket( packet::Packet* packet ) = 0; 84 106 private: 85 107 bool processGamestate(packet::Gamestate *gs); 86 108 87 std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> > gamestateMap_;109 // std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> > gamestateMap_; 88 110 std::map<unsigned int, packet::Gamestate*> gamestateQueue; 89 packet::Gamestate *reference; 90 TrafficControl *trafficControl_; 111 // std::map<unsigned int, uint32_t> lastProcessedGamestateID_; 112 std::map<uint32_t, peerInfo> peerMap_; 113 packet::Gamestate* currentGamestate_; 114 // TrafficControl *trafficControl_; 91 115 unsigned int id_; 92 116 // boost::mutex* threadMutex_;
Note: See TracChangeset
for help on using the changeset viewer.