Changeset 6498 in orxonox.OLD for trunk/src/story_entities/multi_player_world_data.cc
- Timestamp:
- Jan 11, 2006, 9:58:22 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/multi_player_world_data.cc
r6434 r6498 50 50 51 51 52 52 53 using namespace std; 53 54 … … 58 59 MultiPlayerWorldData::MultiPlayerWorldData() 59 60 : GameWorldData() 60 {} 61 { 62 this->toggle = false; 63 } 61 64 62 65 … … 157 160 } 158 161 } 159 /* clients only spawn the SpaceShip */160 /// FIXME it is not said to be a SpaceShip161 else if( !strcmp( element->Value(), "SpaceShip"))162 {163 BaseObject* created = Factory::fabricate(element);164 if( created != NULL )165 PRINTF(1)("Created a %s: %s (%8.u)\n", created->getClassName(), created->getName(), created->getLeafClassID());166 else167 PRINTF(1)("NetworkWorld: could not create this entity\n");168 }169 162 element = element->NextSiblingElement(); 163 170 164 171 165 glmis->step(); … … 173 167 } 174 168 175 176 /* create a Player */ 177 this->localPlayer = new Player(); 178 Playable* playable; 179 const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 180 if (playableList != NULL) 181 { 182 playable = dynamic_cast<Playable*>(playableList->front()); 183 this->localPlayer->setControllable(playable); 169 if( NetworkManager::getInstance()->isGameServer()) 170 { 171 this->localPlayer = new Player(); 172 State::setPlayer(this->localPlayer); 173 174 Playable* playable; 175 const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 176 assert( playableList != NULL); 177 178 if (playableList != NULL) 179 { 180 playable = dynamic_cast<Playable*>(playableList->front()); 181 this->localPlayer->setControllable(playable); 182 } 183 } 184 else 185 { 186 /* create a Player */ 187 this->localPlayer = new Player(); 188 State::setPlayer(this->localPlayer); 184 189 } 185 190 … … 221 226 } 222 227 228 229 /** 230 * some debug output 231 */ 232 void MultiPlayerWorldData::debug() 233 { 234 PRINT(0)("==================================================\n"); 235 Playable* playable; 236 const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 237 assert(playableList != NULL); 238 std::list<BaseObject*>::const_iterator entity; 239 240 241 242 for (entity = playableList->begin(); entity != playableList->end(); entity++) 243 { 244 Playable* p = dynamic_cast<Playable*>(*entity); 245 PRINTF(0)("Got a playable, class: %s, name: %s, uid: %i\n", (*entity)->getClassName(), (*entity)->getName(), p->getUniqueID()); 246 } 247 248 249 if( this->toggle) 250 { 251 playable = dynamic_cast<Playable*>(playableList->front()); 252 this->localPlayer->disconnectControllable(); 253 this->localPlayer->setControllable(playable); 254 this->toggle = !this->toggle; 255 } 256 else 257 { 258 playable = dynamic_cast<Playable*>(playableList->back()); 259 this->localPlayer->disconnectControllable(); 260 this->localPlayer->setControllable(playable); 261 this->toggle = !this->toggle; 262 } 263 264 265 266 PNode* cam = State::getCameraTarget(); 267 PRINT(0)("Camera has target - class: %s, name: %s, uid: %i\n", cam->getClassName(), cam->getName(), cam->getUniqueID()); 268 269 PRINT(0)("==================================================\n"); 270 271 } 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
Note: See TracChangeset
for help on using the changeset viewer.