From 1bc17b805aec9dff503afca1e4b7120c5c836b75 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Sep 2019 20:52:36 +0300 Subject: Fix compilation warnings in gcc-9 Also reenabled array bound warning --- src/map/clif.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index f6caa502e..3e6a3469d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -16091,7 +16091,10 @@ static void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) p->packetType = HEADER_ZC_ACK_RANKING; p->rankType = type; #if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190703 || PACKETVER_ZERO_NUM >= 20190724 +PRAGMA_GCC9(GCC diagnostic push) +PRAGMA_GCC9(GCC diagnostic ignored "-Waddress-of-packed-member") clif->ranklist_sub2(p->chars, p->points, type); +PRAGMA_GCC9(GCC diagnostic pop) #else clif->ranklist_sub(&p->ranks, type); #endif -- cgit v1.2.3-70-g09d2 From e62562efbfb4f414e6b977989682da42fc487f20 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Sep 2019 09:27:26 +0300 Subject: Define constants for packet names ZC_INVENTORY_START and ZC_INVENTORY_END --- src/map/clif.c | 14 +++++++------- src/map/packets_struct.h | 10 ++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 3e6a3469d..999a232dc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2935,10 +2935,10 @@ static void clif_inventoryStart(struct map_session_data *sd, enum inventory_type nullpo_retv(sd); nullpo_retv(name); - char buf[sizeof(struct ZC_INVENTORY_START) + 24]; + char buf[sizeof(struct PACKET_ZC_INVENTORY_START) + 24]; memset(buf, 0, sizeof(buf)); - struct ZC_INVENTORY_START *p = (struct ZC_INVENTORY_START *)buf; - p->packetType = 0xb08; + struct PACKET_ZC_INVENTORY_START *p = (struct PACKET_ZC_INVENTORY_START *)buf; + p->packetType = HEADER_ZC_INVENTORY_START; #if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 p->invType = type; #endif @@ -2946,11 +2946,11 @@ static void clif_inventoryStart(struct map_session_data *sd, enum inventory_type int strLen = (int)safestrnlen(name, 24) + 1; if (strLen > 24) strLen = 24; - const int len = sizeof(struct ZC_INVENTORY_START) + strLen; + const int len = sizeof(struct PACKET_ZC_INVENTORY_START) + strLen; p->packetLength = len; safestrncpy(p->name, name, strLen); #else - const int len = sizeof(struct ZC_INVENTORY_START); + const int len = sizeof(struct PACKET_ZC_INVENTORY_START); safestrncpy(p->name, name, NAME_LENGTH); #endif clif->send(p, len, &sd->bl, SELF); @@ -2962,8 +2962,8 @@ static void clif_inventoryEnd(struct map_session_data *sd, enum inventory_type t #if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 nullpo_retv(sd); - struct ZC_INVENTORY_END p; - p.packetType = 0xb0b; + struct PACKET_ZC_INVENTORY_END p; + p.packetType = HEADER_ZC_INVENTORY_END; #if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 p.invType = type; #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 9c8c93865..f64fff199 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1183,7 +1183,8 @@ struct ZC_STORE_ITEMLIST_NORMAL { struct NORMALITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); -struct ZC_INVENTORY_START { +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 +struct PACKET_ZC_INVENTORY_START { int16 packetType; #if PACKETVER_RE_NUM >= 20180919 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 int16 packetLength; @@ -1197,14 +1198,19 @@ struct ZC_INVENTORY_START { char name[NAME_LENGTH]; #endif } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_INVENTORY_START, 0x0b08); +#endif // PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 -struct ZC_INVENTORY_END { +#if PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 +struct PACKET_ZC_INVENTORY_END { int16 packetType; #if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 uint8 invType; #endif char flag; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_INVENTORY_END, 0x0b0b); +#endif // PACKETVER_RE_NUM >= 20180829 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 struct ZC_STORE_ITEMLIST_EQUIP { int16 PacketType; -- cgit v1.2.3-70-g09d2 From 9e82150f9c3cbe2f83843a6d5fffaf3d91a7b119 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Oct 2019 07:19:16 +0300 Subject: Add support for new skill packets in zero 20190918 and newer --- src/map/clif.c | 4 ++-- src/map/packets_struct.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 999a232dc..b2f2825d2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5268,7 +5268,7 @@ static void clif_playerSkillToPacket(struct map_session_data *sd, struct SKILLDA skillData->sp = 0; skillData->range2 = 0; } -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 if (newSkill) skillData->level2 = 0; else @@ -5419,7 +5419,7 @@ static void clif_skillinfo(struct map_session_data *sd, int skill_id, int inf) p->sp = 0; p->range2 = 0; } -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 p->level2 = skill_lv; #endif if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f64fff199..c0d1054d7 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3529,7 +3529,7 @@ DEFINE_PACKET_HEADER(ZC_HAT_EFFECT, 0x0a3b); #endif // [4144] this struct updated not in all packets in client -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 struct SKILLDATA { uint16 id; int inf; @@ -3555,7 +3555,7 @@ struct PACKET_ZC_ADD_SKILL { int16 packetType; struct SKILLDATA skill; } __attribute__((packed)); -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 DEFINE_PACKET_HEADER(ZC_ADD_SKILL, 0x0b31); #else DEFINE_PACKET_HEADER(ZC_ADD_SKILL, 0x0111); @@ -3566,13 +3566,13 @@ struct PACKET_ZC_SKILLINFO_LIST { int16 packetLength; struct SKILLDATA skills[]; } __attribute__((packed)); -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 DEFINE_PACKET_HEADER(ZC_SKILLINFO_LIST, 0x0b32); #else DEFINE_PACKET_HEADER(ZC_SKILLINFO_LIST, 0x010f); #endif -#if PACKETVER_RE_NUM >= 20190807 +#if PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190918 struct PACKET_ZC_SKILLINFO_UPDATE2 { int16 packetType; uint16 id; -- cgit v1.2.3-70-g09d2