fix gcc build, forward-declare structs in the header.

MSVC allows structs to be declared in a function signature, gcc wants
to know about them earlier.
This commit is contained in:
Enno Rehling 2014-11-01 13:10:22 +01:00
parent 1af315ebf2
commit 27f94783bc
12 changed files with 111 additions and 57 deletions

View File

@ -23,6 +23,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct potion_type;
struct unit;
struct region;
struct item_type;
struct order;
enum { enum {
/* Stufe 1 */ /* Stufe 1 */
P_FAST, P_FAST,

View File

@ -14,10 +14,12 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct lua_State;
struct selection; struct lua_State;
struct state; struct selection;
struct region; struct state;
struct region;
struct terrain_type;
int gmmain(int argc, char *argv[]); int gmmain(int argc, char *argv[]);
int curses_readline(struct lua_State *L, char *buffer, size_t size, int curses_readline(struct lua_State *L, char *buffer, size_t size,

View File

@ -25,6 +25,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct attrib;
struct attrib_type;
struct faction;
struct region;
struct storage;
struct unit;
extern int nextborder; extern int nextborder;
typedef struct connection { typedef struct connection {

View File

@ -24,34 +24,36 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct spell; struct spell;
struct item;
struct unit;
typedef struct itemdata { typedef struct itemdata {
const struct item_type *itype; const struct item_type *itype;
char *value; char *value;
struct itemdata *next; struct itemdata *next;
} itemdata; } itemdata;
typedef struct subsetitem {
struct equipment *set;
float chance;
} subsetitem;
typedef struct subset {
float chance;
subsetitem *sets;
} subset;
typedef struct equipment {
char *name;
struct itemdata *items;
char *skills[MAXSKILLS];
struct spellbook *spellbook;
struct subset *subsets;
struct equipment *next;
void (*callback) (const struct equipment *, struct unit *);
} equipment;
typedef struct subsetitem {
struct equipment *set;
float chance;
} subsetitem;
typedef struct subset {
float chance;
subsetitem *sets;
} subset;
typedef struct equipment {
char *name;
struct itemdata *items;
char *skills[MAXSKILLS];
struct spellbook *spellbook;
struct subset *subsets;
struct equipment *next;
void (*callback) (const struct equipment *, struct unit *);
} equipment;
extern struct equipment *create_equipment(const char *eqname); extern struct equipment *create_equipment(const char *eqname);
extern struct equipment *get_equipment(const char *eqname); extern struct equipment *get_equipment(const char *eqname);

View File

@ -26,13 +26,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct unit; struct unit;
struct attrib; struct attrib;
struct attrib_type; struct attrib_type;
struct region; struct region;
struct resource_type; struct resource_type;
struct locale; struct locale;
struct troop; struct troop;
struct item;
struct order;
typedef struct item { typedef struct item {
struct item *next; struct item *next;

View File

@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct region;
struct plane;
struct storage;
#define PFL_NOCOORDS 1 /* not in use */ #define PFL_NOCOORDS 1 /* not in use */
#define PFL_NORECRUITS 2 #define PFL_NORECRUITS 2
#define PFL_NOALLIANCES 4 #define PFL_NOALLIANCES 4

View File

@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct unit;
struct resource_type;
struct region;
/* bitfield values for get/use/change operations */ /* bitfield values for get/use/change operations */
#define GET_SLACK 0x01 #define GET_SLACK 0x01
#define GET_RESERVE 0x02 #define GET_RESERVE 0x02

View File

@ -22,6 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct attrib;
struct item;
struct storage;
struct spell;
struct spellbook;
struct unit;
typedef struct gamedata { typedef struct gamedata {
struct storage *store; struct storage *store;
int version; int version;

View File

@ -22,7 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
struct castorder; struct castorder;
struct unit;
struct region;
struct spell;
struct spell_component;
struct quicklist;
struct attrib_type;
typedef int (*spell_f)(struct castorder * co); typedef int (*spell_f)(struct castorder * co);
typedef void(*fumble_f)(const struct castorder * co); typedef void(*fumble_f)(const struct castorder * co);

View File

@ -22,17 +22,24 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" { extern "C" {
#endif #endif
extern int writepasswd(void); struct unit;
void demographics(void); struct region;
void update_guards(void); struct building;
void update_subscriptions(void); struct faction;
void deliverMail(struct faction *f, struct region *r, struct unit *u, struct order;
const char *s, struct unit *receiver); struct attrib_type;
bool renamed_building(const struct building * b); int writepasswd(void);
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name); void demographics(void);
void get_food(struct region * r); void update_guards(void);
extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2); void update_subscriptions(void);
void deliverMail(struct faction *f, struct region *r, struct unit *u,
const char *s, struct unit *receiver);
bool renamed_building(const struct building * b);
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
void get_food(struct region * r);
int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
/* eressea-specific. put somewhere else, please. */ /* eressea-specific. put somewhere else, please. */
void processorders(void); void processorders(void);

View File

@ -26,6 +26,8 @@ extern "C" {
#endif #endif
struct unit; struct unit;
struct region;
struct region_list;
struct ship; struct ship;
struct building_type; struct building_type;

View File

@ -20,15 +20,19 @@
extern "C" { extern "C" {
#endif #endif
struct locale; struct locale;
struct message; struct message;
extern struct message *cinfo_ship(const void *obj, objtype_t typ, struct ship;
const struct curse *c, int self); struct unit;
extern void register_shipcurse(void); struct curse;
extern struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
float power, int duration); struct message *cinfo_ship(const void *obj, objtype_t typ,
int levitate_ship(struct ship *sh, struct unit *mage, float power, const struct curse *c, int self);
int duration); void register_shipcurse(void);
struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
float power, int duration);
int levitate_ship(struct ship *sh, struct unit *mage, float power,
int duration);
#ifdef __cplusplus #ifdef __cplusplus
} }