Changeset 10575 for code/branches/core7/src/orxonox
- Timestamp:
- Sep 9, 2015, 2:02:01 PM (9 years ago)
- Location:
- code/branches/core7/src/orxonox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/orxonox/Level.cc
r10573 r10575 122 122 123 123 Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this)); 124 124 125 rootgametype->setLevel(NULL); // avoid circular references 125 126 this->setGametype(rootgametype); 127 rootgametype->init(); // call init() AFTER the gametype was set 126 128 127 129 if (LevelManager::exists()) -
code/branches/core7/src/orxonox/gametypes/Gametype.cc
r10555 r10575 64 64 65 65 this->gtinfo_ = new GametypeInfo(context); 66 this->gtinfo_->setGametype(this);67 66 68 67 this->defaultControllableEntity_ = Class(Spectator); 68 this->scoreboard_ = 0; 69 69 70 70 this->bAutoStart_ = false; … … 81 81 this->setConfigValues(); 82 82 83 ModifyConsoleCommand(__CC_addBots_name).setObject(this); 84 ModifyConsoleCommand(__CC_killBots_name).setObject(this); 85 } 86 87 Gametype::~Gametype() 88 { 89 if (this->isInitialized()) 90 { 91 if (this->gtinfo_) 92 this->gtinfo_->destroy(); 93 94 ModifyConsoleCommand(__CC_addBots_name).setObject(NULL); 95 ModifyConsoleCommand(__CC_killBots_name).setObject(NULL); 96 } 97 } 98 99 /** 100 * @brief Initializes sub-objects of the Gametype. This must be called after the constructor. 101 * At this point, the context is expected to have the current gametype. This allows to pass the current gametype to the sub-objects via constructor. 102 */ 103 void Gametype::init() 104 { 83 105 // load the corresponding score board 84 106 if (GameMode::showsGraphics() && !this->scoreboardTemplate_.empty()) 85 107 { 86 this->scoreboard_ = new OverlayGroup( context);108 this->scoreboard_ = new OverlayGroup(this->getContext()); 87 109 this->scoreboard_->addTemplate(this->scoreboardTemplate_); 88 this->scoreboard_->setGametype(this);89 }90 else91 this->scoreboard_ = 0;92 93 ModifyConsoleCommand(__CC_addBots_name).setObject(this);94 ModifyConsoleCommand(__CC_killBots_name).setObject(this);95 }96 97 Gametype::~Gametype()98 {99 if (this->isInitialized())100 {101 if (this->gtinfo_)102 this->gtinfo_->destroy();103 104 ModifyConsoleCommand(__CC_addBots_name).setObject(NULL);105 ModifyConsoleCommand(__CC_killBots_name).setObject(NULL);106 110 } 107 111 } -
code/branches/core7/src/orxonox/gametypes/Gametype.h
r10554 r10575 72 72 virtual ~Gametype(); 73 73 74 virtual void init(); 75 74 76 void setConfigValues(); 75 77 -
code/branches/core7/src/orxonox/overlays/OverlayGroup.cc
r10571 r10575 149 149 for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 150 150 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed 151 }152 153 //! Changes the gametype of all elements154 void OverlayGroup::changedGametype()155 {156 SUPER( OverlayGroup, changedGametype );157 158 for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)159 (*it)->setGametype(this->getGametype());160 151 } 161 152 -
code/branches/core7/src/orxonox/overlays/OverlayGroup.h
r10555 r10575 69 69 70 70 virtual void changedVisibility(); 71 virtual void changedGametype();72 71 73 72 void setOwner(BaseObject* owner);
Note: See TracChangeset
for help on using the changeset viewer.