blue, yellow, red, green;
property CornerBlocksColor
{
- // TOFIX: get { return (CornerBlocksColor)((int)this+1); }
- get { return (CornerBlocksColor)*(int *)&this+1; }
+ get { return (CornerBlocksColor)((int)this+1); }
}
};
1,
1
}
- }
+ },
{
2,3,
{
PlayerColor p;
int i;
- // TOFIX: for(p = 0; p < PlayerColor::enumSize; p++)
- for(p = blue; p <= green; p++)
+ for(p = 0; p < PlayerColor::enumSize; p++)
{
for(i = 0; i < numPieces; i++)
playerPieces[p][i] = 1;
{
for(x = 0; x < boardSize && !validMove; x++)
{
- int flip;
+ bool flip;
int direction;
for(direction = 0; direction < 4 && !validMove; direction++)
{
- for(flip = 0; flip <=1 && !validMove; flip++)
+ for(flip = 0; flip <= 1 && !validMove; flip++)
{
if(ValidMove(playerColor, p, direction, flip, x, y))
result = validMove = true;
{
for(x = 0; x < boardSize && !validMove; x++)
{
- int flip;
+ bool flip;
int direction;
for(direction = 0; direction < 4 && !validMove; direction++)
{
- for(flip = 0; flip <=1 && !validMove; flip++)
+ for(flip = 0; flip <= 1 && !validMove; flip++)
{
if(gameState.ValidMove(colorPlayed, p, direction, flip, x, y))
{
bool result;
gotMove = false;
result = server.PlayPiece(p, direction, flip, x, y);
- validMove = true;
+ if(result)
+ validMove = true;
}
}
}
{
if(gameStarted && colorPlayed == gameState.colorTurn)
{
- Piece * piece = &pieces[selectedPiece];
if(gameState.ValidMove(gameState.colorTurn, selectedPiece, direction, flip, boardPos.x, boardPos.y))
server.PlayPiece(selectedPiece, direction, flip, boardPos.x, boardPos.y);
}
{
Piece * piece = &pieces[selectedPiece];
int mx = drag.x - offset.x, my = drag.y - offset.y;
- int rx, ry;
int x = squareDragged.x, y = squareDragged.y;
int w,h;
bool isDown = key == wheelDown || key == right || key == down;
log.inactive = bool::true;
visible = false;
- bool ProcessCommand(char * command)
+ bool ProcessCommand(const char * command)
{
cornerBlocks.server.SendMessage(command);
return false;
void OnRedraw(Surface surface)
{
PlayerColor p;
- char * s;
+ const char * s;
int len;
char temp[256];
int grandTotals[4];
for(p = blue; p <= green; p++)
{
- // TOFIX: bug here, why is -1 required?
- int x = 80 + (p-1) * 120;
+ int x = 80 + p * 120;
surface.foreground = colors[1][p];
/* // GCC internal compiler error with -O2, MinGW GCC 4.4.0
s = (state->numPlayers == 3 && p == green) ? "* Green *" : cornerBlocks.playerNames[p];
if((state->numPlayers == 2 && p <= yellow) ||
(state->numPlayers == 1 && p == blue))
{
- // TOFIX: Annoying +2 conversion issue
if(state->numPlayers == 2)
grandTotals[p] = state->scores[p] + state->bonus[p] +
- state->scores[p+red /*2*/] + state->bonus[p+red /*2*/];
+ state->scores[p+2] + state->bonus[p+2];
else
grandTotals[p] = state->scores[0] + state->bonus[0] +
state->scores[1] + state->bonus[1] +
{
for(c = 0; c < numTies; c++)
{
- strcat(string, cornerBlocks.playerNames[c]);
+ strcat(string, cornerBlocks.playerNames[ties[c]]);
if(c < numTies-2)
strcat(string, ", ");
else if(c < numTies-1)
void GameStarted(GameInfo gameInfo)
{
- int x,y;
int c, np = 0;
cornerBlocks.gameState.numPlayers = gameInfo.numPlayers;
void GameEnded()
{
- int c;
-
panel.ListPlayers();
cornerBlocks.gameStarted = false;
cornerBlocks.btnPass.visible = false;
}
}
- void NotifyMessage(String name, String msg)
+ void NotifyMessage(const String name, const String msg)
{
EditBox log = cornerBlocks.chat.log;
- char * format = (log.numLines > 1 || log.line.count) ?
+ const char * format = (log.numLines > 1 || log.line.count) ?
"\n%s: %s" : "%s: %s";
int len = strlen(msg);
// Avoid buffer overflow...
if(len >= MAX_F_STRING-100)
- msg[MAX_F_STRING-100] = 0;
+ ((char *)msg)[MAX_F_STRING-100] = 0;
cornerBlocks.chat.Log(format, name, msg);
}
};