00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "spadesactevent.h"
00023 #include "spadesserver.h"
00024 #include <zeitgeist/logserver/logserver.h>
00025 #include <oxygen/gamecontrolserver/gamecontrolserver.h>
00026 #include <oxygen/agentaspect/agentaspect.h>
00027
00028 using namespace oxygen;
00029 using namespace zeitgeist;
00030 using namespace boost;
00031 using namespace std;
00032
00033 void SpadesActEvent::Print (std::ostream & ) const
00034 {
00035 }
00036
00037 bool SpadesActEvent::realizeEventWorldModel(spades::WorldModel* pWM)
00038 {
00039
00040
00041
00042 SpadesServer* spadesServer = dynamic_cast<SpadesServer*>(pWM);
00043
00044 if (spadesServer == NULL)
00045 {
00046
00047 return false;
00048 }
00049
00050 shared_ptr<GameControlServer> gcs = spadesServer->GetGameControlServer();
00051 if (gcs.get() == 0)
00052 {
00053 spadesServer->GetLog()->Error()
00054 << "(SpadesActEvent) GameControlServer not found." << endl;
00055 return false;
00056 }
00057
00058
00059 int id = getAgent();
00060 shared_ptr<AgentAspect> agent = gcs->GetAgentAspect(id);
00061
00062 if (agent.get() == 0)
00063 {
00064 spadesServer->GetLog()->Warning()
00065 << "ERROR: (SpadesActEvent) no AgentAspect for id " << id
00066 << "found." << endl;
00067 return false;
00068 }
00069
00070
00071 agent->RealizeActions(mActionList);
00072
00073
00074 return true;
00075 }