From 371293407ca9937a03942a2f8e32f2eb7c87940c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Dec 2014 02:20:03 +0300 Subject: Fix hookStop usage. --- src/map/clif.c | 6 +++--- src/map/itemdb.c | 8 +++++++- src/map/npc.c | 2 +- src/map/pc.c | 11 ++++++----- src/map/quest.c | 9 ++++++--- src/map/unit.c | 17 ++++++++++++++++- 6 files changed, 39 insertions(+), 14 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 4d3160c..25bf56f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -25,7 +25,6 @@ void eclif_quest_send_list(struct map_session_data *sd) { - hookStop(); int fd = sd->fd; int i; int info_len = 15; @@ -46,11 +45,11 @@ void eclif_quest_send_list(struct map_session_data *sd) } WFIFOSET(fd, len); + hookStop(); } void eclif_quest_add(struct map_session_data *sd, struct quest *qd) { - hookStop(); int fd = sd->fd; struct quest_db *qi = quest->db(qd->quest_id); @@ -63,6 +62,7 @@ void eclif_quest_add(struct map_session_data *sd, struct quest *qd) WFIFOW(fd, 15) = 0; WFIFOSET(fd, 107); + hookStop(); } void eclif_charnameack(int *fdPtr, struct block_list *bl) @@ -74,7 +74,6 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl) } if (bl->type == BL_NPC) { - hookStop(); int fd = *fdPtr; struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data; const char *tr = lang_pctrans(((TBL_NPC*)bl)->name, sd); @@ -101,6 +100,7 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl) memcpy(WFIFOP(fd, 8), tr, trLen); WFIFOSET(fd, len); } + hookStop(); } } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 5d1f51b..587441c 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -30,15 +30,21 @@ void eitemdb_readdb_additional_fields(int *itemid, int *n __attribute__ ((unused)), const char *source __attribute__ ((unused))) { - hookStop(); struct item_data *item = itemdb->exists(*itemid); int i32 = 0; if (!item) + { + hookStop(); return; + } struct ItemdExt *data = itemd_get(item); if (!data) + { + hookStop(); return; + } if (libconfig->setting_lookup_int(it, "FloorLifeTime", &i32) && i32 >= 0) data->floorLifeTime = i32; + hookStop(); } diff --git a/src/map/npc.c b/src/map/npc.c index 74ec586..aba7288 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -23,7 +23,6 @@ void enpc_parse_unknown_mapflag(const char *name, char *w3, char *w4, const char* start, const char* buffer, const char* filepath, int *retval) { - hookStop(); if (!strcmpi(w3, "invisible")) { int16 m = map->mapname2mapid(name); @@ -51,6 +50,7 @@ void enpc_parse_unknown_mapflag(const char *name, char *w3, char *w4, const char if (retval) *retval = EXIT_FAILURE; } + hookStop(); } int enpc_buysellsel(struct map_session_data* sd, int *id, int *type) diff --git a/src/map/pc.c b/src/map/pc.c index fddcdea..6272f40 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -25,8 +25,8 @@ int epc_readparam_pre(struct map_session_data* sd, int *type) { if (*type == Const_ClientVersion) { - hookStop(); struct SessionExt *data = session_get_bysd(sd); + hookStop(); if (!data) return 0; return data->clientVersion; @@ -51,22 +51,22 @@ int epc_setregistry(struct map_session_data *sd, int64 *reg, int *val) #define equipPos(mask, field, lookf) \ if (pos & mask) \ { \ - hookStop(); \ if (id) \ sd->status.field = id->look; \ else \ sd->status.field = 0; \ clif->changelook(&sd->bl, lookf, sd->status.field); \ + hookStop(); \ } #define equipPos2(mask, lookf) \ if (pos & mask) \ { \ - hookStop(); \ if (id) \ clif->changelook(&sd->bl, lookf, id->look); \ else \ clif->changelook(&sd->bl, lookf, 0); \ + hookStop(); \ } void epc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int *posPtr) @@ -93,16 +93,16 @@ void epc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int *p #define unequipPos(mask, field, lookf) \ if (pos & mask) \ { \ - hookStop(); \ sd->status.field = 0; \ clif->changelook(&sd->bl, lookf, sd->status.field); \ + hookStop(); \ } #define unequipPos2(mask, lookf) \ if (pos & mask) \ { \ - hookStop(); \ clif->changelook(&sd->bl, lookf, 0); \ + hookStop(); \ } void epc_unequipitem_pos(struct map_session_data *sd, int *nPtr, int *posPtr) @@ -141,4 +141,5 @@ bool epc_can_attack (struct map_session_data *sd, int *target_id) return false; } } + return true; } diff --git a/src/map/quest.c b/src/map/quest.c index de77bcc..a65e08a 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -16,7 +16,6 @@ int equest_read_db(void) { - hookStop(); FILE *fp; char line[1024]; int i, count = 0; @@ -24,12 +23,15 @@ int equest_read_db(void) struct quest_db entry; sprintf(line, "%s/quest_db.txt", map->db_path); - if ((fp=fopen(line,"r"))==NULL) { + if ((fp = fopen(line, "r")) == NULL) + { ShowError("can't read %s\n", line); + hookStop(); return -1; } - while (fgets(line, sizeof(line), fp)) { + while (fgets(line, sizeof(line), fp)) + { if (line[0]=='/' && line[1]=='/') continue; memset(str,0,sizeof(str)); @@ -77,5 +79,6 @@ int equest_read_db(void) } fclose(fp); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, "quest_db.txt"); + hookStop(); return 0; } diff --git a/src/map/unit.c b/src/map/unit.c index df875cf..2e6276e 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -26,16 +26,21 @@ int eunit_can_move(struct block_list *bl) struct unit_data *ud; struct status_change *sc; - hookStop(); if (!bl) + { + hookStop(); return 0; + } ud = unit->bl2ud(bl); sc = status->get_sc(bl); sd = BL_CAST(BL_PC, bl); if (!ud) + { + hookStop(); return 0; + } if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK @@ -43,17 +48,22 @@ int eunit_can_move(struct block_list *bl) || !pc->checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL)) { + hookStop(); return 0; // prevent moving while casting } if (DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0) + { + hookStop(); return 0; + } if (sd && ( sd->state.vending || sd->state.buyingstore || sd->state.blockedmove)) { + hookStop(); return 0; //Can't move } @@ -99,6 +109,7 @@ int eunit_can_move(struct block_list *bl) || (sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT || (sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE)))) { + hookStop(); return 0; } if (sc->opt1 > 0 @@ -107,11 +118,13 @@ int eunit_can_move(struct block_list *bl) && !(sc->opt1 == OPT1_CRYSTALIZE && bl->type == BL_MOB)) { + hookStop(); return 0; } if ((sc->option & OPTION_HIDE) && (!sd || pc->checkskill(sd, RG_TUNNELDRIVE) <= 0)) { + hookStop(); return 0; } } @@ -124,9 +137,11 @@ int eunit_can_move(struct block_list *bl) || (!(md->status.mode&MD_BOSS) && battle->bc->mob_icewall_walk_block == 1 && map->getcell(bl->m,bl->x,bl->y,CELL_CHKICEWALL)))) { md->walktoxy_fail_count = 1; //Make sure rudeattacked skills are invoked + hookStop(); return 0; } } + hookStop(); return 1; } -- cgit v1.2.3-60-g2f50