summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-27 20:24:44 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-27 20:24:44 +0000
commitd94f37c22a4c7306c2e062183a94cfaaf8856006 (patch)
treea7fdc03ff75dda8b953bc4a5eb4050453ef01c31
parenteaae489aded873b4ad756a0d3e49b7384f8a899a (diff)
downloadhercules-d94f37c22a4c7306c2e062183a94cfaaf8856006.tar.gz
hercules-d94f37c22a4c7306c2e062183a94cfaaf8856006.tar.bz2
hercules-d94f37c22a4c7306c2e062183a94cfaaf8856006.tar.xz
hercules-d94f37c22a4c7306c2e062183a94cfaaf8856006.zip
* Also checks for righty coordinates before actually loading the npc. Improves fix for bugreport:419.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17052 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/npc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index c11770a1e..0443c81f1 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3405,7 +3405,7 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
//@runOnInit should we exec OnInit when it's done ?
void npc_parsesrcfile(const char* filepath, bool runOnInit)
{
- int m, lines = 0;
+ int m, x, y, lines = 0;
FILE* fp;
size_t len;
char* buffer;
@@ -3486,11 +3486,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[2048];
- sscanf(w1,"%[^,]",mapname);
- if( !mapindex_name2id(mapname) )
+ char mapname[MAP_NAME_LENGTH*2];
+ 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) )
{// Incorrect map, we must skip the script info...
- ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer));
+ 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));
if( strcasecmp(w2,"script") == 0 && count > 3 )
{
if((p = npc_skip_script(p,buffer,filepath)) == NULL)