diff options
author | Haru <haru@dotalux.com> | 2020-06-01 04:01:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 04:01:16 +0200 |
commit | b9f7d1439c84b64facaf7d2875adc29110c65cf4 (patch) | |
tree | 808162f3083ac05b3221c7ffcdb4e52ffd4fb90a /src/map/clif.c | |
parent | 6188b2eb25c9fdcd33cfbef50e3dd41774f37994 (diff) | |
parent | 410e04c2562f7d7dd9a2f242d6ef821dbe0b2fc5 (diff) | |
download | hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.gz hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.bz2 hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.xz hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.zip |
Merge pull request #2713 from 4144/updatepackets
Update packets up to 2020-05-20
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 5b0122401..6d67b5114 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -936,19 +936,25 @@ static void clif_clearunit_area(struct block_list *bl, enum clr_type type) static int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = (struct block_list *)data; + nullpo_ret(bl); + Assert_ret(bl->m >= 0 && bl->m < map->count); + if (map->list[bl->m].block == NULL) { + // avoid error report for missing/removed map + ers_free(clif->delay_clearunit_ers, bl); + return 0; + } clif->clearunit_area(bl, (enum clr_type) id); - ers_free(clif->delay_clearunit_ers,bl); + ers_free(clif->delay_clearunit_ers, bl); return 0; } static void clif_clearunit_delayed(struct block_list *bl, enum clr_type type, int64 tick) { - struct block_list *tbl; - nullpo_retv(bl); - tbl = ers_alloc(clif->delay_clearunit_ers, struct block_list); - memcpy (tbl, bl, sizeof (struct block_list)); - timer->add(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl); + Assert_retv(bl->type == BL_MOB); + struct mob_data *md = ers_alloc(clif->delay_clearunit_ers, struct mob_data); + memcpy (md, bl, sizeof (struct mob_data)); + timer->add(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)md); } /// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand) @@ -1031,6 +1037,7 @@ static void clif_set_unit_idle2(struct block_list *bl, struct map_session_data * int g_id = status->get_guild_id(bl); nullpo_retv(bl); + nullpo_retv(vd); sd = BL_CAST(BL_PC, bl); p.PacketType = idle_unit2Type; @@ -1087,6 +1094,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t int g_id = status->get_guild_id(bl); nullpo_retv(bl); + nullpo_retv(vd); #if PACKETVER < 20091103 if (!pc->db_checkid(vd->class)) { @@ -1197,6 +1205,7 @@ static void clif_spawn_unit2(struct block_list *bl, enum send_target target) int g_id = status->get_guild_id(bl); nullpo_retv(bl); + nullpo_retv(vd); sd = BL_CAST(BL_PC, bl); p.PacketType = spawn_unit2Type; @@ -1244,6 +1253,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) int g_id = status->get_guild_id(bl); nullpo_retv(bl); + nullpo_retv(vd); #if PACKETVER < 20091103 if (!pc->db_checkid(vd->class)) { @@ -1357,6 +1367,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data nullpo_retv(bl); nullpo_retv(ud); + nullpo_retv(vd); sd = BL_CAST(BL_PC, bl); @@ -15474,6 +15485,7 @@ static void clif_parse_GMKick(int fd, struct map_session_data *sd) } npc->unload_duplicates(nd, true); npc->unload(nd, true, true); + npc->motd = npc->name2id("HerculesMOTD"); npc->read_event_script(); } break; @@ -22299,7 +22311,7 @@ static void clif_rodex_checkname_result(struct map_session_data *sd, int char_id sPacket->Class = class_; sPacket->BaseLevel = base_level; #if PACKETVER >= 20160316 - strncpy(sPacket->Name, name, NAME_LENGTH); + safestrncpy(sPacket->Name, name, NAME_LENGTH); #endif WFIFOSET(fd, sizeof(*sPacket)); #endif @@ -24192,7 +24204,7 @@ static int do_init_clif(bool minimal) timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); timer->add_func_list(clif->delayquit, "clif_delayquit"); - clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delay_clearunit_ers = ers_new(sizeof(struct mob_data), "clif.c::delay_clearunit_ers", ERS_OPT_CLEAR); clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); #if PACKETVER_MAIN_NUM >= 20190403 || PACKETVER_RE_NUM >= 20190320 |