diff --git a/src/game.c b/src/game.c index 6d305f5..ff0fed0 100644 --- a/src/game.c +++ b/src/game.c @@ -6,21 +6,25 @@ #include "net.h" #include "game.h" -struct pieceinfo { - int num; -} pieceinfo[] = { +pieceinfo_t pieceinfo[] = { { // NONE - .num = 0 }, - { // PHARAO - .num = 1 }, + .num = 0, + .name = "" }, + { + .num = 1, + .name = "pharao" }, { // DJHED - .num = 2 }, + .num = 2, + .name = "djhed" }, { // PYRAMID - .num = 7 }, + .num = 7, + .name = "pyramid" }, { // OBELISK - .num = 4 }, + .num = 4, + .name = "obelisk" }, { // OBELISK2 - .num = 0 }, + .num = 0, + .name = "stacked obelisk" }, }; sideinfo_t sideinfo[] = { diff --git a/src/game.h b/src/game.h index 30ef942..08ed859 100644 --- a/src/game.h +++ b/src/game.h @@ -43,6 +43,11 @@ typedef struct { int last_hit; } game_t; +typedef struct { + int num; + char *name; +} pieceinfo_t; + typedef struct { char ch; char *name; @@ -53,8 +58,7 @@ 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"}; +extern pieceinfo_t pieceinfo[]; int laser_at(game_t *game, int x, int y); int laser(game_t *game, int side); diff --git a/src/server.c b/src/server.c index ec20f5e..31c9ad7 100644 --- a/src/server.c +++ b/src/server.c @@ -218,7 +218,7 @@ simple_game(void) case L_WALL: case L_PIECE: net_all_printf("laser hits %s at %c%c\n", - r==L_WALL ? "wall" : piece_names[game.last_hit], + r==L_WALL ? "wall" : pieceinfo[game.last_hit].name, game.laser_pos[1]+'A', game.laser_pos[0]+'0'); break; }