From 300668dce8699accfb3e8cbce6db55b937230bb7 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 2 Dec 2015 11:54:36 +0100 Subject: Fixed compile errors on very old PACKETVERs - Fixes #903 and other similar problems Signed-off-by: Haru --- src/map/npc.h | 34 +++++++++++++++++++++++++++++----- src/map/packets_struct.h | 8 ++++++-- src/map/party.h | 23 +++++++++-------------- src/map/unit.h | 12 +++++------- 4 files changed, 49 insertions(+), 28 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.h b/src/map/npc.h index e7fc16a21..d5e4618a1 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -295,32 +295,51 @@ HPShared struct npc_interface *npc; /* comes from npc_chat.c */ #ifdef PCRE_SUPPORT #include -/* Structure containing all info associated with a single pattern block */ +#endif // PCRE_SUPPORT + +/** + * Structure containing all info associated with a single pattern block + */ struct pcrematch_entry { +#ifdef PCRE_SUPPORT struct pcrematch_entry* next; char* pattern; pcre* pcre_; pcre_extra* pcre_extra_; char* label; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; -/* A set of patterns that can be activated and deactived with a single command */ +/** + * A set of patterns that can be activated and deactived with a single command + */ struct pcrematch_set { +#ifdef PCRE_SUPPORT struct pcrematch_set* prev; struct pcrematch_set* next; struct pcrematch_entry* head; int setid; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; -/* +/** * Entire data structure hung off a NPC */ struct npc_parse { +#ifdef PCRE_SUPPORT struct pcrematch_set* active; struct pcrematch_set* inactive; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; struct npc_chat_interface { +#ifdef PCRE_SUPPORT int (*sub) (struct block_list* bl, va_list ap); void (*finalize) (struct npc_data* nd); void (*def_pattern) (struct npc_data* nd, int setid, const char* pattern, const char* label); @@ -330,6 +349,9 @@ struct npc_chat_interface { void (*activate_pcreset) (struct npc_data* nd, int setid); struct pcrematch_set* (*lookup_pcreset) (struct npc_data* nd, int setid); void (*finalize_pcrematch_entry) (struct pcrematch_entry* e); +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; /** @@ -338,6 +360,7 @@ struct npc_chat_interface { * should be moved into core/perhaps its own file once hpm is enhanced for login/char **/ struct pcre_interface { +#ifdef PCRE_SUPPORT pcre *(*compile) (const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr); pcre_extra *(*study) (const pcre *code, int options, const char **errptr); int (*exec) (const pcre *code, const pcre_extra *extra, PCRE_SPTR subject, int length, int startoffset, int options, int *ovector, int ovecsize); @@ -346,6 +369,9 @@ struct pcre_interface { void (*free_substring) (const char *stringptr); int (*copy_named_substring) (const pcre *code, const char *subject, int *ovector, int stringcount, const char *stringname, char *buffer, int buffersize); int (*get_substring) (const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr); +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; /** @@ -358,6 +384,4 @@ void npc_chat_defaults(void); HPShared struct npc_chat_interface *npc_chat; HPShared struct pcre_interface *libpcre; -#endif // PCRE_SUPPORT - #endif /* MAP_NPC_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 58c17ef0a..4a3fb6a4f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -455,7 +455,7 @@ struct packet_idle_unit2 { unsigned char state; short clevel; #else // ! PACKETVER < 20091103 - char UNUSED; + UNAVAILABLE_STRUCT; #endif // PACKETVER < 20091103 } __attribute__((packed)); @@ -486,7 +486,7 @@ struct packet_spawn_unit2 { unsigned char xSize; unsigned char ySize; #else // ! PACKETVER < 20091103 - char UNUSED; + UNAVAILABLE_STRUCT; #endif // PACKETVER < 20091103 } __attribute__((packed)); @@ -1097,6 +1097,7 @@ struct packet_party_leader_changed { } __attribute__((packed)); struct packet_hotkey { +#ifdef HOTKEY_SAVING short PacketType; #if PACKETVER >= 20141022 char Rotate; @@ -1106,6 +1107,9 @@ struct packet_hotkey { unsigned int ID; // Item/Skill ID short count; // Item Quantity/Skill Level } hotkey[MAX_HOTKEYS]; +#else // not HOTKEY_SAVING + UNAVAILABLE_STRUCT; +#endif // HOTKEY_SAVING } __attribute__((packed)); /** diff --git a/src/map/party.h b/src/map/party.h index df7c03f05..bcc905b94 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -40,32 +40,27 @@ struct party_data { #define PB_NOTICE_LENGTH (36 + 1) -#ifndef PARTY_RECRUIT struct party_booking_detail { short level; +#ifdef PARTY_RECRUIT + char notice[PB_NOTICE_LENGTH]; +#else // not PARTY_RECRUIT short mapid; short job[PARTY_BOOKING_JOBS]; +#endif // PARTY_RECRUIT }; struct party_booking_ad_info { unsigned int index; - char charname[NAME_LENGTH]; - int expiretime; - struct party_booking_detail p_detail; -}; -#else /* PARTY_RECRUIT */ -struct party_booking_detail { - short level; - char notice[PB_NOTICE_LENGTH]; -}; - -struct party_booking_ad_info { - unsigned int index; +#ifdef PARTY_BOOKING int expiretime; char charname[NAME_LENGTH]; +#else // not PARTY_BOOKING + char charname[NAME_LENGTH]; + int expiretime; +#endif // PARTY_BOOKING struct party_booking_detail p_detail; }; -#endif /* PARTY_RECRUIT */ /*===================================== * Interface : party.h diff --git a/src/map/unit.h b/src/map/unit.h index 0d970ca16..0f7a1aec5 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -65,13 +65,11 @@ struct unit_data { struct view_data { #ifdef __64BIT__ - unsigned int class_; -#endif - unsigned short -#ifndef __64BIT__ - class_, -#endif - weapon, + uint32 class_; // FIXME: This shouldn't really depend on the architecture. +#else // not __64BIT__ + uint16 class_; +#endif // __64BIT__ + uint16 weapon, shield, //Or left-hand weapon. robe, head_top, -- cgit v1.2.3-60-g2f50