Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2815


Ignore:
Timestamp:
Mar 21, 2009, 5:56:10 PM (15 years ago)
Author:
rgrieder
Message:

various small changes:

  • Fixed a bug in the GameStates concerning return type of virtual functions
  • Found some more C-style casts
Location:
code/branches/gui/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/ConfigFileManager.cc

    r2759 r2815  
    190190        this->bUpdated_ = true;
    191191
    192         return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryValue(name, fallback, bString)));
     192        return this->entries_.insert(this->entries_.end(), static_cast<ConfigFileEntry*>(new ConfigFileEntryValue(name, fallback, bString)));
    193193    }
    194194
     
    207207
    208208        if (index == 0)
    209             return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
    210         else
    211             return this->entries_.insert(++this->getEntryIterator(name, index - 1, "", bString), (ConfigFileEntry*)(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
     209            return this->entries_.insert(this->entries_.end(), static_cast<ConfigFileEntry*>(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
     210        else
     211            return this->entries_.insert(++this->getEntryIterator(name, index - 1, "", bString), static_cast<ConfigFileEntry*>(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
    212212    }
    213213
  • code/branches/gui/src/core/Core.cc

    r2807 r2815  
    401401            return;
    402402
     403#ifdef ORXONOX_PLATFORM_WINDOWS
    403404        unsigned int coreNr = limitToCPU - 1;
    404 #ifdef ORXONOX_PLATFORM_WINDOWS
    405405        // Get the current process core mask
    406406        DWORD procMask;
  • code/branches/gui/src/core/GameState.cc

    r1764 r2815  
    178178        this->allChildren_[grandchild->getName()] = grandchild;
    179179        this->grandchildrenToChildren_[grandchild] = child;
    180         if (this->getParent())
    181             this->getParent()->grandchildAdded(this, grandchild);
     180        if (this->getParentAsBase())
     181            this->getParentAsBase()->grandchildAdded(this, grandchild);
    182182    }
    183183
     
    196196        this->allChildren_.erase(grandchild->getName());
    197197        this->grandchildrenToChildren_.erase(grandchild);
    198         if (this->getParent())
    199             this->getParent()->grandchildRemoved(grandchild);
     198        if (this->getParentAsBase())
     199            this->getParentAsBase()->grandchildRemoved(grandchild);
    200200    }
    201201
     
    208208    GameStateBase* GameStateBase::getState(const std::string& name)
    209209    {
    210         if (this->getParent())
    211             return this->getParent()->getState(name);
     210        if (this->getParentAsBase())
     211            return this->getParentAsBase()->getState(name);
    212212        else
    213213        {
     
    227227    GameStateBase* GameStateBase::getRoot()
    228228    {
    229         if (this->getParent())
    230             return this->getParent()->getRoot();
     229        if (this->getParentAsBase())
     230            return this->getParentAsBase()->getRoot();
    231231        else
    232232            return this;
     
    251251        else
    252252        {
    253             if (this->getParent())
    254                 return this->getParent()->getCurrentState();
     253            if (this->getParentAsBase())
     254                return this->getParentAsBase()->getCurrentState();
    255255            else
    256256                return 0;
     
    288288    void GameStateBase::makeTransition(GameStateBase* source, GameStateBase* destination)
    289289    {
    290         if (source == this->getParent())
     290        if (source == this->getParentAsBase())
    291291        {
    292292            // call is from the parent
     
    319319        {
    320320            // parent. We can be sure of this.
    321             assert(this->getParent() != 0);
     321            assert(this->getParentAsBase() != 0);
    322322
    323323            this->deactivate();
    324             this->getParent()->makeTransition(this, destination);
     324            this->getParentAsBase()->makeTransition(this, destination);
    325325        }
    326326    }
  • code/branches/gui/src/core/GameState.h

    r2805 r2815  
    109109        void tickChild(const Clock& time) { if (this->getActiveChild()) this->getActiveChild()->tick(time); }
    110110
    111         virtual GameStateBase* getParent() const = 0;
     111        virtual GameStateBase* getParentAsBase() const = 0;
    112112        virtual void setParent(GameStateBase* state) = 0;
    113113
     
    146146        virtual ~GameState() { }
    147147
     148        GameStateBase* getParentAsBase() const
     149            { return parent_; }
     150
    148151        ParentType* getParent() const
    149152            { return parent_; }
  • code/branches/gui/src/core/Iterator.h

    r2784 r2815  
    181181                    this->list_->unregisterIterator(this);
    182182
    183                 this->element_ = (other.element_) ? (ObjectListBaseElement*)other.element_ : 0;
     183                this->element_ = (other.element_) ? static_cast<ObjectListBaseElement*>(other.element_) : 0;
    184184                this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
    185185                this->list_->registerIterator(this);
  • code/branches/gui/src/core/ObjectListBase.h

    r2784 r2815  
    7171    {
    7272        public:
    73             ObjectListElement(T* object) : ObjectListBaseElement((OrxonoxClass*)object), object_(object) {}
     73            ObjectListElement(T* object) : ObjectListBaseElement(static_cast<OrxonoxClass*>(object)), object_(object) {}
    7474            T* object_;              //!< The object
    7575    };
  • code/branches/gui/src/core/RootGameState.cc

    r2805 r2815  
    6969        if (it != this->grandchildrenToChildren_.end())
    7070        {
    71             OrxAssert(dynamic_cast<GameStateBase*>(it->second) != 0,
     71            OrxAssert(static_cast<GameStateBase*>(it->second) != 0,
    7272                "There was a mix with RootGameState and GameState, could not cast.");
    7373            GameStateBase* child = static_cast<GameStateBase*>(it->second);
  • code/branches/gui/src/core/Template.cc

    r2710 r2815  
    6565        if (element)
    6666        {
    67             TiXmlElement* tixmlelement = dynamic_cast<TiXmlElement*>(element->GetTiXmlPointer());
     67            TiXmlElement* tixmlelement = static_cast<TiXmlElement*>(element->GetTiXmlPointer());
    6868            if (tixmlelement)
    6969                this->setXMLElement(*tixmlelement);
     
    138138        COUT(4) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << std::endl;
    139139
    140         Element temp = ((TiXmlElement*)&this->getXMLElement());
     140        Element temp = &const_cast<TiXmlElement&>(this->getXMLElement());
    141141
    142142        if (this->bLoadDefaults_)
  • code/branches/gui/src/core/XMLPort.h

    r2710 r2815  
    556556                                                try
    557557                                                {
    558                                                     COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
     558                                                    COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
    559559
    560560                                                    BaseObject* newObject = identifier->fabricate((BaseObject*)object);
    561561                                                    assert(newObject);
    562                                                     newObject->setLoaderIndentation(((BaseObject*)object)->getLoaderIndentation() + "  ");
     562                                                    newObject->setLoaderIndentation(object->getLoaderIndentation() + "  ");
    563563
    564564                                                    O* castedObject = dynamic_cast<O*>(newObject);
     
    568568                                                    {
    569569                                                        newObject->XMLPort(*child, XMLPort::LoadObject);
    570                                                         COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
     570                                                        COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
    571571                                                    }
    572572                                                    else
    573573                                                    {
    574                                                         COUT(4) << ((BaseObject*)object)->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
     574                                                        COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
    575575                                                    }
    576576
    577                                                     COUT(5) << ((BaseObject*)object)->getLoaderIndentation();
     577                                                    COUT(5) << object->getLoaderIndentation();
    578578                                                    (*this->loadexecutor_)(object, castedObject);
    579579
     
    581581                                                        newObject->XMLPort(*child, XMLPort::LoadObject);
    582582
    583                                                     COUT(5) << ((BaseObject*)object)->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
     583                                                    COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
    584584                                                }
    585585                                                catch (AbortLoadingException& ex)
     
    601601                                        else
    602602                                        {
    603                                             COUT(2) << ((BaseObject*)object)->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not loadable." << std::endl;
     603                                            COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not loadable." << std::endl;
    604604                                        }
    605605                                    }
    606606                                    else
    607607                                    {
    608                                         COUT(2) << ((BaseObject*)object)->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << Class(O)->getName() << "'." << std::endl;
     608                                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << Class(O)->getName() << "'." << std::endl;
    609609                                    }
    610610                                }
     
    626626                    {
    627627                        COUT(1) << std::endl;
    628                         COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class(O)->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << ((BaseObject*)object)->getName() << ") in " << object->getFilename() << ":" << std::endl;
     628                        COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class(O)->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ":" << std::endl;
    629629                        COUT(1) << ex.what() << std::endl;
    630630                    }
  • code/branches/gui/src/core/input/InputBuffer.h

    r2800 r2815  
    127127                for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
    128128                {
    129                     InputBufferListenerTuple<T>* refListener = dynamic_cast<InputBufferListenerTuple<T>*>(*it);
     129                    InputBufferListenerTuple<T>* refListener = static_cast<InputBufferListenerTuple<T>*>(*it);
    130130                    if (refListener && refListener->listener_ == listener)
    131131                        this->listeners_.erase(it++);
  • code/branches/gui/src/orxonox/objects/EventTarget.cc

    r2662 r2815  
    6666    void EventTarget::addAsEvent(BaseObject* object)
    6767    {
    68         if (object != (BaseObject*)this)
     68        if (object != static_cast<BaseObject*>(this))
    6969            object->addEvent(this, "");
    7070    }
  • code/branches/gui/src/orxonox/objects/Radar.cc

    r2662 r2815  
    144144            for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
    145145            {
    146                 if (*it == (RadarViewable*)this->owner_)
     146                if (*it == static_cast<RadarViewable*>(this)->owner_)
    147147                    continue;
    148148
  • code/branches/gui/src/orxonox/objects/pickup/PickupSpawner.cc

    r2662 r2815  
    8989                ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive));
    9090                executor->setDefaultValues(true);
    91                 RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor);
     91                RespawnTimer_.setTimer(this->respawntimer_, false, this, executor);
    9292                COUT(0) << "TIMER SET" << std::endl;
    9393        }
  • code/branches/gui/src/orxonox/overlays/hud/HUDRadar.cc

    r2662 r2815  
    9494    void HUDRadar::displayObject(RadarViewable* object, bool bIsMarked)
    9595    {
    96         if (object == (RadarViewable*)this->owner_)
     96        if (object == static_cast<RadarViewable*>(this->owner_))
    9797            return;
    9898
Note: See TracChangeset for help on using the changeset viewer.