diff --git a/src/mills.cpp b/src/mills.cpp index cb40107a..da07e4b6 100644 --- a/src/mills.cpp +++ b/src/mills.cpp @@ -26,6 +26,15 @@ #include "option.h" #include "position.h" +const char *loseReasonNoWayStr = "Player%d no way to go. Player%d win!"; +const char *loseReasonTimeOverStr = "Time over. Player%d win!"; +const char *drawReasonThreefoldRepetitionStr = "Threefold Repetition. Draw!"; +const char *drawReasonRule50Str = "Fifty-move rule. Draw!"; +const char *loseReasonBoardIsFullStr = "Full. Player2 win!"; +const char *drawReasonBoardIsFullStr = "Full. In draw!"; +const char *loseReasonlessThanThreeStr = "Player%d win!"; +const char *loseReasonResignStr = "Player%d give up!"; + namespace Mills { diff --git a/src/mills.h b/src/mills.h index 4daab421..dc559c61 100644 --- a/src/mills.h +++ b/src/mills.h @@ -22,14 +22,14 @@ #include "types.h" #include "config.h" -static const char *loseReasonNoWayStr = "Player%d no way to go. Player%d win!"; -static const char *loseReasonTimeOverStr = "Time over. Player%d win!"; -static const char *drawReasonThreefoldRepetitionStr = "Threefold Repetition. Draw!"; -static const char *drawReasonRule50Str = "Fifty-move rule. Draw!"; -static const char *loseReasonBoardIsFullStr = "Full. Player2 win!"; -static const char *drawReasonBoardIsFullStr = "Full. In draw!"; -static const char *loseReasonlessThanThreeStr = "Player%d win!"; -static const char *loseReasonResignStr = "Player%d give up!"; +extern const char *loseReasonNoWayStr; +extern const char *loseReasonTimeOverStr; +extern const char *drawReasonThreefoldRepetitionStr; +extern const char *drawReasonRule50Str; +extern const char *loseReasonBoardIsFullStr; +extern const char *drawReasonBoardIsFullStr; +extern const char *loseReasonlessThanThreeStr; +extern const char *loseReasonResignStr; namespace Mills { diff --git a/src/position.cpp b/src/position.cpp index 31a45185..1fcabc7e 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -590,7 +590,7 @@ bool Position::reset() break; } - if (snprintf(record, RECORD_LEN_MAX, "r%1d s%03d t%02d", + if (snprintf(record, RECORD_LEN_MAX, "r%1d s%03zu t%02d", r + 1, rule.maxStepsLedToDraw, 0) > 0) { return true; } @@ -955,7 +955,7 @@ Color Position::get_winner() const noexcept return winner; } -inline void Position::set_gameover(Color w, GameOverReason reason) +void Position::set_gameover(Color w, GameOverReason reason) { phase = Phase::gameOver; gameOverReason = reason; diff --git a/src/rule.h b/src/rule.h index 443f5b8a..a7053fbc 100644 --- a/src/rule.h +++ b/src/rule.h @@ -52,7 +52,7 @@ struct Rule // Player may fly if he is down to three pieces. bool mayFly; - int maxStepsLedToDraw; + size_t maxStepsLedToDraw; }; #define N_RULES 4 diff --git a/src/ucioption.cpp b/src/ucioption.cpp index e608c086..86a5d775 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -119,7 +119,7 @@ void on_mayFly(const Option &o) void on_maxStepsLedToDraw(const Option &o) { - rule.maxStepsLedToDraw = (int)o; + rule.maxStepsLedToDraw = (size_t)o; } /// Our case insensitive less() function as required by UCI protocol diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index d9a678dc..2a67172c 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -385,7 +385,7 @@ void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= -1* elapsedSeconds[BLACK] = elapsedSeconds[WHITE] = 0; char record[64] = { 0 }; - if (snprintf(record, Position::RECORD_LEN_MAX, "r%1d s%03d t%02d", r + 1, rule.maxStepsLedToDraw, 0) <= 0) { + if (snprintf(record, Position::RECORD_LEN_MAX, "r%1d s%03zu t%02d", r + 1, rule.maxStepsLedToDraw, 0) <= 0) { assert(0); } string cmd(record);