fixed segfault at maps load (got from Freya0

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@253 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
Lupus 2004-11-18 20:21:42 +00:00
parent da269444db
commit 4578230bbc

View File

@ -1608,7 +1608,7 @@ static int map_readmap(int m,char *fn, char *alias) {
*/
int map_readallmap(void) {
int i,maps_removed=0;
char fn[256]="";
char fn[256];
FILE *afm_file;
// 先に全部のャbプの存在を確認
@ -1621,6 +1621,7 @@ int map_readallmap(void) {
afm_file = fopen(fn, "r");
if (afm_file != NULL) {
map_readafm(i,fn);
fclose(afm_file);
}
else if(strstr(map[i].name,".gat")!=NULL) {
char *p = strstr(map[i].name, ">"); // [MouseJstr]
@ -1630,25 +1631,24 @@ int map_readallmap(void) {
strcpy(alias, map[i].name);
strcpy(map[i].name, p + 1);
sprintf(fn,"data\\%s",map[i].name);
if(grfio_size(fn) == -1 || map_readmap(i,fn, alias) == -1) {
if(map_readmap(i,fn, alias) == -1) {
map_delmap(map[i].name);
maps_removed++;
}
} else {
sprintf(fn,"data\\%s",map[i].name);
if(grfio_size(fn) == -1 || map_readmap(i,fn, NULL) == -1) {
if(map_readmap(i,fn, NULL) == -1) {
map_delmap(map[i].name);
maps_removed++;
}
}
}
if (afm_file != NULL)
fclose(afm_file);
}
free(waterlist);
printf("\rMaps Loaded: %d %60s\n",map_num,"");
printf("\rMaps Removed: %d \n",maps_removed);
return 0;
}