Changeset 8151 for code/branches/dockingsystem/src
- Timestamp:
- Mar 28, 2011, 4:39:32 PM (14 years ago)
- 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 1 1 SET_SOURCE_FILES(DOCKING_SRC_FILES 2 DockingEffect.cc 3 DockToShip.cc 2 4 Dock.cc 3 5 ) -
code/branches/dockingsystem/src/modules/docking/Dock.cc
r8140 r8151 38 38 { 39 39 40 41 40 CreateFactory(Dock); 42 41 … … 56 55 SUPER(Dock, XMLPort, xmlelement, mode); 57 56 58 // TODO: Something similar to XMLPortObject(Dock, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode);57 XMLPortObject(Dock, DockingEffect, "effects", addEffect, getEffect, xmlelement, mode); 59 58 XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode); 60 59 … … 77 76 78 77 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 79 96 } -
code/branches/dockingsystem/src/modules/docking/Dock.h
r8140 r8151 41 41 42 42 #include "worldentities/StaticEntity.h" 43 #include "DockingEffect.h" 43 44 #include "DockingPrereqs.h" 44 45 … … 55 56 56 57 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. 57 64 }; 58 65 -
code/branches/dockingsystem/src/modules/docking/DockingPrereqs.h
r8140 r8151 66 66 { 67 67 class Dock; 68 class DockingEffect; 68 69 } 69 70
Note: See TracChangeset
for help on using the changeset viewer.