#include "ttt.qh"
-REGISTER_MINIGAME(ttt, "Tic Tac Toe");
+REGISTER_MINIGAME(ttt, _("Tic Tac Toe"));
const int TTT_TURN_PLACE = 0x0100; // player has to place a piece on the board
const int TTT_TURN_WIN = 0x0200; // player has won
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
return false;
if ( turnflags & TTT_TURN_WIN )
{
+ // translator-friendly messages composed of 2 existing messages
+ // TODO: proper "you win" banner instead of hijacking the help message
if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team )
- return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!");
- return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!");
+ strcat(_("You lost the game!"), "\n", _("Select \"^1Next Match^7\" on the menu for a rematch!"));
+ return strcat(_("You win!"), "\n", _("Select \"^1Next Match^7\" on the menu to start a new match!"));
}
if ( turnflags & TTT_TURN_NEXT )
for ( int i = 0; i < 9; i++ )
{
if ( piecemask & f )
- RandomSelection_Add(NULL, f, string_null, 1, 1);
+ RandomSelection_AddFloat(f, 1, 1);
f <<= 1;
}
else
ttt_move(minigame,aiplayer,pos);
}
- minigame.message = ttt_turn_to_string(minigame.minigame_flags);
+ strcpy(minigame.message, ttt_turn_to_string(minigame.minigame_flags));
}
// Make the correct move
void ttt_set_curr_pos(string s)
{
- if ( ttt_curr_pos )
- strunzone(ttt_curr_pos);
+ strfree(ttt_curr_pos);
if ( s )
s = strzone(s);
ttt_curr_pos = s;
case "activate":
{
ttt_set_curr_pos("");
- minigame.message = ttt_turn_to_string(minigame.minigame_flags);
+ strcpy(minigame.message, ttt_turn_to_string(minigame.minigame_flags));
+ return false;
+ }
+ case "deactivate":
+ {
+ strfree(minigame.message);
return false;
}
case "key_pressed":
{
if ( sf & MINIG_SF_UPDATE )
{
- sent.message = ttt_turn_to_string(sent.minigame_flags);
+ strcpy(sent.message, ttt_turn_to_string(sent.minigame_flags));
if ( sent.minigame_flags & minigame_self.team )
minigame_prompt();
}