Changeset 1735 for code/trunk/src/orxonox
- Timestamp:
- Sep 7, 2008, 5:03:10 PM (16 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/Orxonox.cc
r1625 r1735 138 138 GraphicsEngine::getSingleton().destroy(); 139 139 140 if ( network::Client::getSingleton())141 network::Client::destroySingleton();140 if (client_g) 141 delete client_g; 142 142 if (server_g) 143 delete network::Server::getSingleton();143 delete server_g; 144 144 } 145 145 … … 363 363 COUT(0) << "Loading level in server mode" << std::endl; 364 364 365 //server_g = new network::Server(serverPort_); 366 server_g = network::Server::createSingleton(serverPort_); 367 365 server_g = new network::Server(serverPort_); 366 COUT(0) << "Loading scene in server mode" << std::endl; 368 367 if (!loadScene()) 369 368 return false; … … 382 381 383 382 if (serverIp_.compare("") == 0) 384 client_g = ne twork::Client::createSingleton();383 client_g = new network::Client(); 385 384 else 386 385 387 client_g = ne twork::Client::createSingleton(serverIp_, serverPort_);386 client_g = new network::Client(serverIp_, serverPort_); 388 387 389 388 if(!client_g->establishConnection()) … … 525 524 526 525 if (mode_ == CLIENT) 527 network::Client::getSingleton()->closeConnection();526 client_g->closeConnection(); 528 527 else if (mode_ == SERVER) 529 528 server_g->close(); -
code/trunk/src/orxonox/objects/Ambient.h
r1625 r1735 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport Ambient : public BaseObject, network::Synchronisable40 class _OrxonoxExport Ambient : public BaseObject, public network::Synchronisable 41 41 { 42 42 public: -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1625 r1735 43 43 #include "core/XMLPort.h" 44 44 #include "core/ConsoleCommand.h" 45 46 #include "network/Client.h" 45 #include "network/Host.h" 47 46 48 47 #include "tools/ParticleInterface.h" … … 80 79 return *it; 81 80 } 82 return NULL;81 return 0; 83 82 } 84 83 … … 165 164 bool SpaceShip::create(){ 166 165 if(!myShip_){ 167 if(network::Client::getSingleton() && objectID == network::Client::getSingleton()->getShipID()) 166 if(network::Host::running()) 167 COUT(3) << "this id: " << this->objectID << " myShipID: " << network::Host::getShipID() << std::endl; 168 if(network::Host::running() && objectID == network::Host::getShipID()) 168 169 myShip_=true; 169 170 else 170 171 this->setRadarObjectColour(this->getProjectileColour()); 171 172 } 172 if(Model::create()) 173 this->init(); 174 else 175 return false; 173 assert(Model::create()); 174 this->init(); 176 175 return true; 177 176 } … … 276 275 // END of testing crosshair 277 276 } 277 // END of testing crosshair 278 278 279 279 createCamera(); … … 320 320 void SpaceShip::setCamera(const std::string& camera) 321 321 { 322 myShip_=true; // TODO: this is only a hack323 322 camName_=camera; 324 323 // change camera attributes here, if you want to ;) … … 326 325 327 326 void SpaceShip::getFocus(){ 328 COUT(4) << "requesting focus" << std::endl; 329 if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) 327 COUT(3) << "requesting focus" << std::endl; 328 //if(!network::Host::running() || network::Host::getShipID()==objectID) 329 if(myShip_) 330 330 CameraHandler::getInstance()->requestFocus(cam_); 331 331 … … 339 339 // COUT(4) << "begin camera creation" << std::endl; 340 340 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 341 COUT( 4) << "position: (this)" << this->getNode()->getPosition() << std::endl;341 COUT(3) << "position: (this)" << this->getNode()->getPosition() << std::endl; 342 342 this->camNode_->setPosition(Vector3(-25,0,5)); 343 343 // Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); … … 349 349 cam_->setTargetNode(this->getNode()); 350 350 // cam->setPosition(Vector3(0,-350,0)); 351 // Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,0,1)); 352 // Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,1,0)); 351 353 Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); 352 354 Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0)); 353 this->camNode_->setOrientation(q2*q1); 354 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 355 356 this->camNode_->setOrientation(q2*q1); 357 //if(!network::Host::running() || network::Host::getShipID()==objectID){ //TODO: check this 358 if(myShip_){ 359 COUT(3) << "requesting focus for camera" << std::endl; 355 360 this->setBacksync(true); 356 CameraHandler::getInstance()->requestFocus(cam_); 357 } 361 //CameraHandler::getInstance()->requestFocus(cam_); 362 if(this->isExactlyA(Class(SpaceShip))){ 363 getFocus(); 364 COUT(3) << "getting focus for obj id: " << objectID << std::endl; 365 }else 366 COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl; 367 }else 368 COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl; 358 369 } 359 370 … … 392 403 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 393 404 405 myShip_=true; //TODO: this is a hack 394 406 SpaceShip::create(); 395 if (this->isExactlyA(Class(SpaceShip)))396 getFocus(); 407 /*if (this->isExactlyA(Class(SpaceShip))) 408 getFocus();*/ 397 409 } 398 410
Note: See TracChangeset
for help on using the changeset viewer.