Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 7, 2008, 5:03:10 PM (16 years ago)
Author:
scheusso
Message:

network branch merged into trunk

Location:
code/trunk/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/Orxonox.cc

    r1625 r1735  
    138138    GraphicsEngine::getSingleton().destroy();
    139139
    140     if (network::Client::getSingleton())
    141       network::Client::destroySingleton();
     140    if (client_g)
     141      delete client_g;
    142142    if (server_g)
    143       delete network::Server::getSingleton();
     143      delete server_g;
    144144  }
    145145
     
    363363    COUT(0) << "Loading level in server mode" << std::endl;
    364364
    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;
    368367    if (!loadScene())
    369368      return false;
     
    382381
    383382    if (serverIp_.compare("") == 0)
    384       client_g = network::Client::createSingleton();
     383      client_g = new network::Client();
    385384    else
    386385
    387       client_g = network::Client::createSingleton(serverIp_, serverPort_);
     386      client_g = new network::Client(serverIp_, serverPort_);
    388387
    389388    if(!client_g->establishConnection())
     
    525524
    526525    if (mode_ == CLIENT)
    527       network::Client::getSingleton()->closeConnection();
     526      client_g->closeConnection();
    528527    else if (mode_ == SERVER)
    529528      server_g->close();
  • code/trunk/src/orxonox/objects/Ambient.h

    r1625 r1735  
    3838namespace orxonox
    3939{
    40     class _OrxonoxExport Ambient : public BaseObject, network::Synchronisable
     40    class _OrxonoxExport Ambient : public BaseObject, public network::Synchronisable
    4141    {
    4242        public:
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1625 r1735  
    4343#include "core/XMLPort.h"
    4444#include "core/ConsoleCommand.h"
    45 
    46 #include "network/Client.h"
     45#include "network/Host.h"
    4746
    4847#include "tools/ParticleInterface.h"
     
    8079          return *it;
    8180      }
    82       return NULL;
     81      return 0;
    8382    }
    8483
     
    165164    bool SpaceShip::create(){
    166165      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())
    168169          myShip_=true;
    169170        else
    170171          this->setRadarObjectColour(this->getProjectileColour());
    171172      }
    172       if(Model::create())
    173         this->init();
    174       else
    175         return false;
     173      assert(Model::create());
     174      this->init();
    176175      return true;
    177176    }
     
    276275            // END of testing crosshair
    277276        }
     277        // END of testing crosshair
    278278
    279279        createCamera();
     
    320320    void SpaceShip::setCamera(const std::string& camera)
    321321    {
    322       myShip_=true; // TODO: this is only a hack
    323322      camName_=camera;
    324323      // change camera attributes here, if you want to ;)
     
    326325
    327326    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_)
    330330        CameraHandler::getInstance()->requestFocus(cam_);
    331331
     
    339339//       COUT(4) << "begin camera creation" << std::endl;
    340340      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;
    342342      this->camNode_->setPosition(Vector3(-25,0,5));
    343343//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
     
    349349      cam_->setTargetNode(this->getNode());
    350350//        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));
    351353      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
    352354      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;
    355360        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;
    358369    }
    359370
     
    392403        XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);
    393404
     405        myShip_=true; //TODO: this is a hack
    394406        SpaceShip::create();
    395         if (this->isExactlyA(Class(SpaceShip)))
    396             getFocus();
     407        /*if (this->isExactlyA(Class(SpaceShip)))
     408            getFocus();*/
    397409    }
    398410
Note: See TracChangeset for help on using the changeset viewer.