diff --git a/src/game.c b/src/game.c index a0a0c71..6d305f5 100644 --- a/src/game.c +++ b/src/game.c @@ -73,12 +73,15 @@ laser(game_t *game, int side) { case NONE: break; case PHARAO: + game->last_hit = PHARAO; lreturn(SILVER_WINS + 1-game->board[x][y].side); /* GAME OVER */ case OBELISK2: game->board[x][y].piece = OBELISK; + game->last_hit = OBELISK; lreturn(L_PIECE); case OBELISK: game->board[x][y].piece = NONE; + game->last_hit = OBELISK; lreturn(L_PIECE); case DJHED: ddir = (game->board[x][y].dir - dir) & 3; @@ -88,6 +91,7 @@ laser(game_t *game, int side) { ddir = (game->board[x][y].dir - dir) & 3; if (ddir & 2) { game->board[x][y].piece = NONE; + game->last_hit = PYRAMID; lreturn(L_PIECE); } dir=(dir + 1 - 2*(ddir & 1)) & 3; diff --git a/src/game.h b/src/game.h index 9312fa4..30ef942 100644 --- a/src/game.h +++ b/src/game.h @@ -40,6 +40,7 @@ typedef struct { int winner; square_t board[BOARD_WIDTH][BOARD_HEIGHT]; int laser_pos[2]; + int last_hit; } game_t; typedef struct { @@ -53,6 +54,8 @@ typedef enum { D_NW=0, D_N, D_NE, D_E, D_SE, D_S, D_SW, D_W } dir_t; extern char classic_setup[]; extern sideinfo_t sideinfo[]; +char* piece_names[N_PIECE_TYPES] = {NULL,"pharao","djhed","pyramid","obelisk"}; + int laser_at(game_t *game, int x, int y); int laser(game_t *game, int side); int movable(game_t *game, int row, int col, int side); diff --git a/src/server.c b/src/server.c index d12f32b..ec20f5e 100644 --- a/src/server.c +++ b/src/server.c @@ -210,15 +210,15 @@ simple_game(void) net_all_printf("%s", aabuf); switch (r) { case SILVER_WINS: - net_all_printf("SILVER WINS\n"); + net_all_printf("SILVER WINS!\n"); return; case RED_WINS: - net_all_printf("RED WINS\n"); + net_all_printf("RED WINS!\n"); return; case L_WALL: case L_PIECE: net_all_printf("laser hits %s at %c%c\n", - r==L_WALL ? "wall" : "piece", + r==L_WALL ? "wall" : piece_names[game.last_hit], game.laser_pos[1]+'A', game.laser_pos[0]+'0'); break; }