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" {
#endif
struct potion_type;
struct unit;
struct region;
struct item_type;
struct order;
enum {
/* Stufe 1 */
P_FAST,

View File

@ -14,10 +14,12 @@
#ifdef __cplusplus
extern "C" {
#endif
struct lua_State;
struct selection;
struct state;
struct region;
struct lua_State;
struct selection;
struct state;
struct region;
struct terrain_type;
int gmmain(int argc, char *argv[]);
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" {
#endif
struct attrib;
struct attrib_type;
struct faction;
struct region;
struct storage;
struct unit;
extern int nextborder;
typedef struct connection {

View File

@ -24,34 +24,36 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef __cplusplus
extern "C" {
#endif
struct spell;
struct spell;
struct item;
struct unit;
typedef struct itemdata {
const struct item_type *itype;
char *value;
struct itemdata *next;
} 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 itemdata {
const struct item_type *itype;
char *value;
struct itemdata *next;
} 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;
extern struct equipment *create_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" {
#endif
struct unit;
struct attrib;
struct attrib_type;
struct region;
struct resource_type;
struct locale;
struct troop;
struct unit;
struct attrib;
struct attrib_type;
struct region;
struct resource_type;
struct locale;
struct troop;
struct item;
struct order;
typedef struct item {
struct item *next;

View File

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

View File

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

View File

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

View File

@ -22,7 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" {
#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 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" {
#endif
extern int writepasswd(void);
void demographics(void);
void update_guards(void);
void update_subscriptions(void);
void deliverMail(struct faction *f, struct region *r, struct unit *u,
const char *s, struct unit *receiver);
struct unit;
struct region;
struct building;
struct faction;
struct order;
struct attrib_type;
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);
extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
int writepasswd(void);
void demographics(void);
void update_guards(void);
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. */
void processorders(void);

View File

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

View File

@ -20,15 +20,19 @@
extern "C" {
#endif
struct locale;
struct message;
extern struct message *cinfo_ship(const void *obj, objtype_t typ,
const struct curse *c, int self);
extern void register_shipcurse(void);
extern 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);
struct locale;
struct message;
struct ship;
struct unit;
struct curse;
struct message *cinfo_ship(const void *obj, objtype_t typ,
const struct curse *c, int self);
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
}