- attempt to improve ai decision performance by having each ai player updates done in a thread

This commit is contained in:
Mark Vejvoda
2013-01-01 18:55:26 +00:00
parent 46869536bb
commit ee2ad95164
6 changed files with 319 additions and 3 deletions

View File

@@ -226,14 +226,16 @@ GameNetworkInterface::GameNetworkInterface(){
void GameNetworkInterface::requestCommand(const NetworkCommand *networkCommand, bool insertAtStart) {
assert(networkCommand != NULL);
//Mutex *mutex = getServerSynchAccessor();
Mutex *mutex = getServerSynchAccessor();
if(insertAtStart == false) {
MutexSafeWrapper safeMutex(mutex,string(__FILE__) + "_" + intToStr(__LINE__));
//if(mutex != NULL) mutex->p();
requestedCommands.push_back(*networkCommand);
//if(mutex != NULL) mutex->v();
}
else {
MutexSafeWrapper safeMutex(mutex,string(__FILE__) + "_" + intToStr(__LINE__));
//if(mutex != NULL) mutex->p();
requestedCommands.insert(requestedCommands.begin(),*networkCommand);
//if(mutex != NULL) mutex->v();