diff options
-rw-r--r-- | Changelog-Trunk.txt | 6 | ||||
-rw-r--r-- | src/map/clif.c | 41 | ||||
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/unit.c | 30 |
4 files changed, 37 insertions, 44 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 0fc6bbc55..3c2a86018 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/02/02 + * Fixed the flag parameter not working on npcshopattach. + * Updated the walk delay code so that it parses homunculus as well as + players. What this means is that a homunculus walk request won't go ignored + if it's issued during the 'can't walk delay' after being hit. + * Added a possible crash protection in clif_skillfail when the player is + without a connection. [Skotlex] * Fine-tuned the global message processing function [ultramage] - now detects access-out-of-rfifo attempts (idea from eA++) - uses the new CHAT_SIZE define to restrict message lengths diff --git a/src/map/clif.c b/src/map/clif.c index 67cc0ad72..fb9b345d5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4328,6 +4328,7 @@ int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype) } fd=sd->fd; + if (!fd) return 0; if(battle_config.display_skill_fail&1) return 0; //Disable all skill failed messages @@ -8336,24 +8337,6 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { return; } -static int clif_walktoxy_timer(int tid, unsigned int tick, int id, int data) -{ - struct map_session_data *sd; - short x,y; - - if (!session[id] || (sd = session[id]->session_data) == NULL) - return 0; - - if (!unit_can_move(&sd->bl)) - return 0; - - x = data>>16; - y = data&0xffff; - - unit_walktoxy(&sd->bl, x, y, 0); - return 1; -} - /*========================================== * *------------------------------------------ @@ -8361,7 +8344,6 @@ static int clif_walktoxy_timer(int tid, unsigned int tick, int id, int data) void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { int x, y; int cmd; - unsigned int tick; RFIFOHEAD(fd); if (pc_isdead(sd)) { @@ -8388,16 +8370,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { //Set last idle time... [Skotlex] sd->idletime = last_tick; - tick = gettick(); - if (DIFF_TICK(sd->ud.canmove_tick, tick) > 0 && - DIFF_TICK(sd->ud.canmove_tick, tick) < 2000) - { // Delay walking command. [Skotlex] - add_timer(sd->ud.canmove_tick+1, clif_walktoxy_timer, fd, (x<<16)|y); - return; - } - if (!unit_can_move(&sd->bl)) - return; - unit_walktoxy(&sd->bl, x, y, 0); + unit_walktoxy(&sd->bl, x, y, 4); } /*========================================== @@ -11712,9 +11685,7 @@ void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) { //[orn] if(!merc_is_hom_active(sd->hd)) return; - if (!unit_can_move(&sd->hd->bl)) - return; - unit_walktoxy(&sd->hd->bl, sd->bl.x,sd->bl.y-1, 0); + unit_walktoxy(&sd->hd->bl, sd->bl.x,sd->bl.y-1, 4); } void clif_parse_HomMoveTo(int fd,struct map_session_data *sd) { //[orn] @@ -11731,10 +11702,7 @@ void clif_parse_HomMoveTo(int fd,struct map_session_data *sd) { //[orn] y = ((RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0]+1) & 0x3f) << 4) + (RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 2) >> 4); - if (!unit_can_move(&sd->hd->bl)) - return; - - unit_walktoxy(&(sd->hd->bl),x,y,0); + unit_walktoxy(&(sd->hd->bl),x,y,4); } void clif_parse_HomAttack(int fd,struct map_session_data *sd) { //[orn] @@ -12391,7 +12359,6 @@ int do_init_clif(void) { add_timer_func_list(clif_waitclose, "clif_waitclose"); add_timer_func_list(clif_clearchar_delay_sub, "clif_clearchar_delay_sub"); add_timer_func_list(clif_delayquit, "clif_delayquit"); - add_timer_func_list(clif_walktoxy_timer, "clif_walktoxy_timer"); return 0; } diff --git a/src/map/script.c b/src/map/script.c index 9ae8e3d55..3cce74af1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12014,8 +12014,8 @@ int buildin_npcshopattach(struct script_state *st) char* npcname = conv_str(st, & (st->stack->stack_data[st->start+2])); int flag = 1; - if( script_hasdata(st,2) ) - flag = conv_num(st, script_getdata(st,2)); + if( script_hasdata(st,3) ) + flag = conv_num(st, script_getdata(st,3)); nd = npc_name2id(npcname); diff --git a/src/map/unit.c b/src/map/unit.c index 30c47de06..53296f61a 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -261,8 +261,21 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) return 0; } -//Easy parameter: &1 -> 1/0 = easy/hard, &2 -> force walking. -int unit_walktoxy( struct block_list *bl, int x, int y, int easy) { +static int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, int data) +{ + struct block_list *bl = map_id2bl(id); + + if (!bl || bl->prev == NULL) + return 0; + unit_walktoxy(bl, data>>16, data&0xffff, 0); + return 1; +} + +//flag parameter: +//&1 -> 1/0 = easy/hard +//&2 -> force walking +//&4 -> Delay walking if the reason you can't walk is the canwalk delay +int unit_walktoxy( struct block_list *bl, int x, int y, int flag) { struct unit_data *ud = NULL; struct status_change *sc = NULL; @@ -272,10 +285,17 @@ int unit_walktoxy( struct block_list *bl, int x, int y, int easy) { if( ud == NULL) return 0; - if(!(easy&2) && (!status_get_mode(bl)&MD_CANMOVE || !unit_can_move(bl))) + if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 && + DIFF_TICK(ud->canmove_tick, gettick()) < 2000) + { // Delay walking command. [Skotlex] + add_timer(ud->canmove_tick+1, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF)); + return 1; + } + + if(!(flag&2) && (!status_get_mode(bl)&MD_CANMOVE || !unit_can_move(bl))) return 0; - ud->state.walk_easy = easy&1; + ud->state.walk_easy = flag&1; ud->target = 0; ud->to_x = x; ud->to_y = y; @@ -1905,7 +1925,7 @@ int do_init_unit(void) { add_timer_func_list(unit_attack_timer, "unit_attack_timer"); add_timer_func_list(unit_walktoxy_timer,"unit_walktoxy_timer"); add_timer_func_list(unit_walktobl_sub, "unit_walktobl_sub"); - + add_timer_func_list(unit_delay_walktoxy_timer,"unit_delay_walktoxy_timer"); return 0; } |