diff options
-rw-r--r-- | .gitlab-ci.yml | 102 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/elogin/init.c | 7 | ||||
-rw-r--r-- | src/elogin/parse.c | 4 | ||||
-rw-r--r-- | src/emap/clif.c | 100 | ||||
-rw-r--r-- | src/emap/clif.h | 4 | ||||
-rw-r--r-- | src/emap/init.c | 6 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 12 | ||||
-rw-r--r-- | src/emap/send.c | 2 | ||||
-rw-r--r-- | src/emap/unit.c | 1 | ||||
-rwxr-xr-x | tools/ci/jobs/clang7.sh | 2 | ||||
-rwxr-xr-x | tools/ci/jobs/clang8.sh | 18 | ||||
-rwxr-xr-x | tools/ci/jobs/gcc8.sh | 18 | ||||
-rwxr-xr-x | tools/ci/jobs/gcc9.sh | 18 |
14 files changed, 262 insertions, 36 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4002c7e..7f6c40d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,11 +14,11 @@ gcc-snapshot: - ./tools/ci/jobs/gccsnapshot.sh --enable-werror image: debian:unstable -.gcc-snapshot-i386: +gcc-snapshot-i386: stage: build script: - ./tools/ci/jobs/gccsnapshot.sh --enable-werror - image: vicamo/debian:sid-i386 + image: i386/debian:unstable gcc-4.8: stage: build @@ -32,25 +32,13 @@ gcc-4.9: - ./tools/ci/jobs/gcc49.sh --enable-werror image: debian:jessie -.gcc-5: - stage: build - script: - - ./tools/ci/jobs/gcc5.sh --enable-werror - image: debian:unstable - -.gcc-5-i386: - stage: build - script: - - ./tools/ci/jobs/gcc5.sh --enable-werror - image: vicamo/debian:sid-i386 - gcc-6: stage: build script: - ./tools/ci/jobs/gcc6.sh --enable-werror image: debian:stretch -.gcc-6-i386: +gcc-6-i386: stage: build script: - ./tools/ci/jobs/gcc6.sh --enable-werror @@ -62,23 +50,47 @@ gcc-7: - ./tools/ci/jobs/gcc7.sh --enable-werror image: debian:unstable -.gcc-7-i386: +gcc-7-i386: stage: build script: - ./tools/ci/jobs/gcc7.sh --enable-werror - image: vicamo/debian:sid-i386 + image: i386/debian:unstable + +gcc-8: + stage: build + script: + - ./tools/ci/jobs/gcc8.sh --enable-werror + image: debian:unstable + +gcc-8-i386: + stage: build + script: + - ./tools/ci/jobs/gcc8.sh --enable-werror + image: i386/debian:unstable + +gcc-9: + stage: build + script: + - ./tools/ci/jobs/gcc9.sh --enable-werror + image: debian:unstable + +gcc-9-i386: + stage: build + script: + - ./tools/ci/jobs/gcc9.sh --enable-werror + image: i386/debian:unstable clang-3.9: stage: build script: - ./tools/ci/jobs/clang39.sh --enable-werror - image: debian:stable + image: debian:stretch .clang-3.9-i386: stage: build script: - ./tools/ci/jobs/clang39.sh --enable-werror - image: vicamo/debian:sid-i386 + image: i386/debian:unstable clang-6: stage: build @@ -90,7 +102,7 @@ clang-6: stage: build script: - ./tools/ci/jobs/clang6.sh --enable-werror - image: vicamo/debian:sid-i386 + image: i386/debian:unstable clang-7: stage: build @@ -102,7 +114,19 @@ clang-7: stage: build script: - ./tools/ci/jobs/clang7.sh --enable-werror - image: vicamo/debian:sid-i386 + image: i386/debian:unstable + +clang-8: + stage: build + script: + - ./tools/ci/jobs/clang8.sh --enable-werror + image: debian:unstable + +clang-8-i386: + stage: build + script: + - ./tools/ci/jobs/clang8.sh --enable-werror + image: i386/debian:unstable # tests @@ -149,6 +173,18 @@ gcc-7-sanitize: - ./tools/ci/jobs/gcc7.sh --enable-werror --enable-sanitize image: debian:unstable +gcc-8-sanitize: + stage: test + script: + - ./tools/ci/jobs/gcc8.sh --enable-werror --enable-sanitize + image: debian:unstable + +gcc-9-sanitize: + stage: test + script: + - ./tools/ci/jobs/gcc9.sh --enable-werror --enable-sanitize + image: debian:unstable + gcc-4.9_lto-sanitize: stage: test script: @@ -173,6 +209,18 @@ gcc-7_lto-sanitize: - ./tools/ci/jobs/gcc7.sh --enable-werror --enable-lto --enable-sanitize image: debian:unstable +gcc-8_lto-sanitize: + stage: test + script: + - ./tools/ci/jobs/gcc8.sh --enable-werror --enable-lto --enable-sanitize + image: debian:unstable + +gcc-9_lto-sanitize: + stage: test + script: + - ./tools/ci/jobs/gcc9.sh --enable-werror --enable-lto --enable-sanitize + image: debian:unstable + gcc-4.8-lto: stage: test script: @@ -203,6 +251,18 @@ gcc-7_lto: - ./tools/ci/jobs/gcc7.sh --enable-werror --enable-lto image: debian:unstable +gcc-8_lto: + stage: test + script: + - ./tools/ci/jobs/gcc8.sh --enable-werror --enable-lto + image: debian:unstable + +gcc-9_lto: + stage: test + script: + - ./tools/ci/jobs/gcc9.sh --enable-werror --enable-lto + image: debian:unstable + # disabled due not support -std=c11 .gcc-4.6: stage: test diff --git a/src/Makefile.am b/src/Makefile.am index d17cc8a..8c9a8d5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,8 +138,8 @@ MAP_SRC = emap/atcommand.c \ SHARED_CFLAGS = ${CFLAGS} -O3 -pipe -ffast-math -std=c11 -Wall -Wextra -Wno-sign-compare -Wno-unused -fno-omit-frame-pointer \ -DPCRE_SUPPORT -I../../.. -I../../../../3rdparty \ - -DPACKETVER=20150513 \ - -DevolPacketOffset=0 + -DPACKETVER=20170517 \ + -DevolPacketOffset=0x100 SHARED_LDFLAGS = -lm -avoid-version -Wl,--no-undefined if ENABLE_STATIC_BUILD diff --git a/src/elogin/init.c b/src/elogin/init.c index 5f17a46..52a95bf 100644 --- a/src/elogin/init.c +++ b/src/elogin/init.c @@ -35,11 +35,6 @@ HPExport struct hplugin_info pinfo = HPM_VERSION }; -#define addHookPrePriv(ifname, type, funcname, hook) ( \ - (void)((HPMHOOK_pre_ ## type ## _ ## funcname)0 == (hook)), \ - HPMi->hooking->AddHook(HOOK_TYPE_PRE, #ifname "->" #funcname, (hook), HPMi->pid) \ - ) - HPExport void plugin_init (void) { interfaces_init_common(); @@ -53,7 +48,7 @@ HPExport void plugin_init (void) addHookPre(login, client_login, elogin_client_login_pre); addHookPre(login, check_password, elogin_check_password_pre); - addHookPrePriv(lclif->p, PRIV__lclif, parse_CA_CONNECT_INFO_CHANGED, elogin_parse_ping_pre); + addHookPrePriv(lclif, parse_CA_CONNECT_INFO_CHANGED, elogin_parse_ping_pre); addHookPost(login, client_login, elogin_client_login_post); } diff --git a/src/elogin/parse.c b/src/elogin/parse.c index fffd532..9156cb4 100644 --- a/src/elogin/parse.c +++ b/src/elogin/parse.c @@ -35,7 +35,7 @@ void login_parse_version(int fd) clientVersion = RFIFOL(fd, 2); // check for minimal supported version - if (clientVersion < 21) + if (clientVersion < 23) { lclif->login_error(fd, 5); return; @@ -60,7 +60,7 @@ bool elogin_client_login_pre(int *fdPtr, safestrncpy(username, RFIFOP(fd, 6), NAME_LENGTH); int len = (int)safestrnlen(username, NAME_LENGTH); // check for minimal supported version - if (clientVersion < 21) + if (clientVersion < 23) { lclif->login_error(fd, 5); hookStop(); diff --git a/src/emap/clif.c b/src/emap/clif.c index 53d9a29..9bdb6b8 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -529,6 +529,106 @@ void eclif_charnameupdate_pre(struct map_session_data **ssdPtr) } } +// clientVersion < 26 +void eclif_homname_ack_pre(int *fdPtr, struct block_list **blPtr) +{ + struct block_list *bl = *blPtr; + int fd = *fdPtr; + struct SessionExt *data = session_get(fd); + if (!data) + return; + if (data->clientVersion >= 26) + { + return; + } + + nullpo_retv(bl); + Assert_retv(bl->type == BL_HOM); + + struct packet_reqname_ack packet; + memset(&packet, 0, sizeof(packet)); + packet.packet_id = reqName; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_HOM, bl)->homunculus.name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct packet_reqname_ack)); + hookStop(); +} + +// clientVersion < 26 +void eclif_mername_ack_pre(int *fdPtr, struct block_list **blPtr) +{ + struct block_list *bl = *blPtr; + int fd = *fdPtr; + struct SessionExt *data = session_get(fd); + if (!data) + return; + if (data->clientVersion >= 26) + { + return; + } + + nullpo_retv(bl); + Assert_retv(bl->type == BL_MER); + + struct packet_reqname_ack packet; + memset(&packet, 0, sizeof(packet)); + packet.packet_id = reqName; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_MER, bl)->db->name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct packet_reqname_ack)); + hookStop(); +} + +// clientVersion < 26 +void eclif_petname_ack_pre(int *fdPtr, struct block_list **blPtr) +{ + struct block_list *bl = *blPtr; + int fd = *fdPtr; + struct SessionExt *data = session_get(fd); + if (!data) + return; + if (data->clientVersion >= 26) + { + return; + } + + nullpo_retv(bl); + Assert_retv(bl->type == BL_PET); + + struct packet_reqname_ack packet; + memset(&packet, 0, sizeof(packet)); + packet.packet_id = reqName; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_PET, bl)->pet.name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct packet_reqname_ack)); + hookStop(); +} + +// clientVersion < 26 +void eclif_elemname_ack_pre(int *fdPtr, struct block_list **blPtr) +{ + struct block_list *bl = *blPtr; + int fd = *fdPtr; + struct SessionExt *data = session_get(fd); + if (!data) + return; + if (data->clientVersion >= 26) + { + return; + } + + nullpo_retv(bl); + Assert_retv(bl->type == BL_ELEM); + + struct packet_reqname_ack packet; + memset(&packet, 0, sizeof(packet)); + packet.packet_id = reqName; + packet.gid = bl->id; + memcpy(packet.name, BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH); + clif->send_selforarea(fd, bl, &packet, sizeof(struct packet_reqname_ack)); + hookStop(); +} + #define equipPos(index, field) \ equip = sd->equip_index[index]; \ if (equip >= 0) \ diff --git a/src/emap/clif.h b/src/emap/clif.h index 1c602d8..b4f384d 100644 --- a/src/emap/clif.h +++ b/src/emap/clif.h @@ -13,6 +13,10 @@ void eclif_blname_ack_pre(int *fdPtr, struct block_list **blPtr); void eclif_blname_ack_pre_sub(int *fdPtr, struct block_list **blPtr); +void eclif_homname_ack_pre(int *fdPtr, struct block_list **blPtr); +void eclif_mername_ack_pre(int *fdPtr, struct block_list **blPtr); +void eclif_petname_ack_pre(int *fdPtr, struct block_list **blPtr); +void eclif_elemname_ack_pre(int *fdPtr, struct block_list **blPtr); void eclif_charnameupdate_pre(struct map_session_data **ssdPtr); void eclif_getareachar_unit_post(TBL_PC *sd, struct block_list *bl); diff --git a/src/emap/init.c b/src/emap/init.c index de27f2c..eb06678 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -40,6 +40,7 @@ #include "map/party.h" #include "map/pet.h" #include "map/pc.h" +#include "map/refine.h" #include "map/script.h" #include "map/storage.h" #include "map/trade.h" @@ -306,6 +307,11 @@ HPExport void plugin_init (void) addHookPre(clif, quest_send_list, eclif_quest_send_list_pre); addHookPre(clif, quest_add, eclif_quest_add_pre); addHookPre(clif, blname_ack, eclif_blname_ack_pre); + addHookPre(clif, homname_ack, eclif_homname_ack_pre); + addHookPre(clif, mername_ack, eclif_mername_ack_pre); + addHookPre(clif, petname_ack, eclif_petname_ack_pre); + addHookPre(clif, elemname_ack, eclif_elemname_ack_pre); + addHookPre(clif, charnameupdate, eclif_charnameupdate_pre); addHookPre(clif, getareachar_item, eclif_getareachar_item_pre); addHookPre(clif, dropflooritem, eclif_dropflooritem_pre); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index de5ba06..9430eb7 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -20,6 +20,7 @@ #include "map/mapreg.h" #include "map/npc.h" #include "map/pc.h" +#include "map/refine.h" #include "map/script.h" #include "map/quest.h" @@ -1321,7 +1322,8 @@ BUILDIN(failedRemoveCardsIndex) if (sd->status.inventory[i].card[c] && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD) { cardflag = 1; - sd->status.inventory[i].card[c] = 0; + if (typefail == 1) + sd->status.inventory[i].card[c] = 0; if (typefail == 2) { // add cards to inventory, clear @@ -1507,6 +1509,12 @@ BUILDIN(npcWalkTo) if (nd) { unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit + if (nd->ud == NULL) + { + ShowWarning("buildin_npcwalkto: floating NPC don't have unit data.\n"); + return false; + } + if (!nd->status.hp) { status_calc_npc(nd, SCO_FIRST); @@ -1516,7 +1524,7 @@ BUILDIN(npcWalkTo) status_calc_npc(nd, SCO_NONE); } nd->vd.dead_sit = 0; - script_pushint(st, unit->walktoxy(&nd->bl,x,y,0)); + script_pushint(st, unit->walktoxy(&nd->bl, x, y, 0)); return true; } else diff --git a/src/emap/send.c b/src/emap/send.c index 82ba452..08c57b0 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -178,8 +178,6 @@ void send_pc_own_flags(struct block_list* bl) struct SessionExt *data = session_get_bysd(sd); if (!data) return; - if (data->clientVersion < 22) - return; const int fd = sd->fd; WFIFOHEAD(fd, 8); diff --git a/src/emap/unit.c b/src/emap/unit.c index 4797d0d..e3559ba 100644 --- a/src/emap/unit.c +++ b/src/emap/unit.c @@ -64,6 +64,7 @@ int eunit_can_move_pre(struct block_list **blPtr) if (sd && ( sd->state.vending || + sd->state.prevend || sd->state.buyingstore || sd->block_action.move)) { diff --git a/tools/ci/jobs/clang7.sh b/tools/ci/jobs/clang7.sh index c416f8d..18f4a9b 100755 --- a/tools/ci/jobs/clang7.sh +++ b/tools/ci/jobs/clang7.sh @@ -2,7 +2,7 @@ export CC=clang-7 export CXX=clang++-7 -export LOGFILE=clang6.log +export LOGFILE=clang7.log source ./tools/ci/scripts/init.sh diff --git a/tools/ci/jobs/clang8.sh b/tools/ci/jobs/clang8.sh new file mode 100755 index 0000000..3c10b3d --- /dev/null +++ b/tools/ci/jobs/clang8.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +export CC=clang-8 +export CXX=clang++-8 +export LOGFILE=clang8.log + +source ./tools/ci/scripts/init.sh + +aptget_install clang-8 \ + git-core \ + make autoconf automake autopoint \ + libtool libmysqlclient-dev libz-dev libpcre3-dev + +do_init +build_init + +run_configure $* +run_make diff --git a/tools/ci/jobs/gcc8.sh b/tools/ci/jobs/gcc8.sh new file mode 100755 index 0000000..6f1fb66 --- /dev/null +++ b/tools/ci/jobs/gcc8.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +export CC=gcc-8 +export CXX=g++-8 +export LOGFILE=gcc8.log + +source ./tools/ci/scripts/init.sh + +aptget_install gcc-8 \ + git-core \ + make autoconf automake autopoint \ + libtool libmysqlclient-dev libz-dev libpcre3-dev + +do_init +build_init + +run_configure $* +run_make diff --git a/tools/ci/jobs/gcc9.sh b/tools/ci/jobs/gcc9.sh new file mode 100755 index 0000000..01e7ec6 --- /dev/null +++ b/tools/ci/jobs/gcc9.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +export CC=gcc-9 +export CXX=g++-9 +export LOGFILE=gcc9.log + +source ./tools/ci/scripts/init.sh + +aptget_install gcc-9 \ + git-core \ + make autoconf automake autopoint \ + libtool libmysqlclient-dev libz-dev libpcre3-dev + +do_init +build_init + +run_configure $* +run_make |