Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2011, 8:53:14 PM (13 years ago)
Author:
scheusso
Message:

some network related fixes

Location:
code/branches/presentation/src
Files:
7 edited

Legend:

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

    r8351 r8648  
    413413   
    414414    COUT(4) << "sending welcome" << std::endl;
    415     packet::Welcome *w = new packet::Welcome(clientID, OBJECTID_UNKNOWN);
     415    packet::Welcome *w = new packet::Welcome(clientID);
    416416    w->setPeerID(clientID);
    417417    b = w->send( static_cast<Host*>(this) );
  • code/branches/presentation/src/libraries/network/packet/Welcome.cc

    r7801 r8648  
    4444#define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
    4545
    46   Welcome::Welcome( uint32_t clientID, uint32_t shipID )
     46  Welcome::Welcome( uint32_t clientID )
    4747 : Packet()
    4848{
  • code/branches/presentation/src/libraries/network/packet/Welcome.h

    r7801 r8648  
    4141{
    4242public:
    43   Welcome( uint32_t clientID, uint32_t shipID );
     43  Welcome( uint32_t clientID );
    4444  Welcome( uint8_t* data, uint32_t clientID );
    4545  virtual ~Welcome();
  • code/branches/presentation/src/orxonox/infos/GametypeInfo.cc

    r8639 r8648  
    342342        if(GameMode::isMaster())
    343343        {
    344             // Display "Press [Fire] to start the match" if the game has not yet ended.
    345             if(!this->hasEnded())
    346                 NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
    347             // Else display "Game has ended".
    348             else
    349                 NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     344            if( player->isHumanPlayer() )
     345            {
     346                // Display "Press [Fire] to start the match" if the game has not yet ended.
     347                if(!this->hasEnded())
     348                    NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     349                // Else display "Game has ended".
     350                else
     351                    NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     352            }
    350353        }
    351354    }
  • code/branches/presentation/src/orxonox/items/Engine.cc

    r8589 r8648  
    7272    Engine::~Engine()
    7373    {
    74 
     74        if( this->ship_ && this->ship_->hasEngine(this) )
     75            this->ship_->removeEngine(this);
    7576    }
    7677
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8607 r8648  
    374374    void SpaceShip::removeAllEngines()
    375375    {
    376         for(unsigned int i=0; i<this->engineList_.size(); i++)
    377             this->engineList_[i]->destroy();
     376        while(this->engineList_.size())
     377            this->engineList_.back()->destroy();
     378    }
     379   
     380    void SpaceShip::removeEngine(Engine* engine)
     381    {
     382        for(std::vector<Engine*>::iterator it=this->engineList_.begin(); it!=this->engineList_.end(); ++it)
     383        {
     384            if(*it==engine)
     385            {
     386                this->engineList_.erase(it);
     387                return;
     388            }
     389        }
    378390    }
    379391
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.h

    r8597 r8648  
    6666            inline const std::vector<Engine*>& getEngineList()
    6767                { return this->engineList_; }
     68            void removeEngine(Engine* engine);
    6869            void removeAllEngines();
    6970
Note: See TracChangeset for help on using the changeset viewer.