Changeset 8120 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- Jun 2, 2006, 4:19:10 PM (18 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_game_manager.cc
r8097 r8120 161 161 { 162 162 if ( (*it)->isA(CL_PLAYABLE) ) 163 { 164 getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) ); 163 165 return true; 166 } 164 167 165 168 delete dynamic_cast<Synchronizeable*>(*it); … … 238 241 } 239 242 240 241 242 243 /** 244 * this function will be called periodically by networkManager 245 * @param ds time elapsed since last call of tick 246 */ 247 void NetworkGameManager::tick( float ds ) 248 { 249 //delete playables if they are not assigned to local player anymore 250 for ( std::list<Playable*>::iterator it = playablesToDelete.begin(); it != playablesToDelete.end(); ) 251 { 252 if ( State::getPlayer()->getPlayable() != *it ) 253 { 254 PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() ); 255 std::list<Playable*>::iterator delit = it; 256 it++; 257 delete *delit; 258 playablesToDelete.erase( delit ); 259 continue; 260 } 261 it++; 262 } 263 } 264 265 266 267 -
branches/network/src/lib/network/network_game_manager.h
r8096 r8120 12 12 /* include base_object.h since all classes are derived from this one */ 13 13 #include "synchronizeable.h" 14 #include "playable.h" 14 15 #include "message_manager.h" 15 16 … … 61 62 inline void setGameState( int gameState ){ this->gameState = gameState; } 62 63 inline int getGameState(){ return this->gameState; } 64 65 void tick( float ds ); 63 66 64 67 private: … … 73 76 74 77 int gameState; 78 79 std::list<Playable*> playablesToDelete; 75 80 }; 76 81 -
branches/network/src/lib/network/network_manager.cc
r7954 r8120 30 30 #include "preferences.h" 31 31 #include "network_log.h" 32 #include "network_game_manager.h" 32 33 33 34 … … 149 150 static_cast<NetworkStream*>(*stream)->processData(); 150 151 } 152 153 NetworkGameManager::getInstance()->tick( this->elapsedTime ); 151 154 } 152 155
Note: See TracChangeset
for help on using the changeset viewer.