Changeset 5890 for code/branches/core5
- Timestamp:
- Oct 6, 2009, 5:29:39 AM (15 years ago)
- Location:
- code/branches/core5
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/data/levels/events.oxw
r5883 r5890 96 96 <Billboard name="bb3" position="100,150,0" material="Examples/Flare" colour="1.0, 1.0, 1.0" visible=0 /> 97 97 <Billboard name="bb3" position="100,150,100" material="Examples/Flare" colour="1.0, 1.0, 1.0" visible=0 /> 98 <EventTarget name="bb3">98 <EventTarget target="bb3"> 99 99 <events> 100 100 <visibility> … … 144 144 <EventDispatcher> 145 145 <targets> 146 <EventTarget name="bb5" />146 <EventTarget target="bb5" /> 147 147 </targets> 148 148 <events> -
code/branches/core5/data/levels/old/physicstest2.oxw
r5700 r5890 243 243 <!--EventDispatcher> 244 244 <targets> 245 <EventTarget name=fireright />246 <EventTarget name=firecenter />247 <EventTarget name=fireleft />245 <EventTarget target=fireright /> 246 <EventTarget target=firecenter /> 247 <EventTarget target=fireleft /> 248 248 </targets> 249 249 <events> -
code/branches/core5/data/levels/old/princessaeryn.oxw
r5700 r5890 264 264 <EventDispatcher> 265 265 <targets> 266 <EventTarget name=trail />266 <EventTarget target=trail /> 267 267 </targets> 268 268 <events> -
code/branches/core5/data/levels/old/sample4.oxw
r5700 r5890 123 123 <EventDispatcher> 124 124 <targets> 125 <EventTarget name=fireright />126 <EventTarget name=firecenter />127 <EventTarget name=fireleft />125 <EventTarget target=fireright /> 126 <EventTarget target=firecenter /> 127 <EventTarget target=fireleft /> 128 128 </targets> 129 129 <events> -
code/branches/core5/data/levels/presentation.oxw
r5695 r5890 151 151 <EventDispatcher> 152 152 <targets> 153 <EventTarget name=fireright />154 <EventTarget name=firecenter />155 <EventTarget name=fireleft />153 <EventTarget target=fireright /> 154 <EventTarget target=firecenter /> 155 <EventTarget target=fireleft /> 156 156 </targets> 157 157 <events> -
code/branches/core5/data/levels/presentation09b.oxw
r5738 r5890 111 111 <EventDispatcher> 112 112 <targets> 113 <EventTarget name=pirates />113 <EventTarget target=pirates /> 114 114 </targets> 115 115 <events> … … 163 163 <EventDispatcher> 164 164 <targets> 165 <EventTarget name=attacker />165 <EventTarget target=attacker /> 166 166 </targets> 167 167 <events> -
code/branches/core5/data/levels/princessaeryn.oxw
r5803 r5890 227 227 <EventDispatcher> 228 228 <targets> 229 <EventTarget name=trail />229 <EventTarget target=trail /> 230 230 </targets> 231 231 <events> -
code/branches/core5/src/modules/objects/eventsystem/EventTarget.cc
r5887 r5890 38 38 { 39 39 RegisterObject(EventTarget); 40 41 this->bActive_ = false; 40 42 } 41 43 … … 48 50 SUPER(EventTarget, XMLPort, xmlelement, mode); 49 51 52 XMLPortParam(EventTarget, "target", setTargetName, getTargetName, xmlelement, mode); 53 50 54 // since we need event sources mapped to any state, we have to parse XML by ourselves 51 55 this->loadAllEventStates(xmlelement, mode, this, Class(EventTarget)); … … 54 58 void EventTarget::processEvent(Event& event) 55 59 { 60 if (this->bActive_) 61 { 62 COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << "\"" << std::endl; 63 return; 64 } 65 66 this->bActive_ = true; 56 67 this->fireEvent(event); 68 this->bActive_ = false; 57 69 } 58 70 59 void EventTarget:: changedName()71 void EventTarget::setTargetName(const std::string& name) 60 72 { 61 SUPER(EventTarget, changedName);62 73 this->target_ = name; 74 63 75 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it) 64 if (it->getName() == this-> getName())76 if (it->getName() == this->target_) 65 77 this->addEventTarget(*it); 66 78 } … … 68 80 void EventTarget::loadedNewXMLName(BaseObject* object) 69 81 { 70 if (this-> getName()== "")82 if (this->target_ == "") 71 83 return; 72 84 73 if (object->getName() == this-> getName())85 if (object->getName() == this->target_) 74 86 this->addEventTarget(object); 75 87 } -
code/branches/core5/src/modules/objects/eventsystem/EventTarget.h
r5887 r5890 47 47 virtual void processEvent(Event& event); 48 48 49 virtual void changedName(); 49 void setTargetName(const std::string& name); 50 inline const std::string& getTargetName() const 51 { return this->target_; } 50 52 51 53 private: 52 54 virtual void loadedNewXMLName(BaseObject* object); 53 55 void addEventTarget(BaseObject* object); 56 57 std::string target_; 58 bool bActive_; 54 59 }; 55 60 }
Note: See TracChangeset
for help on using the changeset viewer.