Det er bedre å bruke pieceinfo til navn på brikkene.

This commit is contained in:
Jens ]dne Rydland 2008-10-09 22:53:09 +00:00
parent fc4418e158
commit d860d50001
3 changed files with 21 additions and 13 deletions

View File

@ -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[] = {

View File

@ -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);

View File

@ -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;
}