Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7889 for code/trunk/src


Ignore:
Timestamp:
Feb 14, 2011, 8:24:00 PM (14 years ago)
Author:
landauf
Message:

hack-fix: overridden implementations of stopLocalHumanControl() were not called in multiplayer, which caused the "fire" command to not reset in Spectator

Location:
code/trunk/src/orxonox/worldentities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/worldentities/ControllableEntity.cc

    r7860 r7889  
    9696            this->bDestroyWhenPlayerLeft_ = false;
    9797
    98             if (this->bHasLocalController_ && this->bHasHumanController_)
    99                 this->stopLocalHumanControl();
    100 
    10198            if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
    10299                this->getPlayer()->stopControl();
     
    133130    {
    134131        SetConfigValue(mouseLookSpeed_, 3.0f);
     132    }
     133
     134    void ControllableEntity::preDestroy()
     135    {
     136        // HACK - solve this clean and without preDestroy hook for multiplayer where removePlayer() isn't called
     137        if (this->bHasLocalController_ && this->bHasHumanController_)
     138            this->stopLocalHumanControl();
    135139    }
    136140
  • code/trunk/src/orxonox/worldentities/ControllableEntity.h

    r7533 r7889  
    157157
    158158        protected:
     159            virtual void preDestroy();
     160
    159161            virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead
    160162            virtual void removePlayer();                // don't call this directly, use friend class PlayerInfo instead
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r7533 r7889  
    145145    }
    146146
     147    void Pawn::preDestroy()
     148    {
     149        // yay, multiple inheritance!
     150        this->ControllableEntity::preDestroy();
     151        this->PickupCarrier::preDestroy();
     152    }
     153
    147154    void Pawn::setPlayer(PlayerInfo* player)
    148155    {
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r7655 r7889  
    132132
    133133        protected:
     134            virtual void preDestroy();
     135
    134136            virtual void setPlayer(PlayerInfo* player);
    135137            virtual void removePlayer();
Note: See TracChangeset for help on using the changeset viewer.