我正在編寫一個基於DnD-Text-Based的C風格遊戲,並且我在編譯結構時遇到問題。 這裏是我迄今的結構:「房間」前的預期說明符 - 限定符列表
typedef struct stats { //
int strength; //
int wisdom; //
int agility; //
} stats;
typedef struct rooms {
int n_monsters;
int visited;
rooms nentry;
rooms sentry;
rooms wentry;
rooms eentry;
monster *monsters;
} rooms;
typedef struct monster {
int difficulty;
char *name;
char *type;
int hp;
} monster;
typedef struct dungeon {
char *name;
int n_rooms;
rooms *rooms;
} dungeon;
typedef struct player {
int maxhealth;
int curhealth;
int mana;
char *class;
char *condition;
stats stats;
rooms c_room;
} player;
typedef struct game_structure {
player p1;
dungeon d;
} game_structure;
當我編譯它,我得到的錯誤: structure.h:21:錯誤:符限定符列表前「房」
你能幫我弄清楚這是爲什麼嗎?是因爲我從包含房間的結構中呼叫房間?請幫忙。
謝謝!這是最有幫助的,並幫助我瞭解問題。 – atb 2012-03-05 01:38:59