- Timestamp:
- Dec 18, 2004, 5:14:08 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/command_node.cc
r3215 r3216 20 20 #include "world_entity.h" 21 21 #include "game_loader.h" 22 #include "world.h" 22 23 23 24 #include <stdio.h> … … 38 39 this->bLocalInput = false; 39 40 this->bEnabled = true; 41 this->world = NULL; 40 42 } 41 43 … … 51 53 this->bound = new tList<WorldEntity>(); 52 54 this->bEnabled = true; 55 this->world = NULL; 53 56 this->load_bindings (filename); 54 57 } … … 78 81 //this->bound = NULL; /* \todo this produces a NULLpointer error.. FIX */ 79 82 this->bEnabled = false; 83 this->world = NULL; 80 84 } 81 85 … … 84 88 this->bEnabled = bEnabled; 85 89 } 90 91 92 /** 93 \brief adds Node to a GameWorld 94 95 this is usefull, if you want to catch events in a world class. usualy 96 this is done automaticaly via GameLoader. Reset it via 97 CommandNode::reset() 98 99 */ 100 void CommandNode::addToWorld(World* world) 101 { 102 this->world = world; 103 } 104 86 105 87 106 /** … … 251 270 Orxonox *orx = Orxonox::getInstance(); 252 271 if( orx->system_command (cmd)) return; 272 253 273 GameLoader* gl = GameLoader::getInstance(); 254 if( gl->worldCommand(cmd)) return;255 274 if( gl->worldCommand(cmd)) return; 275 256 276 if( bLocalInput) send_over_network (cmd); 257 277 278 if( this->world->command(cmd)) return; 279 258 280 WorldEntity* entity = bound->enumerate(); 259 while( 281 while( entity != NULL) 260 282 { 261 283 entity->command (cmd); -
orxonox/trunk/src/command_node.h
r3214 r3216 12 12 13 13 class WorldEntity; 14 class World; 14 15 15 16 #define N_STD_KEYS SDLK_LAST … … 44 45 tList<WorldEntity>* bound; //!< List of WorldEntites that recieve commands from this CommandNode 45 46 Sint32 coord[2]; 47 World* world; 46 48 47 49 … … 62 64 void bind (WorldEntity* entity); 63 65 void unbind (WorldEntity* entity); 66 void addToWorld(World* world); 64 67 void process (); 65 68 -
orxonox/trunk/src/orxonox.cc
r3215 r3216 269 269 bool Orxonox::system_command (Command* cmd) 270 270 { 271 271 272 if( !strcmp( cmd->cmd, "quit")) 272 273 { … … 275 276 } 276 277 return false; 278 277 279 } 278 280 -
orxonox/trunk/src/world.cc
r3215 r3216 64 64 { 65 65 this->bPause = false; 66 Orxonox::getInstance()->get_localinput()->enable(true); 66 CommandNode* cn = Orxonox::getInstance()->get_localinput(); 67 cn->addToWorld(this); 68 cn->enable(true); 67 69 } 68 70 … … 78 80 this->localPlayer->destroy(); 79 81 this->localCamera->destroy(); 80 81 82 82 83 WorldEntity* entity = entities->enumerate(); … … 610 611 { 611 612 // localinput 612 Orxonox::getInstance()->get_localinput()->process(); 613 CommandNode* cn = Orxonox::getInstance()->get_localinput(); 614 cn->process(); 613 615 // remoteinput 614 616 } … … 643 645 } 644 646 647 645 648 /** 646 649 \brief compute collision detection … … 651 654 } 652 655 653 /**654 \brief handle keyboard commands that are not meant for WorldEntities655 \param cmd: the command to handle656 \return true if the command was handled by the system or false if it may be passed to the WorldEntities657 */658 bool World::system_command (Command* cmd)659 {660 if( !strcmp( cmd->cmd, "quit"))661 {662 if( !cmd->bUp) this->bQuitOrxonox = true;663 {664 printf("World::system_command() - rescv quit command\n");665 return true;666 }667 }668 return false;669 }670 656 671 657 /** … … 750 736 //return entity; 751 737 } 738 739 740 bool World::command(Command* cmd) 741 { 742 if( !strcmp( cmd->cmd, "quit")) 743 { 744 if( !cmd->bUp) this->stop(); 745 return true; 746 } 747 return false; 748 } -
orxonox/trunk/src/world.h
r2822 r3216 44 44 45 45 void unload (); 46 bool command(Command* cmd); 46 47 47 48 void setTrackLen(Uint32 tracklen); 48 49 int getTrackLen(); 49 bool system_command (Command* cmd);50 //bool system_command (Command* cmd); 50 51 Camera* getCamera(); 51 52
Note: See TracChangeset
for help on using the changeset viewer.