Skip to content

Commit

Permalink
gcc: Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
calcitem committed Feb 11, 2021
1 parent e8ad355 commit 043d1f5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
9 changes: 9 additions & 0 deletions src/mills.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{

Expand Down
16 changes: 8 additions & 8 deletions src/mills.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ucioption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qt/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 043d1f5

Please sign in to comment.