Update of /cvsroot/gcblue/gcb_wx/src/sim
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15507/src/sim
Modified Files:
Game.cpp tcAirObject.cpp tcPlatformObject.cpp tcSimState.cpp
tcSurfaceObject.cpp
Log Message:
Parallel ai update
Index: tcSimState.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** tcSimState.cpp 31 Jan 2005 01:33:09 -0000 1.65
--- tcSimState.cpp 16 Feb 2005 23:13:49 -0000 1.66
***************
*** 650,656 ****
}
/********************************************************************/
! // for objects with AI active, periodically call AI script to update
void tcSimState::UpdateAI(double afSimTime)
{
tcGameObject *pobj;
tnPoolIndex cmappos = maPlatformState.GetStartPosition();
--- 650,659 ----
}
/********************************************************************/
! /**
! * for objects with AI active, periodically call AI script to update
! */
void tcSimState::UpdateAI(double afSimTime)
{
+ #if 0
tcGameObject *pobj;
tnPoolIndex cmappos = maPlatformState.GetStartPosition();
***************
*** 675,678 ****
--- 678,682 ----
}
}
+ #endif
}
Index: tcPlatformObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** tcPlatformObject.cpp 31 Jan 2005 01:33:09 -0000 1.34
--- tcPlatformObject.cpp 16 Feb 2005 23:13:49 -0000 1.35
***************
*** 38,41 ****
--- 38,42 ----
#include "common/tcStream.h"
#include "common/tcObjStream.h"
+ #include "ai/Brain.h"
#ifdef _DEBUG
***************
*** 86,89 ****
--- 87,101 ----
}
+
+ /**
+ *
+ */
+ void tcPlatformObject::UpdateAI(float t)
+ {
+ wxASSERT(brain);
+
+ brain->Update(t);
+ }
+
// update guidance to maintain/achieve formation position
void tcPlatformObject::UpdateFormationGuidance()
***************
*** 229,232 ****
--- 241,246 ----
}
+
+
/**
* update launcher state (reload time)
***************
*** 294,300 ****
--- 308,323 ----
UpdateMagazines(afStatusTime);
+ UpdateAI(afStatusTime);
+
mfStatusTime = afStatusTime;
}
+ /**
+ * @return pointer to platform's "brain" (AI)
+ */
+ Brain* tcPlatformObject::GetBrain()
+ {
+ return brain;
+ }
/**
***************
*** 805,808 ****
--- 828,832 ----
{
Clear();
+ brain = new Brain(this);
mpDBObject = NULL;
mcLauncherState.mnCount = 0;
***************
*** 851,854 ****
--- 875,881 ----
using namespace Database;
+ brain = new Brain(this);
+ brain->AddTask("TestTask", 1.0);
+
mpDBObject = obj;
mnModelType = MTYPE_PLATFORM;
***************
*** 936,942 ****
}
/******************************************************************************/
! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) : tcGameObject(o),
commandObj(o.commandObj)
{
fuel_kg = o.fuel_kg;
mcAI = o.mcAI;
--- 963,972 ----
}
/******************************************************************************/
! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) :
! tcGameObject(o),
commandObj(o.commandObj)
{
+ brain = new Brain(this); // need copy constructor for this
+
fuel_kg = o.fuel_kg;
mcAI = o.mcAI;
***************
*** 969,972 ****
--- 999,1004 ----
tcPlatformObject::~tcPlatformObject()
{
+ if (brain) delete brain;
+
for (size_t n=0; n<magazines.size(); n++)
{
Index: Game.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -C2 -d -r1.119 -r1.120
*** Game.cpp 1 Feb 2005 02:29:07 -0000 1.119
--- Game.cpp 16 Feb 2005 23:13:49 -0000 1.120
***************
*** 2476,2480 ****
glCanvas->SetBackgroundColour(*wxBLACK);
! pythonInterface = new tcSimPythonInterface();
goalTracker = simState->GetGoalTracker();
--- 2476,2480 ----
glCanvas->SetBackgroundColour(*wxBLACK);
! pythonInterface = tcSimPythonInterface::Get();
goalTracker = simState->GetGoalTracker();
***************
*** 2513,2520 ****
--- 2513,2522 ----
tcGame::~tcGame()
{
+ /*
if (pythonInterface)
{
delete pythonInterface;
}
+ */
messageConsole = NULL;
Index: tcAirObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** tcAirObject.cpp 31 Jan 2005 01:33:08 -0000 1.16
--- tcAirObject.cpp 16 Feb 2005 23:13:49 -0000 1.17
***************
*** 379,382 ****
--- 379,384 ----
UpdateSensors(afStatusTime);
+ UpdateAI(afStatusTime);
+
mfStatusTime = afStatusTime;
}
Index: tcSurfaceObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** tcSurfaceObject.cpp 23 Nov 2004 23:31:18 -0000 1.14
--- tcSurfaceObject.cpp 16 Feb 2005 23:13:50 -0000 1.15
***************
*** 102,105 ****
--- 102,107 ----
UpdateSensors(afStatusTime);
+ UpdateAI(afStatusTime);
+
mfStatusTime = afStatusTime;
}
|