git.ucc.asn.au
/
progcomp2012.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Backing up the results files before fucking with them
[progcomp2012.git]
/
judge
/
manager
/
game.cpp
diff --git
a/judge/manager/game.cpp
b/judge/manager/game.cpp
index
0e768c5
..
f50ce27
100644
(file)
--- a/
judge/manager/game.cpp
+++ b/
judge/manager/game.cpp
@@
-1,5
+1,7
@@
#include "game.h"
#include <stdarg.h>
#include "game.h"
#include <stdarg.h>
+#include <string>
+
using namespace std;
using namespace std;
@@
-22,7
+24,13
@@
Game::Game(const char * redPath, const char * bluePath, const bool enableGraphic
#ifdef BUILD_GRAPHICS
if (graphicsEnabled && (!Graphics::Initialised()))
#ifdef BUILD_GRAPHICS
if (graphicsEnabled && (!Graphics::Initialised()))
- Graphics::Initialise("Stratego", theBoard.Width()*32, theBoard.Height()*32);
+ {
+ string s = "Stratego: ";
+ s += string(redPath);
+ s += " ";
+ s += string(bluePath);
+ Graphics::Initialise(s.c_str(), theBoard.Width()*GRID_SIZE, theBoard.Height()*GRID_SIZE);
+ }
#endif //BUILD_GRAPHICS
#endif //BUILD_GRAPHICS
@@
-60,7
+68,11
@@
Game::Game(const char * fromFile, const bool enableGraphics, double newStallTime
#ifdef BUILD_GRAPHICS
if (graphicsEnabled && (!Graphics::Initialised()))
#ifdef BUILD_GRAPHICS
if (graphicsEnabled && (!Graphics::Initialised()))
- Graphics::Initialise("Stratego", theBoard.Width()*32, theBoard.Height()*32);
+ {
+ string s = "Stratego: (file) ";
+ s += string(fromFile);
+ Graphics::Initialise(s.c_str(), theBoard.Width()*GRID_SIZE, theBoard.Height()*GRID_SIZE);
+ }
#endif //BUILD_GRAPHICS
input = fopen(fromFile, "r");
#endif //BUILD_GRAPHICS
input = fopen(fromFile, "r");
@@
-208,21
+220,23
@@
void Game::Wait(double wait)
if (wait <= 0)
return;
if (wait <= 0)
return;
- TimerThread timer(wait*1000000); //Wait in seconds
- timer.Start();
+
+
#ifdef BUILD_GRAPHICS
#ifdef BUILD_GRAPHICS
+
+
if (!graphicsEnabled)
{
if (!graphicsEnabled)
{
- while (!timer.Finished());
- timer.Stop();
+ usleep(1000000*wait); //Wait in seconds
return;
}
return;
}
- #endif //BUILD_GRAPHICS
+ TimerThread timer(wait*1000000); //Wait in seconds
+ timer.Start();
while (!timer.Finished())
{
while (!timer.Finished())
{
- #ifdef BUILD_GRAPHICS
+
SDL_Event event;
while (SDL_PollEvent(&event))
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
@@
-234,9
+248,12
@@
void Game::Wait(double wait)
break;
}
}
break;
}
}
- #endif //BUILD_GRAPHICS
}
timer.Stop();
}
timer.Stop();
+
+ #else
+ usleep(wait*1000000); //Wait in seconds
+ #endif //BUILD_GRAPHICS
}
}
UCC
git Repository :: git.ucc.asn.au