]> git.cworth.org Git - loudgame/blobdiff - lg-loa.c
Fix segfault when formatting "Illegal move" message.
[loudgame] / lg-loa.c
index 61e635124c5c591a6135f8e030668b92cef5431f..a1949d3b8af20b640328da449c486ed82f0dd58c 100644 (file)
--- a/lg-loa.c
+++ b/lg-loa.c
@@ -412,7 +412,9 @@ loa_game_move (loa_game_t *game, const char * peer,
     }
 
     if (! board_move_legal (&game->board, x1, y1, x2, y2, &error)) {
-       loudgame_sendf (&game->lg, peer, "Illegal move: %s.");
+       loudgame_sendf (&game->lg, peer, "Illegal move: %c%d%c%d",
+                       'a' + x1, BOARD_SIZE - y1,
+                       'a' + x2, BOARD_SIZE - y2);
        return FALSE;
     }
 
@@ -524,7 +526,10 @@ loa_game_handle_help (loa_game_t *game, const char *peer)
 {
     loudgame_sendf (&game->lg, peer,
                    "I'm a bot that allows you to play the game Lines of Action.\n"
-                   "Here are some commands I understand:\n"
+                   "Here are some generic commands I understand:\n"
+                   LOUDGAME_HELP
+                   "\n"
+                   "And some game-specific commands:\n"
                    "\tshow     \t\tShow the current board\n"
                    "\tmove aNbN\tMove a piece, (eg. 'move b1d3')\n"
                    "\tpass     \t\tSkip a turn (only legal if no moves are possible)\n"