Changeset 6222 in orxonox.OLD for trunk/src/world_entities/player.cc
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.in
Makefile
configure
*.kdevelop
Doxyfile
config.log
config.h
config.status
stamp-h1
autom4te.cache
aclocal.m4
-
Property
svn:ignore
set to
-
trunk/src
-
Property
svn:ignore
set to
.deps
orxonox
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/src/world_entities/player.cc
r5915 r6222 19 19 #include "event_handler.h" 20 20 21 22 #include "class_list.h" 23 #include "state.h" 24 21 25 using namespace std; 22 26 … … 28 32 { 29 33 this->init(); 34 35 EventHandler::getInstance()->subscribe(this, ES_GAME, SDLK_l); 30 36 } 31 37 … … 79 85 void Player::process(const Event &event) 80 86 { 87 if (event.type == SDLK_l && event.bPressed) 88 { 89 /// FIXME this should be in the ObjectManager 90 const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE); 91 if (objectList != NULL) 92 { 93 list<BaseObject*>::const_iterator node; 94 for (node = objectList->begin(); node != objectList->end(); node++) 95 if (this->controllable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->controllable->getAbsCoor()).len() < 10.0) 96 { 97 this->controllable->leave(); 98 this->disconnectControllable(); 99 this->setControllable(dynamic_cast<Playable*>(*node)); 100 this->controllable->enter(); 101 State::getCamera()->setParentSoft(this->controllable); 102 State::getCameraTarget()->setParentSoft(this->controllable); 103 104 break; 105 } 106 } 107 } 108 81 109 if (likely(this->controllable != NULL)) 82 110 this->controllable->process(event);
Note: See TracChangeset
for help on using the changeset viewer.