summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 17:56:31 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 17:56:31 +0000
commit2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c (patch)
tree14a7873c785ec04068a85dc4148e349d32d2e6a3 /src/map/atcommand.c
parent74c9a56b7aa52fff54fa4a34a2f31910307b37eb (diff)
downloadhercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.gz
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.bz2
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.tar.xz
hercules-2de9fa2b9bcc944a5671a1965813a56b1e1dfd5c.zip
- Fixed @movenpc
- Cleaned up and improved the lootsearch routine to pick nearest item. - Added INVISIBLE_CLASS to the list of classes supported by npc_get_viewdata - Fixed trying to set the view_data for npcs who are located on a map, but have no visual data. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5959 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 089c88c3c..b7d172f35 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6999,7 +6999,7 @@ int
atcommand_npcmove(const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
- int x = 0, y = 0;
+ int x = 0, y = 0, m;
struct npc_data *nd = 0;
nullpo_retr(-1, sd);
@@ -7020,9 +7020,15 @@ atcommand_npcmove(const int fd, struct map_session_data* sd,
if ((nd = npc_name2id(atcmd_player_name)) == NULL)
return -1;
+ if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL)
+ return -1; //Not on a map.
+
npc_enable(atcmd_player_name, 0);
- nd->bl.x = x;
- nd->bl.y = y;
+ if (x < 0) x = 0;
+ else if (x >= map[m].xs) x = map[m].xs-1;
+ if (y < 0) y = 0;
+ else if (y >= map[m].ys) y = map[m].ys-1;
+ map_moveblock(&nd->bl, x, y, gettick());
npc_enable(atcmd_player_name, 1);
return 0;