Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/BaseObject.cc

    r5929 r6417  
    3636#include <tinyxml/tinyxml.h>
    3737
    38 #include "util/StringUtils.h"
    3938#include "CoreIncludes.h"
    4039#include "Event.h"
     
    119118        XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
    120119        XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode);
    121        
     120
    122121        Element* events = 0;
    123122        if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject)
     
    139138        XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode);
    140139        XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode);
    141        
     140
    142141        this->bRegisteredEventStates_ = true;
    143142    }
     
    236235            if (it->second != state)
    237236                continue;
    238            
     237
    239238            if (i == index)
    240239                return it->first;
     
    252251        listener->addEventSource(this, "mainstate");
    253252    }
    254    
     253
    255254    /**
    256255        @brief Returns an event listener with a given index.
     
    278277        if (it != this->eventStates_.end())
    279278        {
    280             COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << "." << std::endl;
     279            COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl;
    281280            delete (it->second);
    282281        }
     
    292291        std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(name);
    293292        if (it != this->eventStates_.end())
    294             return ((*it).second);
     293            return (it->second);
    295294        else
    296295            return 0;
     
    344343    {
    345344        this->registerEventStates();
    346        
     345
    347346        std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_);
    348347        if (it != this->eventStates_.end())
    349348            it->second->process(event, this);
    350         else if (event.statename_ != "")
     349        else if (!event.statename_.empty())
    351350            COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
    352351        else
     
    356355    /**
    357356        @brief Sets the main state of the object to a given boolean value.
    358        
     357
    359358        Note: The main state of an object can be set with the @ref setMainStateName function.
    360359        It's part of the eventsystem and used for event forwarding (when the target object can't specify a specific state,
     
    386385        this->mainStateFunctor_ = 0;
    387386
    388         if (this->mainStateName_ != "")
     387        if (!this->mainStateName_.empty())
    389388        {
    390389            this->registerEventStates();
    391            
     390
    392391            std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_);
    393392            if (it != this->eventStates_.end() && it->second->getFunctor())
     
    402401        }
    403402    }
    404    
     403
    405404    /**
    406405        @brief Calls XMLEventPort with an empty XML-element to register the event states if necessary.
     
    414413        }
    415414    }
    416    
     415
    417416    /**
    418417        @brief Manually loads all event states, even if the class doesn't officially support them. This is needed by some classes like @ref EventDispatcher or @ref EventTarget.
     
    437436            for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
    438437            {
    439                 std::string statename = (*it);
     438                const std::string& statename = (*it);
    440439
    441440                // if the event state is already known, continue with the next state
     
    447446                if (!container)
    448447                {
    449                     ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + "(" + statename + ")");
    450                     ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + "(" + statename + ")");
     448                    ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')');
     449                    ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')');
    451450                    setfunctor->setDefaultValue(1, statename);
    452451                    getfunctor->setDefaultValue(1, statename);
Note: See TracChangeset for help on using the changeset viewer.