summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-18 20:21:42 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-18 20:21:42 +0000
commitdb1d85ba43de36a3dfc115c66e9f6dc404f98cfc (patch)
tree522b156b776762fd660906db1b5b4a8ff012f815 /src
parent43ef20ac3322589050c6fd670861925512aadb84 (diff)
downloadhercules-db1d85ba43de36a3dfc115c66e9f6dc404f98cfc.tar.gz
hercules-db1d85ba43de36a3dfc115c66e9f6dc404f98cfc.tar.bz2
hercules-db1d85ba43de36a3dfc115c66e9f6dc404f98cfc.tar.xz
hercules-db1d85ba43de36a3dfc115c66e9f6dc404f98cfc.zip
fixed segfault at maps load (got from Freya0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@253 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 755069b80..98144babe 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -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プの存在を確認
@@ -1616,39 +1616,39 @@ int map_readallmap(void) {
char afm_name[256] = "";
strncpy(afm_name, map[i].name, strlen(map[i].name) - 4);
strcat(afm_name, ".afm");
-
+
sprintf(fn,"%s\\%s",afm_dir,afm_name);
afm_file = fopen(fn, "r");
- if (afm_file != NULL) {
+ 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]
- if (p != NULL) {
- char alias[64];
- *p = '\0';
- 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) {
- 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) {
- map_delmap(map[i].name);
- maps_removed++;
- }
- }
- }
- if (afm_file != NULL)
- fclose(afm_file);
+ char *p = strstr(map[i].name, ">"); // [MouseJstr]
+ if (p != NULL) {
+ char alias[64];
+ *p = '\0';
+ strcpy(alias, map[i].name);
+ strcpy(map[i].name, p + 1);
+ sprintf(fn,"data\\%s",map[i].name);
+ if(map_readmap(i,fn, alias) == -1) {
+ map_delmap(map[i].name);
+ maps_removed++;
+ }
+ } else {
+ sprintf(fn,"data\\%s",map[i].name);
+ if(map_readmap(i,fn, NULL) == -1) {
+ map_delmap(map[i].name);
+ maps_removed++;
+ }
+ }
+ }
}
free(waterlist);
printf("\rMaps Loaded: %d %60s\n",map_num,"");
printf("\rMaps Removed: %d \n",maps_removed);
+
return 0;
}