Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2009, 8:20:07 PM (15 years ago)
Author:
rgrieder
Message:

Merged core5 branch back to the trunk.
Key features include clean level unloading and an extended XML event system.

Two important notes:
Delete your keybindings.ini files! * or you will still get parser errors when loading the key bindings.
Delete build_dir/lib/modules/libgamestates.module! * or orxonox won't start.
Best thing to do is to delete the build folder ;)

Location:
code/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/overlays/hud/ChatOverlay.cc

    r5781 r5929  
    5858    ChatOverlay::~ChatOverlay()
    5959    {
     60        for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)
     61            delete (*it);
    6062    }
    6163
     
    8789        COUT(0) << "Chat: " << text << std::endl;
    8890
    89         new Timer<ChatOverlay>(this->displayTime_, false, this, createExecutor(createFunctor(&ChatOverlay::dropMessage)), true);
     91        Timer* timer = new Timer();
     92        this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor
     93        Executor* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));
     94        executor->setDefaultValues(timer);
     95        timer->setTimer(this->displayTime_, false, executor, true);
    9096
    9197        this->updateOverlayText();
    9298    }
    9399
    94     void ChatOverlay::dropMessage()
     100    void ChatOverlay::dropMessage(Timer* timer)
    95101    {
    96102        if (this->messages_.size() > 0)
    97103            this->messages_.pop_front();
    98104        this->updateOverlayText();
     105        this->timers_.erase(timer); // the timer destroys itself, but we have to remove it from the set
    99106    }
    100107
  • code/trunk/src/modules/overlays/hud/ChatOverlay.h

    r5781 r5929  
    5555        private:
    5656            void updateOverlayText();
    57             void dropMessage();
     57            void dropMessage(Timer* timer);
    5858
    5959            float displayTime_;
     60            std::set<Timer*> timers_;
    6061    };
    6162}
  • code/trunk/src/modules/overlays/hud/HUDBar.cc

    r5781 r5929  
    9696    {
    9797        if (this->isInitialized())
     98        {
    9899            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->bar_);
     100            for (std::vector<BarColour*>::const_iterator it = this->barColours_.begin(); it != this->barColours_.end(); )
     101                (*it++)->destroy();
     102        }
    99103    }
    100104
  • code/trunk/src/modules/overlays/hud/HUDHealthBar.cc

    r5781 r5929  
    5656    {
    5757        if (this->isInitialized())
    58             delete this->textoverlay_;
     58            this->textoverlay_->destroy();
    5959    }
    6060
     
    8484            this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
    8585            this->textoverlay_->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth())));
     86        }
     87        else
     88        {
     89            this->setValue(0);
     90            this->textoverlay_->setCaption("0");
    8691        }
    8792
  • code/trunk/src/modules/overlays/hud/HUDHealthBar.h

    r5781 r5929  
    111111
    112112        private:
    113             Pawn* owner_;
     113            WeakPtr<Pawn> owner_;
    114114            OverlayText* textoverlay_;
    115115            bool bUseBarColour_;
  • code/trunk/src/modules/overlays/hud/HUDNavigation.cc

    r5781 r5929  
    3939#include "core/CoreIncludes.h"
    4040#include "core/XMLPort.h"
     41#include "Scene.h"
    4142#include "Radar.h"
    4243
     
    130131        SUPER(HUDNavigation, tick, dt);
    131132
    132         if (!Radar::getInstance().getFocus())
     133        // Get radar
     134        Radar* radar = this->getOwner()->getScene()->getRadar();
     135
     136        if (!radar->getFocus())
    133137        {
    134138            this->overlay_->hide();
     
    150154*/
    151155        // transform to screen coordinates
    152         Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getRVWorldPosition();
     156        Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();
    153157
    154158        bool outOfView;
  • code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc

    r5781 r5929  
    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/trunk/src/modules/overlays/hud/UnderAttackHealthBar.cc

    r5781 r5929  
    5252        this->text_->setPickPoint(Vector2(0.5, 0));
    5353
    54         this->inittimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&UnderAttackHealthBar::init)));
     54        this->inittimer_.setTimer(0.0f, false, createExecutor(createFunctor(&UnderAttackHealthBar::init, this)));
    5555    }
    5656
     
    5858    {
    5959        if (this->isInitialized())
    60             delete this->text_;
     60            this->text_->destroy();
    6161    }
    6262
     
    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/trunk/src/modules/overlays/hud/UnderAttackHealthBar.h

    r5781 r5929  
    6262            PlayerInfo* owner_;
    6363            OverlayText* text_;
    64             Timer<UnderAttackHealthBar> inittimer_;
     64            Timer inittimer_;
    6565    };
    6666}
Note: See TracChangeset for help on using the changeset viewer.