Update of /cvsroot/gcblue/gcb_wx/src/ai
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/ai
Modified Files:
Brain.cpp
Log Message:
Index: Brain.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Brain.cpp 2 Mar 2005 22:28:41 -0000 1.6
--- Brain.cpp 29 Apr 2005 18:52:51 -0000 1.7
***************
*** 32,35 ****
--- 32,37 ----
#include "ai/ScriptedTask.h"
#include "sim/tcPlatformObject.h"
+ #include "common/tcStream.h"
+ #include "common/tcObjStream.h"
#ifdef _DEBUG
***************
*** 52,55 ****
--- 54,106 ----
}
+
+
+ /**
+ * Loads state from command stream
+ */
+ tcCommandStream& Brain::operator<<(tcCommandStream& stream)
+ {
+
+ return stream;
+ }
+
+ /**
+ * Saves state to command stream
+ */
+ tcCommandStream& Brain::operator>>(tcCommandStream& stream)
+ {
+ wxASSERT(!parent->IsClientMode());
+
+ unsigned char nTasks = taskMap.size();
+ stream << nTasks;
+
+ // iterate through task map and update tasks
+ std::map<std::string, Task*>::iterator iter = taskMap.begin();
+ std::map<std::string, Task*>::iterator& done = taskMap.end();
+ for (;iter != done; ++iter)
+ {
+ wxASSERT(iter->second);
+
+ // iter->second->Update(t);
+ }
+
+ return stream;
+ }
+
+ void Brain::ClearNewCommand()
+ {
+ hasNewCommand = false;
+
+ }
+
+ bool Brain::HasNewCommand() const
+ {
+ return hasNewCommand;
+ }
+
+
+
+
+
/**
* gets a low priority, anonymous interface to board
***************
*** 235,238 ****
--- 286,291 ----
}
+ if (platform->IsClientMode()) return; // server updates only in multiplayer mode
+
RemovePending();
***************
*** 259,263 ****
nextId(1),
target(-1),
! updating(false)
{
wxASSERT(platform);
--- 312,317 ----
nextId(1),
target(-1),
! updating(false),
! hasNewCommand(false)
{
wxASSERT(platform);
|