Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 10, 2018, 3:06:55 PM (6 years ago)
Author:
merholzl
Message:

Merged Masterserver, refresh button had to be removed

Location:
code/branches/mergeFS18
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/mergeFS18

  • code/branches/mergeFS18/src/libraries/network/GamestateManager.h

    r11071 r12027  
    5858  * - writing gamestates to universe
    5959  * - diffing gamestates
     60  *
     61  * Inherited by Host
     62  *
    6063  * EN/DECODATION:
    6164  * a: last Gamestate a client has received
    6265  * b: new Gamestate
    6366  * x: diffed and compressed gamestate
    64   * x=(a^b)
    65   * b=(a^x)
    66   * diff(a,diff(a,x))=x (hope this is correct)
     67  * x = (a ^ b)
     68  * b = (a ^ x)
     69  * diff(a, diff(a, x)) = x (hope this is correct)
    6770  * @author Oliver Scheuss
    6871  */
     
    7578      uint32_t  lastAckedGamestateID;     //!< id of the last gamestate on which we received an ack from the peer
    7679      bool      isSynched;
    77       std::map< uint32_t, packet::Gamestate* > gamestates;
     80      std::map<uint32_t, packet::Gamestate*> gamestates;
    7881    };
    7982
     
    8689    virtual bool      ackGamestate(unsigned int gamestateID, unsigned int peerID) override;
    8790    virtual uint32_t  getLastReceivedGamestateID( unsigned int peerID ) override;
    88     virtual uint32_t  getCurrentGamestateID() override{ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
     91    virtual uint32_t  getCurrentGamestateID() override { if(currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
    8992
    9093    bool processGamestates();
     
    98101    void addPeer( uint32_t peerID );
    99102    void setSynched( uint32_t peerID )
    100       { assert(peerMap_.find(peerID)!=peerMap_.end()); peerMap_[peerID].isSynched = true; }
     103      { assert(peerMap_.find(peerID) != peerMap_.end()); peerMap_[peerID].isSynched = true; }
    101104    void removePeer( uint32_t peerID );
    102     bool hasPeers(){ return this->peerMap_.size()!=0; }
    103 //     void removeClient(ClientInformation *client);
     105    bool hasPeers(){ return this->peerMap_.size() != 0; }
     106
    104107  protected:
    105108    virtual bool sendPacket( packet::Packet* packet ) = 0;
     109
    106110  private:
    107111    bool processGamestate(packet::Gamestate *gs);
    108112
    109 //     std::map<unsigned int, std::map<unsigned int, packet::Gamestate*>> gamestateMap_;
    110113    std::map<unsigned int, packet::Gamestate*> gamestateQueue;
    111 //     std::map<unsigned int, uint32_t> lastProcessedGamestateID_;
     114
     115    // Each peerID maps to a peerInfo struct
    112116    std::map<uint32_t, peerInfo> peerMap_;
     117
     118    // always contains the latest gamestate
    113119    packet::Gamestate* currentGamestate_;
    114 //     TrafficControl *trafficControl_;
    115120    unsigned int id_;
    116 //     boost::mutex* threadMutex_;
    117     ThreadPool*   /*thread*/Pool_;
     121    ThreadPool* Pool_;
    118122  };
    119123
Note: See TracChangeset for help on using the changeset viewer.