Changeset 8362 in orxonox.OLD for trunk/src/lib/network/player_stats.cc
- Timestamp:
- Jun 14, 2006, 10:08:41 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/player_stats.cc
r8228 r8362 23 23 #include "shared_network_data.h" 24 24 25 #include "debug.h" 26 25 27 26 28 CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS); … … 32 34 { 33 35 init(); 34 36 35 37 this->userId = userId; 36 38 } … … 54 56 this->playableClassId = 0; 55 57 this->modelFileName = ""; 56 58 57 59 userId_handle = registerVarId( new SynchronizeableInt( &userId, &userId, "userId" ) ); 58 60 teamId_handle = registerVarId( new SynchronizeableInt( &teamId, &teamId, "teamId" ) ); … … 62 64 playableUniqueId_handle = registerVarId( new SynchronizeableInt( &playableUniqueId, &playableUniqueId, "playableUniqueId" ) ); 63 65 modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) ); 64 66 65 67 PRINTF(0)("PlayerStats created\n"); 66 68 } … … 85 87 { 86 88 this->setPlayableUniqueId( this->playableUniqueId ); 87 89 88 90 PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID()); 89 91 } … … 98 100 { 99 101 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS ); 100 102 101 103 if ( !list ) 102 104 { 103 105 return NULL; 104 106 } 105 107 106 108 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 107 109 { … … 111 113 } 112 114 } 113 115 114 116 return NULL; 115 117 } … … 121 123 { 122 124 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE ); 123 125 124 126 if ( !list ) 125 127 { … … 127 129 return; 128 130 } 129 131 130 132 this->playable = NULL; 131 133 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) … … 139 141 } 140 142 } 141 143 142 144 if ( this->playable && userId == getHostID() ) 143 145 { 144 146 State::getPlayer()->setPlayable( this->playable ); 145 147 } 146 148 147 149 this->playableUniqueId = uniqueId; 148 150 } … … 156 158 if ( playable ) 157 159 return playable; 158 160 159 161 assert( playableUniqueId > 0 ); 160 162 161 163 setPlayableUniqueId( playableUniqueId ); 162 164 163 165 assert( playable ); 164 166 165 167 return playable; 166 168 }
Note: See TracChangeset
for help on using the changeset viewer.