Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 14, 2008, 12:20:14 AM (16 years ago)
Author:
landauf
Message:

removed WorldEntity, SpaceShip and several other objects
removed SpaceShip-related hacks in network and other places

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/network/Server.cc

    r1907 r1916  
    4949#include "ClientInformation.h"
    5050#include "util/Sleep.h"
    51 #include "objects/SpaceShip.h"
    5251#include "core/ConsoleCommand.h"
    5352#include "core/CoreIncludes.h"
     
    101100    gamestates_ = new GamestateManager();
    102101  }
    103  
     102
    104103  /**
    105104  * @brief Destructor
     
    304303    COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
    305304    connection->syncClassid(temp->getID());
    306     COUT(5) << "creating spaceship for clientid: " << temp->getID() << std::endl;
    307     // TODO: this is only a hack, untill we have a possibility to define default player-join actions
    308     if(!createShip(temp))
    309       COUT(2) << "Con.Man. could not create ship for clientid: " << clientID << std::endl;
    310     else
    311       COUT(3) << "created spaceship" << std::endl;
    312305    temp->setSynched(true);
    313306    COUT(3) << "sending welcome" << std::endl;
     
    327320  }
    328321
    329   bool Server::createShip(ClientInformation *client){
    330     if(!client)
    331       return false;
    332     orxonox::Identifier* id = ClassByName("SpaceShip");
    333     if(!id){
    334       COUT(4) << "We could not create the SpaceShip for client: " << client->getID() << std::endl;
    335       return false;
    336     }
    337     orxonox::SpaceShip *no = dynamic_cast<orxonox::SpaceShip *>(id->fabricate());
    338     no->classID = id->getNetworkID();
    339     client->setShipID(no->getObjectID());
    340     no->setPosition(orxonox::Vector3(0,0,80));
    341     no->setScale(10);
    342     //no->setYawPitchRoll(orxonox::Degree(-90),orxonox::Degree(-90),orxonox::Degree(0));
    343     no->setMesh("assff.mesh");
    344     no->setMaxSpeed(500);
    345     no->setMaxSideAndBackSpeed(50);
    346     no->setMaxRotation(1.0);
    347     no->setTransAcc(200);
    348     no->setRotAcc(3.0);
    349     no->setTransDamp(75);
    350     no->setRotDamp(1.0);
    351     no->setCamera(std::string("cam_") + convertToString(client->getID()));
    352     no->create();
    353 
    354     return true;
    355   }
    356 
    357322  bool Server::disconnectClient(ENetEvent *event){
    358323    COUT(4) << "removing client from list" << std::endl;
     
    360325
    361326    //boost::recursive_mutex::scoped_lock lock(head_->mutex_);
    362     orxonox::ObjectList<orxonox::SpaceShip>::iterator it = orxonox::ObjectList<orxonox::SpaceShip>::begin();
    363327    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
    364328    if(!client)
    365329      return false;
    366330    gamestates_->removeClient(client);
    367     while(it){
    368       if(it->getObjectID()!=client->getShipID()){
    369         ++it;
    370         continue;
    371       }
    372       orxonox::ObjectList<orxonox::SpaceShip>::iterator temp=it;
    373       ++it;
    374       delete  *temp;
    375       return ClientInformation::removeClient(event->peer);
    376     }
    377     return false;
     331    return ClientInformation::removeClient(event->peer);
    378332  }
    379333
     
    387341    gamestates_->removeClient(client);
    388342  }
    389  
     343
    390344  bool Server::chat(std::string message){
    391345    ClientInformation *temp = ClientInformation::getBegin();
Note: See TracChangeset for help on using the changeset viewer.