Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9504 in orxonox.OLD for branches/proxy/src/lib/network


Ignore:
Timestamp:
Jul 27, 2006, 12:54:39 PM (18 years ago)
Author:
patrick
Message:
  • removing entities from the network works now also on proxies.
  • player team change is handled differently now: handler function
  • there was a chronological error in the change team function call stack
Location:
branches/proxy/src/lib/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/message_manager.cc

    r9494 r9504  
    141141  int nAcks;
    142142
     143
    143144  assert( i + INTSIZE <= length );
    144145  n = Converter::byteArrayToInt( data + i, &nAcks );
     
    248249  return i;
    249250}
     251
     252
    250253
    251254/**
  • branches/proxy/src/lib/network/player_stats.cc

    r9494 r9504  
    105105  {
    106106    PRINTF(0)("user %s is now known as %s\n", oldNickName.c_str(), nickName.c_str());
    107     oldNickName = nickName;
    108   }
    109 }
     107    this->oldNickName = nickName;
     108  }
     109
     110  if ( std::find( id.begin(), id.end(), teamId_handle ) != id.end() )
     111  {
     112    PRINTF(0)("user %s joins team %i\n", this->nickName.c_str(), this->teamId);
     113    this->setPreferedTeamIdHandler( this->teamId);
     114  }
     115
     116}
     117
     118
     119/**
     120 * handler for setting the prefered team id
     121 * @param newTeamId: the new team id
     122 */
     123void PlayerStats::setPreferedTeamIdHandler( int newTeamId)
     124{
     125
     126  if( this->playable == NULL)
     127  {
     128    PRINTF(0)("could not set prefered team, since the playable is not yet set\n");
     129    return;
     130  }
     131
     132  this->playable->setTeam(newTeamId);
     133}
     134
     135
    110136
    111137/**
  • branches/proxy/src/lib/network/player_stats.h

    r9110 r9504  
    3030
    3131//! A class for storing player information
    32 class PlayerStats : public Synchronizeable 
     32class PlayerStats : public Synchronizeable
    3333{
    3434
     
    3737    PlayerStats( int userId );
    3838    virtual ~PlayerStats();
    39    
     39
    4040    virtual void varChangeHandler( std::list<int> & id );
    41    
     41
    4242    static PlayerStats * getStats( int userId );
    43    
     43
    4444    inline int getUserId(){ return userId; }
    45    
     45
    4646    inline int getTeamId(){ return teamId; }
    4747    inline void setTeamId( int teamId ){ this->teamId = teamId; }
    48    
     48
     49    void setPreferedTeamIdHandler( int newTeamId);
    4950    inline int getPreferedTeamId(){ return preferedTeamId; }
    50     inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
    51    
     51    inline void setPreferedTeamId( int preferedTeamId ) { this->preferedTeamId = preferedTeamId; }
     52
    5253    inline int getScore(){ return score; }
    5354    inline void setScore( int score ){ this->score = score; }
    54    
     55
    5556    inline int getPlayableClassId(){ return playableClassId; }
    5657    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
    57    
     58
    5859    inline int getPlayableUniqueId(){ return playableUniqueId; }
    5960    void setPlayableUniqueId( int uniqueId );
    60    
     61
    6162    inline std::string getModelFileName(){ return modelFileName; }
    6263    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
    63    
     64
    6465    Playable * getPlayable();
    65    
     66
    6667    inline std::string getNickName(){ return this->nickName; }
    6768    void setNickName( std::string nick );
    6869    static bool changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
    6970    void shellNick( const std::string&  newNick );
    70    
     71
    7172    static void deleteAllPlayerStats();
    72    
     73
    7374    static ScoreList getScoreList();
    7475
     
    9798    int modelFileName_handle;
    9899    int nickName_handler;
    99    
     100
    100101    void init();
    101102};
Note: See TracChangeset for help on using the changeset viewer.