Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 28, 2011, 4:39:32 PM (14 years ago)
Author:
sven
Message:

XML support for different DockingEffects added, DockingEffect base class created

Location:
code/branches/dockingsystem/src/modules/docking
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/dockingsystem/src/modules/docking/CMakeLists.txt

    r8137 r8151  
    11SET_SOURCE_FILES(DOCKING_SRC_FILES
     2  DockingEffect.cc
     3  DockToShip.cc
    24  Dock.cc
    35)
  • code/branches/dockingsystem/src/modules/docking/Dock.cc

    r8140 r8151  
    3838{
    3939
    40 
    4140        CreateFactory(Dock);
    4241
     
    5655        SUPER(Dock, XMLPort, xmlelement, mode);
    5756
    58         // TODO: Something similar to XMLPortObject(Dock, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode);
     57        XMLPortObject(Dock, DockingEffect, "effects", addEffect, getEffect, xmlelement, mode);
    5958        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
    6059
     
    7776
    7877
     78        bool Dock::addEffect(DockingEffect* effect) {
     79                assert(effect);
     80                effects_.push_back(effect);
     81                return true;
     82        }
     83   
     84        const DockingEffect* Dock::getEffect(unsigned int index) const {
     85                int i = index;
     86        for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
     87        {
     88            if(i == 0)
     89               return *effect;
     90
     91            i--;
     92        }
     93        return NULL;
     94        }
     95
    7996}
  • code/branches/dockingsystem/src/modules/docking/Dock.h

    r8140 r8151  
    4141
    4242#include "worldentities/StaticEntity.h"
     43#include "DockingEffect.h"
    4344#include "DockingPrereqs.h"
    4445
     
    5556
    5657        bool execute(bool bTriggered, BaseObject* trigger);
     58
     59        private:
     60                std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks.
     61
     62        bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock.
     63        const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index.
    5764        };
    5865
  • code/branches/dockingsystem/src/modules/docking/DockingPrereqs.h

    r8140 r8151  
    6666{
    6767    class Dock;
     68        class DockingEffect;
    6869}
    6970
Note: See TracChangeset for help on using the changeset viewer.