bool SoccerBase::GetGameControlServer(const Leaf& base, boost::shared_ptr<GameControlServer> & game_control_server) { static boost::shared_ptr<GameControlServer> gameControlServer; if (gameControlServer.get() == 0) { gameControlServer = shared_dynamic_cast<GameControlServer> (base.GetCore()->Get("/sys/server/gamecontrol")); if (gameControlServer.get() == 0) { base.GetLog()->Error() << "Error: (SoccerBase: " << base.GetName() << " found no GameControlServer\n"; return false; } } game_control_server = gameControlServer; return true; }
bool SoccerBase::GetSceneServer(const Leaf& base, boost::shared_ptr<SceneServer>& scene_server) { scene_server = shared_static_cast<SceneServer> (base.GetCore()->Get("/sys/server/scene")); if (scene_server.get() == 0) { base.GetLog()->Error() << "Error: (SoccerBase: " << base.GetName() << ") scene server not found.\n"; return false; } return true; }
bool SoccerBase::GetGameState(const Leaf& base, boost::shared_ptr<GameStateAspect>& game_state) { game_state = shared_dynamic_cast<GameStateAspect> (base.GetCore()->Get("/sys/server/gamecontrol/GameStateAspect")); if (game_state.get() == 0) { base.GetLog()->Error() << "Error: (SoccerBase: " << base.GetName() << ") found no GameStateAspect\n"; return false; } return true; }
bool SoccerBase::GetSoccerRuleAspect(const Leaf& base, boost::shared_ptr<SoccerRuleAspect> & soccer_rule_aspect) { soccer_rule_aspect = shared_dynamic_cast<SoccerRuleAspect> (base.GetCore()->Get("/sys/server/gamecontrol/SoccerRuleAspect")); if (soccer_rule_aspect.get() == 0) { base.GetLog()->Error() << "Error: (SoccerBase: " << base.GetName() << " found no SoccerRuleAspect\n"; return false; } return true; }
bool SoccerBase::GetBallBody(const Leaf& base, boost::shared_ptr<RigidBody>& body) { static boost::shared_ptr<Scene> scene; static boost::shared_ptr<RigidBody> bodyRef; if (scene.get() == 0) { if (! GetActiveScene(base,scene)) { base.GetLog()->Error() << "(SoccerBase) ERROR: " << base.GetName() << ", could not get active scene.\n"; return false; } } if (bodyRef.get() == 0) { bodyRef = shared_dynamic_cast<RigidBody> (base.GetCore()->Get(scene->GetFullPath() + "Ball/physics")); if (bodyRef.get() == 0) { base.GetLog()->Error() << "(SoccerBase) ERROR: " << base.GetName() << ", found no ball body node\n"; return false; } } body = bodyRef; return true; }
bool SoccerBase::GetBall(const Leaf& base, boost::shared_ptr<Ball>& ball) { static boost::shared_ptr<Scene> scene; static boost::shared_ptr<Ball> ballRef; if (scene.get() == 0) { if (! GetActiveScene(base,scene)) { base.GetLog()->Error() << "(SoccerBase) ERROR: " << base.GetName() << ", could not get active scene.\n"; return false; } } if (ballRef.get() == 0) { ballRef = shared_dynamic_cast<Ball> (base.GetCore()->Get(scene->GetFullPath() + "Ball")); if (ballRef.get() == 0) { base.GetLog()->Error() << "(SoccerBase) ERROR: " << base.GetName() << ", found no ball node\n"; return false; } } ball = ballRef; return true; }