[Gcblue-commits] gcb_wx/src/ai Brain.cpp,1.7,1.8
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-05 02:15:32
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv777/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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Brain.cpp 29 Apr 2005 18:52:51 -0000 1.7 --- Brain.cpp 5 May 2005 02:14:45 -0000 1.8 *************** *** 61,64 **** --- 61,81 ---- tcCommandStream& Brain::operator<<(tcCommandStream& stream) { + wxASSERT(platform->IsClientMode()); + + unsigned char nTasks; + stream >> nTasks; + + RemoveAllTasks(); + + for (unsigned char n=0; n<nTasks; n++) + { + std::string taskName; + stream >> taskName; + + float priority; + stream >> priority; + + AddTask(taskName, (double)priority); + } return stream; *************** *** 70,74 **** tcCommandStream& Brain::operator>>(tcCommandStream& stream) { ! wxASSERT(!parent->IsClientMode()); unsigned char nTasks = taskMap.size(); --- 87,91 ---- tcCommandStream& Brain::operator>>(tcCommandStream& stream) { ! wxASSERT(!platform->IsClientMode()); unsigned char nTasks = taskMap.size(); *************** *** 80,86 **** for (;iter != done; ++iter) { ! wxASSERT(iter->second); ! ! // iter->second->Update(t); } --- 97,107 ---- for (;iter != done; ++iter) { ! Task* task = iter->second; ! wxASSERT(task); ! ! stream << task->GetTaskName(); ! ! float priority = (float)task->GetPriority(); ! stream << priority; } *************** *** 192,195 **** --- 213,218 ---- } + hasNewCommand = true; + // check taskNameMap for C++ task, otherwise assume python script task std::map<std::string, int>::iterator iter = taskNameLookup.find(taskName); *************** *** 214,217 **** --- 237,241 ---- default: fprintf(stderr, "Unrecognized C++ taskname (%s)\n", taskName.c_str()); + hasNewCommand = false; break; } *************** *** 228,231 **** --- 252,257 ---- if (updating) return; + if (taskMap.size() > 0) hasNewCommand = true; + std::map<std::string, Task*>::iterator iter = taskMap.begin(); while (iter != taskMap.end()) *************** *** 271,274 **** --- 297,302 ---- delete iter->second; taskMap.erase(iter); + + hasNewCommand = true; } } |