summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-27 22:00:14 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-27 22:00:14 +0000
commit793c5d77e23357c5880e1422c539e5e0cd581eb7 (patch)
tree5a3e1403f9d17ba0f281db0eb93ce73372f0e4af /src/map/npc.c
parentd94f37c22a4c7306c2e062183a94cfaaf8856006 (diff)
downloadhercules-793c5d77e23357c5880e1422c539e5e0cd581eb7.tar.gz
hercules-793c5d77e23357c5880e1422c539e5e0cd581eb7.tar.bz2
hercules-793c5d77e23357c5880e1422c539e5e0cd581eb7.tar.xz
hercules-793c5d77e23357c5880e1422c539e5e0cd581eb7.zip
* Fixed bugreport:7052, npcs with monster sprite now work.
* Follow up to r17052, now it properly resets the x and y coordinate for every npc and checks it after the map. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17053 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 0443c81f1..67eff6f8c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3487,10 +3487,11 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
if( strcmp(w1,"-") !=0 && strcasecmp(w1,"function") != 0 )
{// w1 = <map name>,<x>,<y>,<facing>
char mapname[MAP_NAME_LENGTH*2];
+ x = y = 0;
sscanf(w1,"%23[^,],%d,%d[^,]",mapname,&x,&y);
- if( !mapindex_name2id(mapname) || (x < 0 || x >= map[map_mapname2mapid(mapname)].xs || y < 0 || y >= map[map_mapname2mapid(mapname)].ys) )
+ if( !mapindex_name2id(mapname) )
{// Incorrect map, we must skip the script info...
- ShowError("npc_parsesrcfile: Unknown map '%s' or coordinates ('%d', '%d') in file '%s', line '%d'. Skipping line...\n", mapname, x, y, filepath, strline(buffer,p-buffer));
+ ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer));
if( strcasecmp(w2,"script") == 0 && count > 3 )
{
if((p = npc_skip_script(p,buffer,filepath)) == NULL)
@@ -3514,6 +3515,18 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
p = strchr(p,'\n');// next line
continue;
}
+ if (x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys) {
+ ShowError("npc_parsesrcfile: Unknown coordinates ('%d', '%d') for map '%s' in file '%s', line '%d'. Skipping line...\n", x, y, mapname, filepath, strline(buffer,p-buffer));
+ if( strcasecmp(w2,"script") == 0 && count > 3 )
+ {
+ if((p = npc_skip_script(p,buffer,filepath)) == NULL)
+ {
+ break;
+ }
+ }
+ p = strchr(p,'\n');// next line
+ continue;
+ }
}
if( strcasecmp(w2,"warp") == 0 && count > 3 )