From 3531bd5992af838ba43f886a4c9c01745bb6062a Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 16 Apr 2006 16:19:32 +0000 Subject: - Removed water_height.txt reading (since it is always done from the rsw now) - Fixed a possible crash in grfio_find_file - Corrected water-level-reading to account for a return of null from the previously mentioned function git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6117 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 52 ++++++++-------------------------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index 94bc6a57c..5eef78856 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2290,15 +2290,6 @@ int map_eraseipport(unsigned short mapindex,unsigned long ip,int port) return 0; } -// 初期化周り -/*========================================== - * 水場高さ設定 - *------------------------------------------ - */ -//static struct waterlist_ { -// char mapname[MAP_NAME_LENGTH], clonemapname[MAP_NAME_LENGTH]; -//} *waterlist=NULL; - #define NO_WATER 1000000 static int map_setwaterheight_sub(int m) { @@ -2345,7 +2336,7 @@ int map_setwaterheight(int m, char *mapname, int height) { * Returns water height (or NO_WATER if file doesn't exist) * or other error is encountered. * This receives a map-name, and changes the extension to rsw if it isn't set already. - * assumed path for file is data/mapname.rsw + * Assumed path for file is data/mapname.rsw * Credits to LittleWolf */ int map_waterheight(char *mapname) { @@ -2354,18 +2345,16 @@ int map_waterheight(char *mapname) { float whtemp; int wh; - //Look up for clone map. - //if(waterlist){ - // int i; - // for(i=0;waterlist[i].mapname[0] && i < MAX_MAP_PER_SERVER;i++) - // if(strcmp(waterlist[i].mapname,mapname)==0) - // return map_waterheight(waterlist[i].clonemapname); - //} //Look up for the rsw - sprintf(fn,"data\\%s",mapname); + if(!strstr(mapname,"data\\")) + sprintf(fn,"data\\%s", mapname); + else + strcpy(fn, mapname); found = grfio_find_file(fn); - if(!strstr(found,"data\\")) + if (!found) + ; //Stick to the current fn + else if(!strstr(found,"data\\")) sprintf(fn,"data\\%s", found); else strcpy(fn, found); @@ -2387,30 +2376,6 @@ int map_waterheight(char *mapname) { return NO_WATER; } -//static void map_readwater(char *watertxt) { -// char line[1024],w1[1024],w2[1024]; -// FILE *fp=NULL; -// int n=0; -// -// fp=fopen(watertxt,"r"); -// if(fp==NULL){ -// ShowError("file not found: %s\n",watertxt); -// return; -// } -// if(waterlist==NULL) -// waterlist = (struct waterlist_*)aCallocA(MAX_MAP_PER_SERVER,sizeof(*waterlist)); -// while(fgets(line,1020,fp) && n < MAX_MAP_PER_SERVER){ -// if(line[0] == '/' && line[1] == '/') -// continue; -// if(sscanf(line,"%s %s",w1,w2) < 2){ -// continue; -// } -// memcpy(waterlist[n].mapname,w1, MAP_NAME_LENGTH-1); -// memcpy(waterlist[n].clonemapname, w2, MAP_NAME_LENGTH-1); -// n++; -// } -// fclose(fp); -//} /*========================================== * マップキャッシュに追加する *===========================================*/ @@ -3133,7 +3098,6 @@ int map_readallmaps (void) } // finished map loading - //aFree(waterlist); printf("\r"); ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps.%30s\n",map_num,""); -- cgit v1.2.3-60-g2f50