Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 27, 2009, 4:13:13 AM (15 years ago)
Author:
landauf
Message:
  • The gametype pointer in BaseObject is now also a SmartPtr
  • The GametypeInfo object in Gametype is now a pointer instead of a member object to prevent double free (once deleted by the unloader and once when the gametype gets destroyed)
  • GSLevel sets the Gametype of all HumanPlayer objects to 0 because they don't get deleted and would prevent the Gametype from being destroyed.
  • Fixed a bug in HumanPlayer when Gametype is set to 0

Unloading seems to work with bots now.

Location:
code/branches/core5/src/modules
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/gamestates/GSLevel.cc

    r5805 r5806  
    5252#include "LevelManager.h"
    5353#include "PlayerManager.h"
     54#include "infos/HumanPlayer.h"
    5455
    5556namespace orxonox
     
    242243    void GSLevel::unloadLevel()
    243244    {
     245        for (ObjectList<HumanPlayer>::iterator it = ObjectList<HumanPlayer>::begin(); it; ++it)
     246            it->setGametype(0);
     247       
    244248        Loader::unload(startFile_s);
    245249
  • code/branches/core5/src/modules/objects/triggers/CheckPoint.cc

    r5738 r5806  
    8585        DistanceTrigger::triggered(bIsTriggered);
    8686
    87         Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype());
     87        Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype().get());
    8888        if (gametype)
    8989        {
  • code/branches/core5/src/modules/overlays/hud/TeamBaseMatchScore.cc

    r5738 r5806  
    118118
    119119        if (this->getOwner() && this->getOwner()->getGametype())
    120             this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
     120            this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype().get());
    121121        else
    122122            this->owner_ = 0;
  • code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.cc

    r5800 r5806  
    7878            this->owner_ = player;
    7979
    80             UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype());
     80            UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype().get());
    8181            if (ua)
    8282            {
  • code/branches/core5/src/modules/pong/Pong.cc

    r5800 r5806  
    158158
    159159            if (player)
    160                 this->gtinfo_.sendAnnounceMessage(player->getName() + " scored");
     160                this->gtinfo_->sendAnnounceMessage(player->getName() + " scored");
    161161        }
    162162
  • code/branches/core5/src/modules/pong/PongCenterpoint.cc

    r5738 r5806  
    7373        if (this->getGametype() && this->getGametype()->isA(Class(Pong)))
    7474        {
    75             Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype());
     75            Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype().get());
    7676            pong_gametype->setCenterpoint(this);
    7777        }
  • code/branches/core5/src/modules/pong/PongScore.cc

    r5738 r5806  
    133133
    134134        if (this->getOwner() && this->getOwner()->getGametype())
    135             this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype());
     135            this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get());
    136136        else
    137137            this->owner_ = 0;
Note: See TracChangeset for help on using the changeset viewer.