summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-16 16:19:32 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-16 16:19:32 +0000
commit3531bd5992af838ba43f886a4c9c01745bb6062a (patch)
tree26887862d4541850158d42c08a2f3890b32ad9c0
parent6170c4fe2a6dc695a87b79c7d5d0aa4b395af7fa (diff)
downloadhercules-3531bd5992af838ba43f886a4c9c01745bb6062a.tar.gz
hercules-3531bd5992af838ba43f886a4c9c01745bb6062a.tar.bz2
hercules-3531bd5992af838ba43f886a4c9c01745bb6062a.tar.xz
hercules-3531bd5992af838ba43f886a4c9c01745bb6062a.zip
- 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
-rw-r--r--Changelog-Trunk.txt5
-rw-r--r--conf-tmpl/mapflag/water_height.txt180
-rw-r--r--src/common/grfio.c5
-rw-r--r--src/map/map.c52
4 files changed, 17 insertions, 225 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 92cffd233..fe8435c46 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/16
+ * Removed water_height.txt reading (since it is always done from the rsw
+ now) [Skotlex]
+ * Fixed a possible crash in grfio_find_file [Skotlex]
+ * Corrected water-level-reading to account for a return of null from the
+ previously mentioned function [Skotlex]
* Fixed mysql ping setting being in minutes rather than hours. [Skotlex]
* Removed npc_event_sub from npc.h and moved it to npc.c [Skotlex]
* Cleaned up #warp to prevent spitting non-walkable tile warnings. [Skotlex]
diff --git a/conf-tmpl/mapflag/water_height.txt b/conf-tmpl/mapflag/water_height.txt
deleted file mode 100644
index 7908f363c..000000000
--- a/conf-tmpl/mapflag/water_height.txt
+++ /dev/null
@@ -1,180 +0,0 @@
-// Water Height aliases for maps.
-// It affects WATER related skills as Water Ball, creation Holy Water, etc
-// map_name map_water_level_to_use
-// Example: Use geffen's water level for prontera when prontera.rsw isn't found in the grf.
-// prontera.gat geffen.gat
-// You can also directly specify the rsw file:
-// prontera.gat geffen.rsw
-
-force_1-1.gat force_map1.rsw
-force_2-1.gat force_map1.rsw
-force_3-1.gat force_map1.rsw
-force_1-2.gat force_map2.rsw
-force_2-2.gat force_map2.rsw
-force_3-2.gat force_map2.rsw
-force_1-3.gat force_map3.rsw
-force_2-3.gat force_map3.rsw
-force_3-3.gat force_map3.rsw
-hunter_1-1.gat job_hunter.rsw
-hunter_2-1.gat job_hunter.rsw
-hunter_3-1.gat job_hunter.rsw
-knight_1-1.gat job_knight.rsw
-knight_2-1.gat job_knight.rsw
-knight_3-1.gat job_knight.rsw
-priest_1-1.gat job_priest.rsw
-priest_2-1.gat job_priest.rsw
-priest_3-1.gat job_priest.rsw
-sword_1-1.gat job_sword1.rsw
-sword_2-1.gat job_sword1.rsw
-sword_3-1.gat job_sword1.rsw
-wizard_1-1.gat job_wizard.rsw
-wizard_2-1.gat job_wizard.rsw
-wizard_3-1.gat job_wizard.rsw
-new_1-1.gat new_zone01.rsw
-new_2-1.gat new_zone01.rsw
-new_3-1.gat new_zone01.rsw
-new_4-1.gat new_zone01.rsw
-new_5-1.gat new_zone01.rsw
-new_1-2.gat new_zone02.rsw
-new_2-2.gat new_zone02.rsw
-new_3-2.gat new_zone02.rsw
-new_4-2.gat new_zone02.rsw
-new_5-2.gat new_zone02.rsw
-new_1-3.gat new_zone03.rsw
-new_2-3.gat new_zone03.rsw
-new_3-3.gat new_zone03.rsw
-new_4-3.gat new_zone03.rsw
-new_5-3.gat new_zone03.rsw
-new_1-4.gat new_zone04.rsw
-new_2-4.gat new_zone04.rsw
-new_3-4.gat new_zone04.rsw
-new_4-4.gat new_zone04.rsw
-new_5-4.gat new_zone04.rsw
-ordeal_1-1.gat ordeal_a00.rsw
-ordeal_2-1.gat ordeal_a00.rsw
-ordeal_3-1.gat ordeal_a00.rsw
-ordeal_1-2.gat ordeal_a02.rsw
-ordeal_2-2.gat ordeal_a02.rsw
-ordeal_3-2.gat ordeal_a02.rsw
-ordeal_1-3.gat ordeal_a03.rsw
-ordeal_2-3.gat ordeal_a03.rsw
-ordeal_3-3.gat ordeal_a03.rsw
-ordeal_1-4.gat ordeal_a04.rsw
-ordeal_2-4.gat ordeal_a04.rsw
-ordeal_3-4.gat ordeal_a04.rsw
-pvp_n_1-1.gat prt_maze02.rsw
-pvp_n_2-1.gat prt_maze02.rsw
-pvp_n_3-1.gat prt_maze02.rsw
-pvp_n_4-1.gat prt_maze02.rsw
-pvp_n_5-1.gat prt_maze02.rsw
-pvp_n_6-1.gat prt_maze02.rsw
-pvp_n_7-1.gat prt_maze02.rsw
-pvp_n_8-1.gat prt_maze02.rsw
-pvp_n_1-2.gat job_hunter.rsw
-pvp_n_2-2.gat job_hunter.rsw
-pvp_n_3-2.gat job_hunter.rsw
-pvp_n_4-2.gat job_hunter.rsw
-pvp_n_5-2.gat job_hunter.rsw
-pvp_n_6-2.gat job_hunter.rsw
-pvp_n_7-2.gat job_hunter.rsw
-pvp_n_8-2.gat job_hunter.rsw
-pvp_n_1-3.gat job_wizard.rsw
-pvp_n_2-3.gat job_wizard.rsw
-pvp_n_3-3.gat job_wizard.rsw
-pvp_n_4-3.gat job_wizard.rsw
-pvp_n_5-3.gat job_wizard.rsw
-pvp_n_6-3.gat job_wizard.rsw
-pvp_n_7-3.gat job_wizard.rsw
-pvp_n_8-3.gat job_wizard.rsw
-pvp_n_1-4.gat job_priest.rsw
-pvp_n_2-4.gat job_priest.rsw
-pvp_n_3-4.gat job_priest.rsw
-pvp_n_4-4.gat job_priest.rsw
-pvp_n_5-4.gat job_priest.rsw
-pvp_n_6-4.gat job_priest.rsw
-pvp_n_7-4.gat job_priest.rsw
-pvp_n_8-4.gat job_priest.rsw
-pvp_n_1-5.gat job_knight.rsw
-pvp_n_2-5.gat job_knight.rsw
-pvp_n_3-5.gat job_knight.rsw
-pvp_n_4-5.gat job_knight.rsw
-pvp_n_5-5.gat job_knight.rsw
-pvp_n_6-5.gat job_knight.rsw
-pvp_n_7-5.gat job_knight.rsw
-pvp_n_8-5.gat job_knight.rsw
-pvp_y_1-1.gat prontera.rsw
-pvp_y_1-2.gat izlude.rsw
-pvp_y_1-3.gat payon.rsw
-pvp_y_1-4.gat alberta.rsw
-pvp_y_1-5.gat morocc.rsw
-pvp_y_2-1.gat prontera.rsw
-pvp_y_2-2.gat izlude.rsw
-pvp_y_2-3.gat payon.rsw
-pvp_y_2-4.gat alberta.rsw
-pvp_y_2-5.gat morocc.rsw
-pvp_y_3-1.gat prontera.rsw
-pvp_y_3-2.gat izlude.rsw
-pvp_y_3-3.gat payon.rsw
-pvp_y_3-4.gat alberta.rsw
-pvp_y_3-5.gat morocc.rsw
-pvp_y_4-1.gat prontera.rsw
-pvp_y_4-2.gat izlude.rsw
-pvp_y_4-3.gat payon.rsw
-pvp_y_4-4.gat alberta.rsw
-pvp_y_4-5.gat morocc.rsw
-pvp_y_5-1.gat prontera.rsw
-pvp_y_5-2.gat izlude.rsw
-pvp_y_5-3.gat payon.rsw
-pvp_y_5-4.gat alberta.rsw
-pvp_y_5-5.gat morocc.rsw
-pvp_y_6-1.gat prontera.rsw
-pvp_y_6-2.gat izlude.rsw
-pvp_y_6-3.gat payon.rsw
-pvp_y_6-4.gat alberta.rsw
-pvp_y_6-5.gat morocc.rsw
-pvp_y_7-1.gat prontera.rsw
-pvp_y_7-2.gat izlude.rsw
-pvp_y_7-3.gat payon.rsw
-pvp_y_7-4.gat alberta.rsw
-pvp_y_7-5.gat morocc.rsw
-pvp_y_8-1.gat prontera.rsw
-pvp_y_8-2.gat izlude.rsw
-pvp_y_8-3.gat payon.rsw
-pvp_y_8-4.gat alberta.rsw
-pvp_y_8-5.gat morocc.rsw
-pvp_y_room.gat pvp_room.rsw
-pvp_c_room.gat pvp_room.rsw
-pvp_n_room.gat pvp_room.rsw
-sword_1-1.gat job_sword1.rsw
-sword_2-1.gat job_sword1.rsw
-sword_3-1.gat job_sword1.rsw
-g_room1-1.gat quiz_01.rsw
-g_room1-2.gat quiz_01.rsw
-g_room1-3.gat quiz_01.rsw
-g_room2.gat quiz_01.rsw
-guild_room.gat quiz_01.rsw
-guild_vs1-1.gat guild_vs1.rsw
-guild_vs1-2.gat guild_vs1.rsw
-guild_vs1-3.gat guild_vs1.rsw
-guild_vs1-4.gat guild_vs1.rsw
-guild_vs2-1.gat guild_vs2.rsw
-guild_vs2-2.gat guild_vs2.rsw
-quiz_test.gat monk_test.rsw
-himinn.gat valkyrie.rsw
-nguild_prt.gat prtg_cas01.rsw
-nguild_pay.gat payg_cas01.rsw
-nguild_alde.gat aldeg_cas01.rsw
-nguild_gef.gat gefg_cas01.rsw
-turbo_n_1.gat alde_tt02.rsw
-turbo_n_4.gat alde_tt02.rsw
-turbo_n_8.gat alde_tt02.rsw
-turbo_n_16.gat alde_tt02.rsw
-turbo_e_4.gat alde_tt02.rsw
-turbo_e_8.gat alde_tt02.rsw
-turbo_e_16.gat alde_tt02.rsw
-que_sign02.gat nif_fild02.rsw
-y_airport.gat airport.rsw
-lhz_airport.gat airport.rsw
-airplane_01.gat airplane.rsw
-que_job03.gat que_job02.rsw
-p_track02.gat p_track01.rsw
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 612932e24..81a5ef7c5 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -20,6 +20,7 @@
* 2003/10/21 ... The data of alpha client was read.
* 2003/11/10 ... Ready new grf format.
* 2003/11/11 ... version check fix & bug fix
+ * 2006/04/16 ... fixed crash grfio_find_file when file is not found.
*/
#include <stdio.h>
@@ -456,7 +457,9 @@ static FILELIST *filelist_find(char *fname)
}
char *grfio_find_file(char *fname){
- return ((filelist_find(fname)->fnd == NULL)? filelist_find(fname)->fn: filelist_find(fname)->fnd);
+ FILELIST *filelist = filelist_find(fname);
+ if (!filelist) return NULL;
+ return (!filelist->fnd?filelist->fn:filelist->fnd);
}
/*==========================================
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,"");