From 3954b070de81a93a4ed1e58eba4d39d66c516d08 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 9 Apr 2006 22:13:25 +0000 Subject: [PATCH] - Modified @warp/@rura to prevent causing pc_setpos position error messages. - Fixed the mob's last_thinktime not being updated on mob_spawn, causing them to not "think". git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5971 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ src/map/atcommand.c | 39 ++++++++++++++++----------------------- src/map/mob.c | 1 + 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 978b8cdcb0..dd121ae339 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ 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. 2006/04/09 + * Modified @warp/@rura to prevent causing pc_setpos position error + messages. [Skotlex] + * Fixed the mob's last_thinktime not being updated on mob_spawn, causing + them to not "think". [Skotlex] * Fixed @npcmove not sending the correct packets to make the moving refresh client-side. [Skotlex] * Fixed mobs with aggressive + looter mode never looting. [Skotlex] diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 189843fd66..a6751cb852 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1236,11 +1236,6 @@ int atcommand_rura( return -1; } - if (x <= 0) - x = rand() % 399 + 1; - if (y <= 0) - y = rand() % 399 + 1; - if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); @@ -1252,24 +1247,22 @@ int atcommand_rura( clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } - - if (x > 0 && x < 400 && y > 0 && y < 400) { - if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, msg_table[247]); - return -1; - } - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, msg_table[248]); - return -1; - } - if (pc_setpos(sd, mapindex, x, y, 3) == 0) - clif_displaymessage(fd, msg_table[0]); // Warped. - else { - clif_displaymessage(fd, msg_table[1]); // Map not found. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. + + if (map_getcell(m, x, y, CELL_CHKNOPASS)) + x = y = 0; //Invalid cell, use random spot. + + if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, msg_table[247]); + return -1; + } + if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, msg_table[248]); + return -1; + } + if (pc_setpos(sd, mapindex, x, y, 3) == 0) + clif_displaymessage(fd, msg_table[0]); // Warped. + else { + clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } diff --git a/src/map/mob.c b/src/map/mob.c index 2fed0ca55b..509f1c3596 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -650,6 +650,7 @@ int mob_spawn (struct mob_data *md) unsigned int c =0, tick = gettick(); md->last_spawntime = tick; + md->last_thinktime = tick -MIN_MOBTHINKTIME; if (md->bl.prev != NULL) unit_remove_map(&md->bl,2); else if (md->vd->class_ != md->class_) {