Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8151


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
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/dockingsystem/data/levels/docking.oxw

    r8137 r8151  
    11<LevelInfo
    22 name = "Transporter"
    3  description = "Level with moving Transporter."
     3 description = "Level with a Transporter. Demostrates the docking system."
    44 tags = ""
    55/>
     
    1414<Level
    1515 name         = "Transporter"
    16  description  = "Level with Transporter :)"
     16 description  = "Docking example level"
    1717>
    1818  <templates>
     
    4848
    4949                <Dock>
     50                        <effects>
     51                                <DockToShip />
     52                        </effects>
    5053            <events>
    5154                <execute>
     
    5457            </events>
    5558            <attached>
    56                 <PlayerTrigger name="dockMe" /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
     59                <DistanceTrigger position="0,0,0" distance=2 target="ControllableEntity" name="dockMe" />
    5760            </attached>
    5861        </Dock>
  • 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.