Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2018, 4:12:23 PM (6 years ago)
Author:
mdedial
Message:

WIP 22.03.18: Begin documenting server-side code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Masterserver_FS18/src/libraries/network/GamestateManager.h

    r11071 r11829  
    6262  * b: new Gamestate
    6363  * x: diffed and compressed gamestate
    64   * x=(a^b)
    65   * b=(a^x)
    66   * diff(a,diff(a,x))=x (hope this is correct)
     64  * x = (a ^ b)
     65  * b = (a ^ x)
     66  * diff(a, diff(a, x)) = x (hope this is correct)
    6767  * @author Oliver Scheuss
    6868  */
     
    7575      uint32_t  lastAckedGamestateID;     //!< id of the last gamestate on which we received an ack from the peer
    7676      bool      isSynched;
    77       std::map< uint32_t, packet::Gamestate* > gamestates;
     77      std::map<uint32_t, packet::Gamestate*> gamestates;
    7878    };
    7979
     
    8686    virtual bool      ackGamestate(unsigned int gamestateID, unsigned int peerID) override;
    8787    virtual uint32_t  getLastReceivedGamestateID( unsigned int peerID ) override;
    88     virtual uint32_t  getCurrentGamestateID() override{ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
     88    virtual uint32_t  getCurrentGamestateID() override { if(currentGamestate) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
    8989
    9090    bool processGamestates();
     
    9898    void addPeer( uint32_t peerID );
    9999    void setSynched( uint32_t peerID )
    100       { assert(peerMap_.find(peerID)!=peerMap_.end()); peerMap_[peerID].isSynched = true; }
     100      { assert(peerMap_.find(peerID) != peerMap_.end()); peerMap_[peerID].isSynched = true; }
    101101    void removePeer( uint32_t peerID );
    102     bool hasPeers(){ return this->peerMap_.size()!=0; }
    103 //     void removeClient(ClientInformation *client);
     102    bool hasPeers(){ return this->peerMap_.size() != 0; }
     103
    104104  protected:
    105105    virtual bool sendPacket( packet::Packet* packet ) = 0;
     106
    106107  private:
    107108    bool processGamestate(packet::Gamestate *gs);
    108109
    109 //     std::map<unsigned int, std::map<unsigned int, packet::Gamestate*>> gamestateMap_;
     110    // TODO: What is the purpose of the gamestateQueue?
    110111    std::map<unsigned int, packet::Gamestate*> gamestateQueue;
    111 //     std::map<unsigned int, uint32_t> lastProcessedGamestateID_;
     112
     113    // Each peerID maps to a peerInfo struct
    112114    std::map<uint32_t, peerInfo> peerMap_;
     115
     116    // always contains the latest gamestate
    113117    packet::Gamestate* currentGamestate_;
    114 //     TrafficControl *trafficControl_;
    115118    unsigned int id_;
    116 //     boost::mutex* threadMutex_;
    117     ThreadPool*   /*thread*/Pool_;
     119    ThreadPool* Pool_;
    118120  };
    119121
Note: See TracChangeset for help on using the changeset viewer.