summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/map/atcommand.c42
2 files changed, 27 insertions, 19 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 6920f9ee0..7706c47ed 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2009/01/05
+ * Fixed @mobsearch and @showmobs (bugreport:2481) [ultramage]
+ - now only search for mobs on the same map as the caller
+ - now properly distinguish between dead and alive mobs
2008/12/31
* Changes to the script engine: [FlavioJS]
- new stack datatype script_retinfo for C_RETINFO to hold all the return state info
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 87c728426..bf052f5ba 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6315,7 +6315,7 @@ int atcommand_sound(const int fd, struct map_session_data *sd, const char *comma
int atcommand_mobsearch(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
char mob_name[100];
- int mob_id,map_id = 0;
+ int mob_id;
int number = 0;
struct s_mapiterator* it;
@@ -6337,8 +6337,6 @@ int atcommand_mobsearch(const int fd, struct map_session_data* sd, const char* c
strcpy(mob_name,mob_db(mob_id)->jname); // --ja--
// strcpy(mob_name,mob_db(mob_id)->name); // --en--
- map_id = sd->bl.m;
-
snprintf(atcmd_output, sizeof atcmd_output, "Mob Search... %s %s", mob_name, mapindex_id2name(sd->mapindex));
clif_displaymessage(fd, atcmd_output);
@@ -6349,12 +6347,17 @@ int atcommand_mobsearch(const int fd, struct map_session_data* sd, const char* c
if( md == NULL )
break;// no more mobs
- if( mob_id == -1 || md->class_ == mob_id )
- {
- ++number;
- snprintf(atcmd_output, sizeof atcmd_output, "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name);
- clif_displaymessage(fd, atcmd_output);
- }
+ if( md->bl.m != sd->bl.m )
+ continue;
+ if( mob_id != -1 && md->class_ != mob_id )
+ continue;
+
+ ++number;
+ if( md->spawn_timer == INVALID_TIMER )
+ snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name);
+ else
+ snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "dead", md->name);
+ clif_displaymessage(fd, atcmd_output);
}
mapit_free(it);
@@ -7015,7 +7018,7 @@ int atshowmobs_timer(int tid, unsigned int tick, int id, intptr data)
int atcommand_showmobs(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
char mob_name[100];
- int mob_id,map_id = 0;
+ int mob_id;
int number = 0;
struct s_mapiterator* it;
@@ -7044,8 +7047,6 @@ int atcommand_showmobs(const int fd, struct map_session_data* sd, const char* co
strcpy(mob_name,mob_db(mob_id)->jname); // --ja--
//strcpy(mob_name,mob_db(mob_id)->name); // --en--
- map_id = sd->bl.m;
-
snprintf(atcmd_output, sizeof atcmd_output, "Mob Search... %s %s",
mob_name, mapindex_id2name(sd->mapindex));
clif_displaymessage(fd, atcmd_output);
@@ -7057,15 +7058,18 @@ int atcommand_showmobs(const int fd, struct map_session_data* sd, const char* co
if( md == NULL )
break;// no more mobs
+ if( md->bl.m != sd->bl.m )
+ continue;
+ if( mob_id != -1 && md->class_ != mob_id )
+ continue;
if( md->special_state.ai || md->master_id )
- continue;//Hide slaves and player summoned mobs. [Skotlex]
+ continue; // hide slaves and player summoned mobs
+ if( md->spawn_timer != INVALID_TIMER )
+ continue; // hide mobs waiting for respawn
- if( mob_id == -1 || md->class_ == mob_id )
- {
- ++number;
- clif_viewpoint(sd, 1, 1, md->bl.x, md->bl.y, number, 0xFFFFFF);
- add_timer(gettick()+5000, atshowmobs_timer, sd->bl.id, number);
- }
+ ++number;
+ clif_viewpoint(sd, 1, 1, md->bl.x, md->bl.y, number, 0xFFFFFF);
+ add_timer(gettick()+5000, atshowmobs_timer, sd->bl.id, number);
}
mapit_free(it);