Merge pull request #915 from WagicProject/test_suite_function_fix

- fixed small compiling error for a function in testsuite
This commit is contained in:
Rolzad73
2017-01-31 13:10:19 -05:00
committed by GitHub
4 changed files with 15 additions and 15 deletions

View File

@@ -18,9 +18,9 @@ using namespace std;
template <class T> template <class T>
std::string ToHex(T* pointer) std::string ToHex(T* pointer)
{ {
std::ostringstream stream; std::ostringstream stream;
stream << hex << showbase << setfill('0') << setw(8) << (uint64_t) pointer; stream << hex << showbase << setfill('0') << setw(8) << (uint64_t) pointer;
return stream.str(); return stream.str();
} }
#ifdef LINUX #ifdef LINUX
@@ -42,9 +42,9 @@ std::string ToHex(T* pointer)
#else // CAPTURE_STDERR #else // CAPTURE_STDERR
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString; \ stream << inString; \
qDebug("%s", stream.str().c_str()); \ qDebug("%s", stream.str().c_str()); \
} }
#endif // CAPTURE_STDERR #endif // CAPTURE_STDERR
@@ -52,16 +52,16 @@ std::string ToHex(T* pointer)
#include <android/log.h> #include <android/log.h>
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString; \ stream << inString; \
__android_log_write(ANDROID_LOG_DEBUG, "Wagic", stream.str().c_str());\ __android_log_write(ANDROID_LOG_DEBUG, "Wagic", stream.str().c_str());\
} }
#else #else
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::ostringstream stream; \ std::ostringstream stream; \
stream << inString << std::endl; \ stream << inString << std::endl; \
OutputDebugStringA(stream.str().c_str()); \ OutputDebugStringA(stream.str().c_str()); \
} }
#endif // QT_CONFIG #endif // QT_CONFIG
#endif // Win32, Linux #endif // Win32, Linux
@@ -71,7 +71,7 @@ std::string ToHex(T* pointer)
#ifndef DebugTrace #ifndef DebugTrace
#define DebugTrace(inString) \ #define DebugTrace(inString) \
{ \ { \
std::cerr << inString << std::endl; \ std::cerr << inString << std::endl; \
} }
#endif //DEBUG #endif //DEBUG
#endif #endif

View File

@@ -77,7 +77,7 @@ public:
RandomGenerator(unsigned int seed = -1, bool doLog = false) : log(doLog) { if(seed != (unsigned int)-1) srand(seed);}; RandomGenerator(unsigned int seed = -1, bool doLog = false) : log(doLog) { if(seed != (unsigned int)-1) srand(seed);};
void loadRandValues(string s); void loadRandValues(string s);
ostream& saveUsedRandValues(ostream& out) const; ostream& saveUsedRandValues(ostream& out) const;
ostream& saveLoadedRandValues(ostream& out); ostream& saveLoadedRandValues(ostream& out) const;
int random(); int random();
void setSeed(unsigned int seed) { srand(seed); }; void setSeed(unsigned int seed) { srand(seed); };
template<typename Iter> void random_shuffle(Iter first, Iter last) template<typename Iter> void random_shuffle(Iter first, Iter last)

View File

@@ -852,7 +852,7 @@ void TestSuiteGame::initGame()
p->life = initState.players[i]->life; p->life = initState.players[i]->life;
p->poisonCount = initState.players[i]->poisonCount; p->poisonCount = initState.players[i]->poisonCount;
stringstream stream; stringstream stream;
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream); initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str()); p->getRandomGenerator()->loadRandValues(stream.str());
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->removedFromGame }; MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->removedFromGame };
MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard, MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,

View File

@@ -49,9 +49,9 @@ ostream& RandomGenerator::saveUsedRandValues(ostream& out) const
return out; return out;
} }
ostream& RandomGenerator::saveLoadedRandValues(ostream& out) ostream& RandomGenerator::saveLoadedRandValues(ostream& out) const
{ {
list<int>::iterator ite; list<int>::const_iterator ite;
for(ite=loadedRandomValues.begin(); ite != loadedRandomValues.end(); ite++) for(ite=loadedRandomValues.begin(); ite != loadedRandomValues.end(); ite++)
{ {
out << *ite << ","; out << *ite << ",";