- Modified gameObserver and related classes to be able to work with a precise JGE instance given at construction and not the static global one. That allows to run gameObserver without JGE instance (for example in a worker thread).

- Added an "ACTION_LOGGING_TESTING" mode in the gameObserver. When this is defined, the game reloads itself in every update. I want to use that to track undo problems. Be aware that it kills performances and crashes with the testsuite if you want to activate it.
- Various cleanup/refactor of the game observer.
- Added a gameObserver == operator to compare two games
- Added player mode to the player serialization
- Added a multi-threaded mode to AI_CHANGE_TESTING. For the moment it's only useable with Qt. If you want to use it without, just defined a thread_count higher than 1.
- Refactored random generator class to use list intead of queue
- Defined a specific type for interrupt decision instead of int
This commit is contained in:
Xawotihs
2011-11-13 22:36:34 +00:00
parent 2240c14f56
commit f68c106e7e
33 changed files with 320 additions and 141 deletions

View File

@@ -31,22 +31,19 @@ int RandomGenerator::random()
else
{
result = loadedRandomValues.front();
loadedRandomValues.pop();
loadedRandomValues.pop_front();
}
if(log)
usedRandomValues.push(result);
usedRandomValues.push_back(result);
return result;
}
ostream& RandomGenerator::saveUsedRandValues(ostream& out)
{
while(usedRandomValues.size())
list<int>::iterator ite;
for(ite=usedRandomValues.begin(); ite != usedRandomValues.end(); ite++)
{
out << usedRandomValues.front();
if(usedRandomValues.size() >= 1)
out << ",";
usedRandomValues.pop();
out << *ite << ",";
}
return out;
@@ -54,13 +51,10 @@ ostream& RandomGenerator::saveUsedRandValues(ostream& out)
ostream& RandomGenerator::saveLoadedRandValues(ostream& out)
{
while(loadedRandomValues.size())
list<int>::iterator ite;
for(ite=loadedRandomValues.begin(); ite != loadedRandomValues.end(); ite++)
{
out << loadedRandomValues.front();
if(loadedRandomValues.size() >= 1)
out << ",";
loadedRandomValues.pop();
out << *ite << ",";
}
return out;
@@ -68,10 +62,8 @@ ostream& RandomGenerator::saveLoadedRandValues(ostream& out)
void RandomGenerator::loadRandValues(string s)
{
while(loadedRandomValues.size())
loadedRandomValues.pop();
while(usedRandomValues.size())
usedRandomValues.pop();
loadedRandomValues.clear();
usedRandomValues.clear();
while (s.size())
{
@@ -87,7 +79,7 @@ void RandomGenerator::loadRandValues(string s)
value = atoi(s.c_str());
s = "";
}
if (value) loadedRandomValues.push(value);
if (value) loadedRandomValues.push_back(value);
}
}