summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-13 20:24:08 +0000
committerDracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-13 20:24:08 +0000
commited39bb7197c749c28f1de75a4219329465b0fa08 (patch)
treef0b59d7408c3725da780acc84f8e00e55311a786
parent6f11fef3afc1a235628ff21aa2f2348abab4a97f (diff)
downloadhercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.gz
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.bz2
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.xz
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.zip
Mapcache update, should polish off remaining bugs
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10003 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt7
-rw-r--r--conf-tmpl/grf-files.txt15
-rw-r--r--db/grf_files.txt (renamed from tools/mapcache/grf_files.txt)0
-rw-r--r--db/map_index.txt710
-rw-r--r--db/map_list.txt (renamed from tools/mapcache/map_list.txt)67
-rw-r--r--src/char/char.c24
-rw-r--r--src/char_sql/char.c4
-rw-r--r--src/common/grfio.c874
-rw-r--r--src/common/mapindex.c24
-rw-r--r--src/common/mapindex.h51
-rw-r--r--src/map/atcommand.c97
-rw-r--r--src/map/charcommand.c6
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/guild.c8
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/map.c22
-rw-r--r--src/map/script.c246
-rw-r--r--src/tool/mapcache.c7
-rw-r--r--vcproj-8/char-server_txt.vcproj2
19 files changed, 330 insertions, 1867 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 7659c9b8a..92a9ed67a 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,13 @@ 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.
2007/03/14
+ * Finished polishing the new mapcache system [DracoRPG]
+ - common/grfio.* now empty except zipping functions (to read mapcache)
+ - servers do not use .gat internally anymore
+ => YOU CAN (and should) STOP USING .gat IN YOUR SCRIPTS
+ - moved files for the mapcache builder to db/ for now
+ - the char-server now uses the same index list as the mapcache builder
+ => poring_c01, poring_c02 and ng_quest mapindex have changed, beware
* Updated sql files [Playtester]
* Adjusted @pvpoff, @gvgoff, @killer, @killable to make characters stop
attacking when used.
diff --git a/conf-tmpl/grf-files.txt b/conf-tmpl/grf-files.txt
deleted file mode 100644
index ef2421925..000000000
--- a/conf-tmpl/grf-files.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-//-----------------------------------------
-// GRF List
-//-----------------------------------------
-
-grf: C:\Program Files\Gravity\RO\data.grf
-grf: C:\Program Files\Gravity\RO\sdata.grf
-
-// You may add more in this format
-// grf: <data file path>
-
-//------ Others ---------------------------
-
-//Path to directory that contains the data dir
-//NOTE: Path must include trailing backslash, only one data_dir entry is supported.
-//data_dir: C:\Program Files\Gravity\RO\
diff --git a/tools/mapcache/grf_files.txt b/db/grf_files.txt
index 38e4bca90..38e4bca90 100644
--- a/tools/mapcache/grf_files.txt
+++ b/db/grf_files.txt
diff --git a/db/map_index.txt b/db/map_index.txt
deleted file mode 100644
index dd2f9ea7c..000000000
--- a/db/map_index.txt
+++ /dev/null
@@ -1,710 +0,0 @@
-//======================================================================================
-// Map Index
-//======================================================================================
-//Contains the list of maps with their respective IDs for inter-server use.
-//IDs must never change, therefore any new maps need to be added at the end,
-//and old ones must not be removed, but may be replaced.
-//Format:
-//mapname<tab>index <- specifies index for this map
-//mapname <- map will use index of previous map +1
-//Note that map index 0 is special and reserved for "error" status.
-//Note: The extension is optional, all maps will have their extension set to
-// ".gat" upon loading.
-unknown.gat 0
-alb_ship.gat
-alb2trea.gat
-alberta.gat
-alberta_in.gat
-alde_dun01.gat
-alde_dun02.gat
-alde_dun03.gat
-alde_dun04.gat
-aldeba_in.gat
-aldebaran.gat
-anthell01.gat
-anthell02.gat
-arena_room.gat
-c_tower1.gat
-c_tower2.gat
-c_tower3.gat
-c_tower4.gat
-force_1-1.gat
-force_1-2.gat
-force_1-3.gat
-force_2-1.gat
-force_2-2.gat
-force_2-3.gat
-force_3-1.gat
-force_3-2.gat
-force_3-3.gat
-gef_dun00.gat
-gef_dun01.gat
-gef_dun02.gat
-gef_dun03.gat
-gef_fild00.gat
-gef_fild01.gat
-gef_fild02.gat
-gef_fild03.gat
-gef_fild04.gat
-gef_fild05.gat
-gef_fild06.gat
-gef_fild07.gat
-gef_fild08.gat
-gef_fild09.gat
-gef_fild10.gat
-gef_fild11.gat
-gef_fild12.gat
-gef_fild13.gat
-gef_fild14.gat
-gef_tower.gat
-geffen.gat
-geffen_in.gat
-gl_cas01.gat
-gl_cas02.gat
-gl_church.gat
-gl_chyard.gat
-gl_dun01.gat
-gl_dun02.gat
-gl_in01.gat
-gl_knt01.gat
-gl_knt02.gat
-gl_prison.gat
-gl_prison1.gat
-gl_sew01.gat
-gl_sew02.gat
-gl_sew03.gat
-gl_sew04.gat
-gl_step.gat
-glast_01.gat
-hunter_1-1.gat
-hunter_2-1.gat
-hunter_3-1.gat
-in_hunter.gat
-in_moc_16.gat
-in_orcs01.gat
-in_sphinx1.gat
-in_sphinx2.gat
-in_sphinx3.gat
-in_sphinx4.gat
-in_sphinx5.gat
-iz_dun00.gat
-iz_dun01.gat
-iz_dun02.gat
-iz_dun03.gat
-iz_dun04.gat
-job_sword1.gat
-izlu2dun.gat
-izlude.gat
-izlude_in.gat
-job_thief1.gat
-knight_1-1.gat
-knight_2-1.gat
-knight_3-1.gat
-mjo_dun01.gat
-mjo_dun02.gat
-mjo_dun03.gat
-mjolnir_01.gat
-mjolnir_02.gat
-mjolnir_03.gat
-mjolnir_04.gat
-mjolnir_05.gat
-mjolnir_06.gat
-mjolnir_07.gat
-mjolnir_08.gat
-mjolnir_09.gat
-mjolnir_10.gat
-mjolnir_11.gat
-mjolnir_12.gat
-moc_castle.gat
-moc_fild01.gat
-moc_fild02.gat
-moc_fild03.gat
-moc_fild04.gat
-moc_fild05.gat
-moc_fild06.gat
-moc_fild07.gat
-moc_fild08.gat
-moc_fild09.gat
-moc_fild10.gat
-moc_fild11.gat
-moc_fild12.gat
-moc_fild13.gat
-moc_fild14.gat
-moc_fild15.gat
-moc_fild16.gat
-moc_fild17.gat
-moc_fild18.gat
-moc_fild19.gat
-moc_pryd01.gat
-moc_pryd02.gat
-moc_pryd03.gat
-moc_pryd04.gat
-moc_pryd05.gat
-moc_pryd06.gat
-moc_prydb1.gat
-moc_ruins.gat
-monk_in.gat
-morocc.gat
-morocc_in.gat
-new_1-1.gat
-new_1-2.gat
-new_1-3.gat
-new_1-4.gat
-new_2-1.gat
-new_2-2.gat
-new_2-3.gat
-new_2-4.gat
-new_3-1.gat
-new_3-2.gat
-new_3-3.gat
-new_3-4.gat
-new_4-1.gat
-new_4-2.gat
-new_4-3.gat
-new_4-4.gat
-new_5-1.gat
-new_5-2.gat
-new_5-3.gat
-new_5-4.gat
-orcsdun01.gat
-orcsdun02.gat
-ordeal_1-1.gat
-ordeal_1-2.gat
-ordeal_1-3.gat
-ordeal_1-4.gat
-ordeal_2-1.gat
-ordeal_2-2.gat
-ordeal_2-3.gat
-ordeal_2-4.gat
-ordeal_3-1.gat
-ordeal_3-2.gat
-ordeal_3-3.gat
-ordeal_3-4.gat
-pay_arche.gat
-pay_dun00.gat
-pay_dun01.gat
-pay_dun02.gat
-pay_dun03.gat
-pay_dun04.gat
-pay_fild01.gat
-pay_fild02.gat
-pay_fild03.gat
-pay_fild04.gat
-pay_fild05.gat
-pay_fild06.gat
-pay_fild07.gat
-pay_fild08.gat
-pay_fild09.gat
-pay_fild10.gat
-pay_fild11.gat
-payon.gat
-payon_in01.gat
-payon_in02.gat
-priest_1-1.gat
-priest_2-1.gat
-priest_3-1.gat
-prontera.gat
-prt_are_in.gat
-prt_are01.gat
-pvp_room.gat
-prt_castle.gat
-prt_church.gat
-prt_fild00.gat
-prt_fild01.gat
-prt_fild02.gat
-prt_fild03.gat
-prt_fild04.gat
-prt_fild05.gat
-prt_fild06.gat
-prt_fild07.gat
-prt_fild08.gat
-prt_fild09.gat
-prt_fild10.gat
-prt_fild11.gat
-prt_in.gat
-prt_maze01.gat
-prt_maze02.gat
-prt_maze03.gat
-prt_monk.gat
-prt_sewb1.gat
-prt_sewb2.gat
-prt_sewb3.gat
-prt_sewb4.gat
-pvp_2vs2.gat
-pvp_c_room.gat
-pvp_n_1-1.gat
-pvp_n_1-2.gat
-pvp_n_1-3.gat
-pvp_n_1-4.gat
-pvp_n_1-5.gat
-pvp_n_2-1.gat
-pvp_n_2-2.gat
-pvp_n_2-3.gat
-pvp_n_2-4.gat
-pvp_n_2-5.gat
-pvp_n_3-1.gat
-pvp_n_3-2.gat
-pvp_n_3-3.gat
-pvp_n_3-4.gat
-pvp_n_3-5.gat
-pvp_n_4-1.gat
-pvp_n_4-2.gat
-pvp_n_4-3.gat
-pvp_n_4-4.gat
-pvp_n_4-5.gat
-pvp_n_5-1.gat
-pvp_n_5-2.gat
-pvp_n_5-3.gat
-pvp_n_5-4.gat
-pvp_n_5-5.gat
-pvp_n_6-1.gat
-pvp_n_6-2.gat
-pvp_n_6-3.gat
-pvp_n_6-4.gat
-pvp_n_6-5.gat
-pvp_n_7-1.gat
-pvp_n_7-2.gat
-pvp_n_7-3.gat
-pvp_n_7-4.gat
-pvp_n_7-5.gat
-pvp_n_8-1.gat
-pvp_n_8-2.gat
-pvp_n_8-3.gat
-pvp_n_8-4.gat
-pvp_n_8-5.gat
-pvp_n_room.gat
-pvp_y_1-1.gat
-pvp_y_1-2.gat
-pvp_y_1-3.gat
-pvp_y_1-4.gat
-pvp_y_1-5.gat
-pvp_y_2-1.gat
-pvp_y_2-2.gat
-pvp_y_2-3.gat
-pvp_y_2-4.gat
-pvp_y_2-5.gat
-pvp_y_3-1.gat
-pvp_y_3-2.gat
-pvp_y_3-3.gat
-pvp_y_3-4.gat
-pvp_y_3-5.gat
-pvp_y_4-1.gat
-pvp_y_4-2.gat
-pvp_y_4-3.gat
-pvp_y_4-4.gat
-pvp_y_4-5.gat
-pvp_y_5-1.gat
-pvp_y_5-2.gat
-pvp_y_5-3.gat
-pvp_y_5-4.gat
-pvp_y_5-5.gat
-pvp_y_6-1.gat
-pvp_y_6-2.gat
-pvp_y_6-3.gat
-pvp_y_6-4.gat
-pvp_y_6-5.gat
-pvp_y_7-1.gat
-pvp_y_7-2.gat
-pvp_y_7-3.gat
-pvp_y_7-4.gat
-pvp_y_7-5.gat
-pvp_y_8-1.gat
-pvp_y_8-2.gat
-pvp_y_8-3.gat
-pvp_y_8-4.gat
-pvp_y_8-5.gat
-pvp_y_room.gat
-sword_1-1.gat
-sword_2-1.gat
-sword_3-1.gat
-treasure01.gat
-treasure02.gat
-wizard_1-1.gat
-wizard_2-1.gat
-wizard_3-1.gat
-xmas.gat
-xmas_dun01.gat
-xmas_dun02.gat
-xmas_fild01.gat
-xmas_in.gat
-beach_dun.gat
-beach_dun2.gat
-beach_dun3.gat
-cmd_fild01.gat
-cmd_fild02.gat
-cmd_fild03.gat
-cmd_fild04.gat
-cmd_fild05.gat
-cmd_fild06.gat
-cmd_fild07.gat
-cmd_fild08.gat
-cmd_fild09.gat
-cmd_in01.gat
-cmd_in02.gat
-comodo.gat
-quiz_00.gat
-quiz_01.gat
-g_room1-1.gat
-g_room1-2.gat
-g_room1-3.gat
-g_room2.gat
-tur_dun01.gat
-tur_dun02.gat
-tur_dun03.gat
-tur_dun04.gat
-tur_dun05.gat
-tur_dun06.gat
-alde_gld.gat
-aldeg_cas01.gat
-aldeg_cas02.gat
-aldeg_cas03.gat
-aldeg_cas04.gat
-aldeg_cas05.gat
-gefg_cas01.gat
-gefg_cas02.gat
-gefg_cas03.gat
-gefg_cas04.gat
-gefg_cas05.gat
-gld_dun01.gat
-gld_dun02.gat
-gld_dun03.gat
-gld_dun04.gat
-guild_room.gat
-guild_vs1.gat
-guild_vs2.gat
-guild_vs3.gat
-guild_vs4.gat
-guild_vs5.gat
-guild_vs1-1.gat
-guild_vs1-2.gat
-guild_vs1-3.gat
-guild_vs1-4.gat
-guild_vs2-1.gat
-guild_vs2-2.gat
-job_hunte.gat
-job_knt.gat
-job_prist.gat
-job_wiz.gat
-pay_gld.gat
-payg_cas01.gat
-payg_cas02.gat
-payg_cas03.gat
-payg_cas04.gat
-payg_cas05.gat
-prt_gld.gat
-prtg_cas01.gat
-prtg_cas02.gat
-prtg_cas03.gat
-prtg_cas04.gat
-prtg_cas05.gat
-alde_alche.gat
-in_rogue.gat
-job_cru.gat
-job_duncer.gat
-job_monk.gat
-job_sage.gat
-mag_dun01.gat
-mag_dun02.gat
-monk_test.gat
-quiz_test.gat
-yuno.gat
-yuno_fild01.gat
-yuno_fild02.gat
-yuno_fild03.gat
-yuno_fild04.gat
-yuno_in01.gat
-yuno_in02.gat
-yuno_in03.gat
-yuno_in04.gat
-yuno_in05.gat
-ama_dun01.gat
-ama_dun02.gat
-ama_dun03.gat
-ama_fild01.gat
-ama_in01.gat
-ama_in02.gat
-ama_test.gat
-amatsu.gat
-gon_dun01.gat
-gon_dun02.gat
-gon_dun03.gat
-gon_fild01.gat
-gon_in.gat
-gon_test.gat
-gonryun.gat
-sec_in01.gat
-sec_in02.gat
-sec_pri.gat
-umbala.gat
-um_dun01.gat
-um_dun02.gat
-um_fild01.gat
-um_fild02.gat
-um_fild03.gat
-um_fild04.gat
-um_in.gat
-niflheim.gat
-nif_fild01.gat
-nif_fild02.gat
-nif_in.gat
-yggdrasil01.gat
-valkyrie.gat
-himinn.gat
-lou_in01.gat
-lou_in02.gat
-lou_dun03.gat
-lou_dun02.gat
-lou_dun01.gat
-lou_fild01.gat
-louyang.gat
-siege_test.gat
-n_castle.gat
-nguild_gef.gat
-nguild_prt.gat
-nguild_pay.gat
-nguild_alde.gat
-jawaii.gat
-jawaii_in.gat
-gefenia01.gat
-gefenia02.gat
-gefenia03.gat
-gefenia04.gat
-new_zone01.gat
-new_zone02.gat
-new_zone03.gat
-new_zone04.gat
-payon_in03.gat
-ayothaya.gat
-ayo_in01.gat
-ayo_in02.gat
-ayo_fild01.gat
-ayo_fild02.gat
-ayo_dun01.gat
-ayo_dun02.gat
-que_god01.gat
-que_god02.gat
-yuno_fild05.gat
-yuno_fild07.gat
-yuno_fild08.gat
-yuno_fild09.gat
-yuno_fild11.gat
-yuno_fild12.gat
-alde_tt02.gat
-turbo_n_1.gat
-turbo_n_4.gat
-turbo_n_8.gat
-turbo_n_16.gat
-turbo_e_4.gat
-turbo_e_8.gat
-turbo_e_16.gat
-turbo_room.gat
-airplane.gat
-airport.gat
-einbech.gat
-einbroch.gat
-ein_dun01.gat
-ein_dun02.gat
-ein_fild06.gat
-ein_fild07.gat
-ein_fild08.gat
-ein_fild09.gat
-ein_fild10.gat
-ein_in01.gat
-que_sign01.gat
-que_sign02.gat
-ein_fild03.gat
-ein_fild04.gat
-lhz_fild02.gat
-lhz_fild03.gat
-yuno_pre.gat
-lhz_fild01.gat
-lighthalzen.gat
-lhz_in01.gat
-lhz_in02.gat
-lhz_in03.gat
-lhz_que01.gat
-lhz_dun01.gat
-lhz_dun02.gat
-lhz_dun03.gat
-lhz_cube.gat
-juperos_01.gat
-juperos_02.gat
-jupe_area1.gat
-jupe_area2.gat
-jupe_core.gat
-jupe_ele.gat
-jupe_ele_r.gat
-jupe_gate.gat
-y_airport.gat
-lhz_airport.gat
-airplane_01.gat
-jupe_cave.gat
-quiz_02.gat
-hu_fild07.gat
-hu_fild05.gat
-hu_fild04.gat
-hu_fild01.gat
-yuno_fild06.gat
-job_soul.gat
-job_star.gat
-que_job01.gat
-que_job02.gat
-que_job03.gat
-abyss_01.gat
-abyss_02.gat
-abyss_03.gat
-thana_step.gat
-thana_boss.gat
-tha_scene01.gat
-tha_t01.gat
-tha_t02.gat
-tha_t03.gat
-tha_t04.gat
-tha_t07.gat
-tha_t05.gat
-tha_t06.gat
-tha_t08.gat
-tha_t09.gat
-tha_t10.gat
-tha_t11.gat
-tha_t12.gat
-auction_01.gat
-auction_02.gat
-hugel.gat
-hu_in01.gat
-que_bingo.gat
-que_hugel.gat
-p_track01.gat
-p_track02.gat
-odin_tem01.gat
-odin_tem02.gat
-odin_tem03.gat
-hu_fild02.gat
-hu_fild03.gat
-hu_fild06.gat
-ein_fild01.gat
-ein_fild02.gat
-ein_fild05.gat
-yuno_fild10.gat
-kh_kiehl02.gat
-kh_kiehl01.gat
-kh_dun02.gat
-kh_dun01.gat
-kh_mansion.gat
-kh_rossi.gat
-kh_school.gat
-kh_vila.gat
-force_map1.gat
-force_map2.gat
-force_map3.gat
-job_hunter.gat
-job_knight.gat
-job_priest.gat
-job_wizard.gat
-g_room2.gat
-rachel.gat
-ra_in01.gat
-ra_fild01.gat
-ra_fild02.gat
-ra_fild03.gat
-ra_fild04.gat
-ra_fild05.gat
-ra_fild06.gat
-ra_fild07.gat
-ra_fild08.gat
-ra_fild09.gat
-ra_fild10.gat
-ra_fild11.gat
-ra_fild12.gat
-ra_fild13.gat
-ra_san01.gat
-ra_san02.gat
-ra_san03.gat
-ra_san04.gat
-ra_san05.gat
-ra_temin.gat
-ra_temple.gat
-ra_temsky.gat
-que_rachel.gat
-ice_dun01.gat
-ice_dun02.gat
-ice_dun03.gat
-ice_dun04.gat
-que_thor.gat
-thor_camp.gat
-thor_v01.gat
-thor_v02.gat
-thor_v03.gat
-veins.gat
-ve_in.gat
-ve_fild01.gat
-ve_fild02.gat
-ve_fild03.gat
-ve_fild04.gat
-ve_fild05.gat
-ve_fild06.gat
-ve_fild07.gat
-//======================================================================================
-// - Other/Extra maps -
-// Only add maps under this line if they are not standard maps!
-//======================================================================================
-rwc01.gat 1000
-rwc02.gat
-rwc03.gat
-prontera_x.gat
-alberta_x.gat
-aldebaran_x.gat
-geffen_x.gat
-izlude_x.gat
-prt_church_x.gat
-prontera_s.gat
-pay_arche_s.gat
-xmas_old.gat
-ordeal_a00.gat
-ordeal_a02.gat
-fay_vilg00.gat
-fay_vilg01.gat
-gef_vilg00.gat
-gef_vilg01.gat
-moc_dugn01.gat
-moc_dugn02.gat
-moc_fild01.gat
-moc_fild02.gat
-moc_fild03.gat
-moc_fild04.gat
-moc_intr00.gat
-moc_intr01.gat
-moc_intr02.gat
-moc_intr04.gat
-moc_vilg00.gat
-moc_vilg01.gat
-moc_vilg02.gat
-probemap.gat
-probemap02.gat
-prt_cstl01.gat
-prt_dugn00.gat
-prt_dugn01.gat
-prt_fild00.gat
-prt_fild01.gat
-prt_fild03.gat
-prt_fild04.gat
-prt_fild05.gat
-prt_intr01.gat
-prt_intr01_a.gat
-prt_intr02.gat
-prt_vilg00.gat
-prt_vilg01.gat
-prt_vilg02.gat
-tank_test.gat
-tank_test2.gat
-test.gat
-poring_c01.gat
-poring_c02.gat
-que_ng.gat
-//======================================================================================
-//Place your custom maps with a starting ID here.
-//======================================================================================
-//Example:
-//
-//mymap.gat 1250
-//mymap-2.gat
diff --git a/tools/mapcache/map_list.txt b/db/map_list.txt
index 5bb039d6f..95b0e2e55 100644
--- a/tools/mapcache/map_list.txt
+++ b/db/map_list.txt
@@ -8,6 +8,7 @@
//mapname<tab>index <- specifies index for this map
//mapname <- map will use index of previous map +1
//Note that map index 0 is special and reserved for "error" status.
+
alb_ship 1
alb2trea
alberta
@@ -644,3 +645,69 @@ ve_fild07
poring_c01
poring_c02
que_ng
+
+
+// Only add maps under this line if they are not standard maps!
+
+
+//======================================================================================
+// - Other/Extra maps -
+//======================================================================================
+//rwc01 1000
+//rwc02
+//rwc03
+//prontera_x
+//alberta_x
+//aldebaran_x
+//geffen_x
+//izlude_x
+//prt_church_x
+//prontera_s
+//pay_arche_s
+//xmas_old
+//ordeal_a00
+//ordeal_a02
+//fay_vilg00
+//fay_vilg01
+//gef_vilg00
+//gef_vilg01
+//moc_dugn01
+//moc_dugn02
+//moc_fild01
+//moc_fild02
+//moc_fild03
+//moc_fild04
+//moc_intr00
+//moc_intr01
+//moc_intr02
+//moc_intr04
+//moc_vilg00
+//moc_vilg01
+//moc_vilg02
+//probemap
+//probemap02
+//prt_cstl01
+//prt_dugn00
+//prt_dugn01
+//prt_fild00
+//prt_fild01
+//prt_fild03
+//prt_fild04
+//prt_fild05
+//prt_intr01
+//prt_intr01_a
+//prt_intr02
+//prt_vilg00
+//prt_vilg01
+//prt_vilg02
+//tank_test
+//tank_test2
+//test
+
+//======================================================================================
+//Place your custom maps with a starting ID here.
+//======================================================================================
+//Example:
+//
+//mymap 1250
+//mymap-2
diff --git a/src/char/char.c b/src/char/char.c
index 54fa75c68..5a29a1344 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3539,11 +3539,15 @@ int parse_char(int fd) {
ShowWarning("Unable to find map-server for '%s', sending to major city '%s'.\n", mapindex_id2name(cd->last_point.map), mapindex_id2name(j));
cd->last_point.map = j;
}
- { //Send player to map
+ {
+ //Send player to map
+ char map_name[MAP_NAME_LENGTH];
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(cd->last_point.map));
+
WFIFOHEAD(fd, 28);
WFIFOW(fd,0) = 0x71;
WFIFOL(fd,2) = cd->char_id;
- memcpy(WFIFOP(fd,6), mapindex_id2name(cd->last_point.map), MAP_NAME_LENGTH);
+ memcpy(WFIFOP(fd,6), map_name, MAP_NAME_LENGTH);
// Advanced subnet check [LuzZza]
if((subnet_map_ip = lan_subnetcheck((long *)p)))
@@ -4170,15 +4174,13 @@ int char_config_read(const char *cfgName) {
int x, y;
if (sscanf(w2, "%[^,],%d,%d", map, &x, &y) < 3)
continue;
- if (strstr(map, ".gat") != NULL) { // Verify at least if '.gat' is in the map name
- start_point.map = mapindex_name2id(map);
- if (!start_point.map) {
- ShowError("Specified start_point %s not found in map-index cache.\n", map);
- start_point.map = 0;
- }
- start_point.x = x;
- start_point.y = y;
+ start_point.map = mapindex_name2id(map);
+ if (!start_point.map) {
+ ShowError("Specified start_point %s not found in map-index cache.\n", map);
+ start_point.map = 0;
}
+ start_point.x = x;
+ start_point.y = y;
} else if(strcmpi(w1,"log_char")==0) { //log char or not [devil]
log_char = atoi(w2);
} else if (strcmpi(w1, "start_zeny") == 0) {
@@ -4318,7 +4320,7 @@ int do_init(int argc, char **argv) {
int i;
mapindex_init(); //Needed here for the start-point reading.
- start_point.map = mapindex_name2id("new_zone01.gat");
+ start_point.map = mapindex_name2id("new_zone01");
char_config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]);
char_lan_config_read((argc > 3) ? argv[3] : LOGIN_LAN_CONF_NAME);
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index de0b79bd1..0afaa526a 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -3359,10 +3359,12 @@ int parse_char(int fd) {
char_dat.last_point.map = j;
}
{ //Send player to map.
+ char map_name[MAP_NAME_LENGTH];
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(char_dat.last_point.map));
WFIFOHEAD(fd,28);
WFIFOW(fd, 0) =0x71;
WFIFOL(fd, 2) =char_dat.char_id;
- memcpy(WFIFOP(fd,6), mapindex_id2name(char_dat.last_point.map), MAP_NAME_LENGTH);
+ memcpy(WFIFOP(fd,6), map_name, MAP_NAME_LENGTH);
// Advanced subnet check [LuzZza]
if((subnet_map_ip = lan_subnetcheck((long *)p)))
diff --git a/src/common/grfio.c b/src/common/grfio.c
index ba3b55bb3..a2d7f7f5a 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -1,28 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-/*********************************************************************
- *
- * Ragnarok Online Emulator : grfio.c -- grf file I/O Module
- *--------------------------------------------------------------------
- * special need library : zlib
- *********************************************************************
- * $Id: grfio.c,v 1.2 2004/09/29 17:31:49 kalaspuff Exp $
- *
- * 2002/12/18... the original edition
- * 2003/01/23 ... Code correction
- * 2003/02/01 ... An addition and decryption processing are improved for LocalFile and two or more GRF(s) check processing.
- * 2003/02/02 ... Even if there is no grf it does not stop -- as -- correction
- * 2003/02/02... grf reading specification can be added later -- as -- correction (grfio_add function addition)
- * 2003/02 / 03... at the time of grfio_resourcecheck processing the entry addition processing method -- correction
- * 2003/02/05... change of the processing in grfio_init
- * 2003/02/23... a local file check -- GRFIO_LOCAL -- switch (Defoe -- Function Off)
- * 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>
#include <stdlib.h>
#include <string.h>
@@ -30,13 +8,9 @@
#include <sys/stat.h>
#include "grfio.h"
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/malloc.h"
+#include "malloc.h"
#include "../zlib/unzip.h"
-#define CHUNK 16384
-
#ifdef __WIN32
#include "../zlib/zlib.h"
#include "../zlib/iowin32.h"
@@ -46,225 +20,6 @@
#endif
#endif
-typedef unsigned char BYTE;
-typedef unsigned short WORD;
-typedef unsigned long DWORD;
-
-//static char data_file[1024] = ""; // "data.grf";
-//static char sdata_file[1024] = ""; // "sdata.grf";
-//static char adata_file[1024] = ""; // "adata.grf";
-static char data_dir[1024] = ""; // "../";
-
-//----------------------------
-// file entry table struct
-//----------------------------
-typedef struct {
- int srclen; // compressed size
- int srclen_aligned; //
- int declen; // original size
- int srcpos;
- short next;
- int cycle;
- char type;
- char fn[128-4*5]; // file name
- char *fnd;
- signed char gentry; // read grf file select
-} FILELIST;
-//gentry ... 0 : It acquires from a local file.
-// It acquires from the resource file of 1>=:gentry_table[gentry-1].
-// 1<=: Check a local file.
-// If it is, after re-setting to 0, it acquires from a local file.
-// If there is nothing, mark reversal will be carried out, and it will re-set, and will acquire from a resource file as well as 1>=.
-
-//Since char defines *FILELIST.gentry, the maximum which can be added by grfio_add becomes by 127 pieces.
-
-#define GENTRY_LIMIT 512
-#define FILELIST_LIMIT 1048576 // temporary maximum, and a theory top maximum are 2G.
-
-static FILELIST *filelist = NULL;
-static int filelist_entrys = 0;
-static int filelist_maxentry = 0;
-
-static char **gentry_table = NULL;
-static int gentry_entrys = 0;
-static int gentry_maxentry = 0;
-
-//----------------------------
-// file list hash table
-//----------------------------
-static int filelist_hash[256];
-
-//----------------------------
-// grf decode data table
-//----------------------------
-static unsigned char BitMaskTable[8] = {
- 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
-};
-
-static char BitSwapTable1[64] = {
- 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
- 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
- 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
- 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
-};
-static char BitSwapTable2[64] = {
- 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31,
- 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29,
- 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27,
- 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25
-};
-static char BitSwapTable3[32] = {
- 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
- 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
-static unsigned char NibbleData[4][64]={
- {
- 0xef, 0x03, 0x41, 0xfd, 0xd8, 0x74, 0x1e, 0x47, 0x26, 0xef, 0xfb, 0x22, 0xb3, 0xd8, 0x84, 0x1e,
- 0x39, 0xac, 0xa7, 0x60, 0x62, 0xc1, 0xcd, 0xba, 0x5c, 0x96, 0x90, 0x59, 0x05, 0x3b, 0x7a, 0x85,
- 0x40, 0xfd, 0x1e, 0xc8, 0xe7, 0x8a, 0x8b, 0x21, 0xda, 0x43, 0x64, 0x9f, 0x2d, 0x14, 0xb1, 0x72,
- 0xf5, 0x5b, 0xc8, 0xb6, 0x9c, 0x37, 0x76, 0xec, 0x39, 0xa0, 0xa3, 0x05, 0x52, 0x6e, 0x0f, 0xd9,
- }, {
- 0xa7, 0xdd, 0x0d, 0x78, 0x9e, 0x0b, 0xe3, 0x95, 0x60, 0x36, 0x36, 0x4f, 0xf9, 0x60, 0x5a, 0xa3,
- 0x11, 0x24, 0xd2, 0x87, 0xc8, 0x52, 0x75, 0xec, 0xbb, 0xc1, 0x4c, 0xba, 0x24, 0xfe, 0x8f, 0x19,
- 0xda, 0x13, 0x66, 0xaf, 0x49, 0xd0, 0x90, 0x06, 0x8c, 0x6a, 0xfb, 0x91, 0x37, 0x8d, 0x0d, 0x78,
- 0xbf, 0x49, 0x11, 0xf4, 0x23, 0xe5, 0xce, 0x3b, 0x55, 0xbc, 0xa2, 0x57, 0xe8, 0x22, 0x74, 0xce,
- }, {
- 0x2c, 0xea, 0xc1, 0xbf, 0x4a, 0x24, 0x1f, 0xc2, 0x79, 0x47, 0xa2, 0x7c, 0xb6, 0xd9, 0x68, 0x15,
- 0x80, 0x56, 0x5d, 0x01, 0x33, 0xfd, 0xf4, 0xae, 0xde, 0x30, 0x07, 0x9b, 0xe5, 0x83, 0x9b, 0x68,
- 0x49, 0xb4, 0x2e, 0x83, 0x1f, 0xc2, 0xb5, 0x7c, 0xa2, 0x19, 0xd8, 0xe5, 0x7c, 0x2f, 0x83, 0xda,
- 0xf7, 0x6b, 0x90, 0xfe, 0xc4, 0x01, 0x5a, 0x97, 0x61, 0xa6, 0x3d, 0x40, 0x0b, 0x58, 0xe6, 0x3d,
- }, {
- 0x4d, 0xd1, 0xb2, 0x0f, 0x28, 0xbd, 0xe4, 0x78, 0xf6, 0x4a, 0x0f, 0x93, 0x8b, 0x17, 0xd1, 0xa4,
- 0x3a, 0xec, 0xc9, 0x35, 0x93, 0x56, 0x7e, 0xcb, 0x55, 0x20, 0xa0, 0xfe, 0x6c, 0x89, 0x17, 0x62,
- 0x17, 0x62, 0x4b, 0xb1, 0xb4, 0xde, 0xd1, 0x87, 0xc9, 0x14, 0x3c, 0x4a, 0x7e, 0xa8, 0xe2, 0x7d,
- 0xa0, 0x9f, 0xf6, 0x5c, 0x6a, 0x09, 0x8d, 0xf0, 0x0f, 0xe3, 0x53, 0x25, 0x95, 0x36, 0x28, 0xcb,
- }
-};
-/*-----------------
- * long data get
- */
-static unsigned int getlong(unsigned char *p)
-{
-// return *p+p[1]*256+(p[2]+p[3]*256)*65536;
- return p[0]
- | p[1] << 0x08
- | p[2] << 0x10
- | p[3] << 0x18; // Shinomori
-}
-
-/*==========================================
- * Grf data decode : Subs
- *------------------------------------------
- */
-static void NibbleSwap(BYTE *Src, int len)
-{
- for(;0<len;len--,Src++) {
- *Src = (*Src>>4) | (*Src<<4);
- }
-}
-
-static void BitConvert(BYTE *Src,char *BitSwapTable)
-{
- int lop,prm;
- BYTE tmp[8];
-// *(DWORD*)tmp=*(DWORD*)(tmp+4)=0;
- memset(tmp,0,8);
- for(lop=0;lop!=64;lop++) {
- prm = BitSwapTable[lop]-1;
- if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) {
- tmp[(lop >> 3) & 7] |= BitMaskTable[lop & 7];
- }
- }
-// *(DWORD*)Src = *(DWORD*)tmp;
-// *(DWORD*)(Src+4) = *(DWORD*)(tmp+4);
- memcpy(Src,tmp,8);
-}
-
-static void BitConvert4(BYTE *Src)
-{
- int lop,prm;
- BYTE tmp[8];
- tmp[0] = ((Src[7]<<5) | (Src[4]>>3)) & 0x3f; // ..0 vutsr
- tmp[1] = ((Src[4]<<1) | (Src[5]>>7)) & 0x3f; // ..srqpo n
- tmp[2] = ((Src[4]<<5) | (Src[5]>>3)) & 0x3f; // ..o nmlkj
- tmp[3] = ((Src[5]<<1) | (Src[6]>>7)) & 0x3f; // ..kjihg f
- tmp[4] = ((Src[5]<<5) | (Src[6]>>3)) & 0x3f; // ..g fedcb
- tmp[5] = ((Src[6]<<1) | (Src[7]>>7)) & 0x3f; // ..cba98 7
- tmp[6] = ((Src[6]<<5) | (Src[7]>>3)) & 0x3f; // ..8 76543
- tmp[7] = ((Src[7]<<1) | (Src[4]>>7)) & 0x3f; // ..43210 v
-
- for(lop=0;lop!=4;lop++) {
- tmp[lop] = (NibbleData[lop][tmp[lop*2]] & 0xf0)
- | (NibbleData[lop][tmp[lop*2+1]] & 0x0f);
- }
-
- *(DWORD*)(tmp+4)=0;
- for(lop=0;lop!=32;lop++) {
- prm = BitSwapTable3[lop]-1;
- if (tmp[prm >> 3] & BitMaskTable[prm & 7]) {
- tmp[(lop >> 3) + 4] |= BitMaskTable[lop & 7];
- }
- }
-// *(DWORD*)Src ^= *(DWORD*)(tmp+4);
- Src[0] ^= tmp[4];
- Src[1] ^= tmp[5];
- Src[2] ^= tmp[6];
- Src[3] ^= tmp[7];
-}
-
-static void decode_des_etc(BYTE *buf,int len,int type,int cycle)
-{
- int lop,cnt=0;
- if(cycle<3) cycle=3;
- else if(cycle<5) cycle++;
- else if(cycle<7) cycle+=9;
- else cycle+=15;
-
- for(lop=0;lop*8<len;lop++,buf+=8) {
- if(lop<20 || (type==0 && lop%cycle==0)){ // des
- BitConvert(buf,BitSwapTable1);
- BitConvert4(buf);
- BitConvert(buf,BitSwapTable2);
- } else {
- if(cnt==7 && type==0){
- int a;
- BYTE tmp[8];
- *(DWORD*)tmp = *(DWORD*)buf;
- *(DWORD*)(tmp+4) = *(DWORD*)(buf+4);
- cnt=0;
- buf[0]=tmp[3];
- buf[1]=tmp[4];
- buf[2]=tmp[6];
- buf[3]=tmp[0];
- buf[4]=tmp[1];
- buf[5]=tmp[2];
- buf[6]=tmp[5];
- a=tmp[7];
- if(a==0x00) a=0x2b;
- else if(a==0x2b) a=0x00;
- else if(a==0x01) a=0x68;
- else if(a==0x68) a=0x01;
- else if(a==0x48) a=0x77;
- else if(a==0x77) a=0x48;
- else if(a==0x60) a=0xff;
- else if(a==0xff) a=0x60;
- else if(a==0x6c) a=0x80;
- else if(a==0x80) a=0x6c;
- else if(a==0xb9) a=0xc0;
- else if(a==0xc0) a=0xb9;
- else if(a==0xeb) a=0xfe;
- else if(a==0xfe) a=0xeb;
- buf[7]=a;
- }
- cnt++;
- }
- }
-}
-/*==========================================
- * Grf data decode sub : zip
- *------------------------------------------
- */
int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
{
z_stream stream;
@@ -402,630 +157,3 @@ int deflate_file (const char *source, const char *filename)
return 0;
}
-
-unsigned long grfio_crc32 (const unsigned char *buf, unsigned int len)
-{
- return crc32(crc32(0L, Z_NULL, 0), buf, len);
-}
-
-/***********************************************************
- *** File List Subroutines ***
- ***********************************************************/
-
-/*==========================================
- * File List : Hash make
- *------------------------------------------
- */
-static int filehash(unsigned char *fname)
-{
- unsigned int hash=0;
- while(*fname) {
- hash = ((hash<<1)+(hash>>7)*9+tolower(*fname));
- fname++;
- }
- return hash & 255;
-}
-
-/*==========================================
- * File List : Hash initalize
- *------------------------------------------
- */
-static void hashinit(void)
-{
- int lop;
- for (lop = 0; lop < 256; lop++)
- filelist_hash[lop] = -1;
-}
-
-/*==========================================
- * File List : File find
- *------------------------------------------
- */
-static FILELIST *filelist_find(char *fname)
-{
- int hash;
-
- if (!filelist)
- return NULL;
-
- for (hash = filelist_hash[filehash((unsigned char *) fname)]; hash >= 0; hash = filelist[hash].next) {
- if(strcmpi(filelist[hash].fn, fname) == 0)
- break;
- }
-
- return (hash >= 0) ? &filelist[hash] : NULL;
-}
-
-char *grfio_find_file(char *fname){
- FILELIST *filelist = filelist_find(fname);
- if (!filelist) return NULL;
- return (!filelist->fnd?filelist->fn:filelist->fnd);
-}
-
-/*==========================================
- * File List : Filelist add
- *------------------------------------------
- */
-#define FILELIST_ADDS 1024 // number increment of file lists `
-
-static FILELIST* filelist_add(FILELIST *entry)
-{
- int hash;
-
- if (filelist_entrys >= FILELIST_LIMIT) {
- ShowFatalError("GRF filelist limit reached (filelist_add)!\n");
- exit(1);
- }
-
- if (filelist_entrys >= filelist_maxentry) {
- filelist = (FILELIST *)aRealloc(filelist, (filelist_maxentry + FILELIST_ADDS) * sizeof(FILELIST));
- memset(filelist + filelist_maxentry, '\0', FILELIST_ADDS * sizeof(FILELIST));
- filelist_maxentry += FILELIST_ADDS;
- }
-
- memcpy (&filelist[filelist_entrys], entry, sizeof(FILELIST));
-
- hash = filehash((unsigned char *) entry->fn);
- filelist[filelist_entrys].next = filelist_hash[hash];
- filelist_hash[hash] = filelist_entrys;
-
- filelist_entrys++;
-
- return &filelist[filelist_entrys - 1];
-}
-
-static FILELIST* filelist_modify(FILELIST *entry)
-{
- FILELIST *fentry;
- if ((fentry = filelist_find(entry->fn)) != NULL) {
- int tmp = fentry->next;
- memcpy(fentry, entry, sizeof(FILELIST));
- fentry->next = tmp;
- } else {
- fentry = filelist_add(entry);
- }
- return fentry;
-}
-
-/*==========================================
- * File List : filelist size adjust
- *------------------------------------------
- */
-static void filelist_adjust(void)
-{
- if (filelist != NULL) {
- if (filelist_maxentry > filelist_entrys) {
- filelist = (FILELIST *)aRealloc(
- filelist, filelist_entrys * sizeof(FILELIST));
- filelist_maxentry = filelist_entrys;
- }
- }
-}
-
-/***********************************************************
- *** Grfio Sobroutines ***
- ***********************************************************/
-
-/*==========================================
- * Grfio : Resource file size get
- *------------------------------------------
- */
-int grfio_size(char *fname)
-{
- FILELIST *entry;
-
- entry = filelist_find(fname);
-
- if (entry == NULL || entry->gentry < 0) { // LocalFileCheck
- char lfname[256], *p;
- FILELIST lentry;
- struct stat st;
-
- sprintf(lfname, "%s%s", data_dir, fname);
-
- for (p = &lfname[0]; *p != 0; p++)
- if (*p=='\\') *p = '/'; // * At the time of Unix
-
- if (stat(lfname, &st) == 0) {
- strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
- lentry.fnd = NULL;
- lentry.declen = st.st_size;
- lentry.gentry = 0; // 0:LocalFile
- entry = filelist_modify(&lentry);
- } else if (entry == NULL) {
- ShowError("%s not found (grfio_size)\n", fname);
- //exit(1);
- return -1;
- }
- }
- return entry->declen;
-}
-
-/*==========================================
- * Grfio : Resource file read & size get
- *------------------------------------------
- */
-void* grfio_reads(char *fname, int *size)
-{
- FILE *in;
- FILELIST *entry;
- unsigned char *buf2 = NULL;
-
- entry = filelist_find(fname);
-
- if (entry == NULL || entry->gentry <= 0) { // LocalFileCheck
- char lfname[256], *p;
- FILELIST lentry;
-
- sprintf(lfname, "%s%s", data_dir, fname);
-
- for (p = &lfname[0]; *p != 0; p++)
- if (*p == '\\') *p = '/'; // * At the time of Unix
-
- in = fopen(lfname, "rb");
- if (in != NULL) {
- if (entry != NULL && entry->gentry == 0) {
- lentry.declen = entry->declen;
- } else {
- fseek(in,0,2); // SEEK_END
- lentry.declen = ftell(in);
- }
- fseek(in,0,0); // SEEK_SET
- buf2 = (unsigned char *)aMallocA(lentry.declen + 1024);
- fread(buf2, 1, lentry.declen, in);
- fclose(in);
- strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
- lentry.fnd = NULL;
- lentry.gentry = 0; // 0:LocalFile
- entry = filelist_modify(&lentry);
- } else {
- if (entry != NULL && entry->gentry < 0) {
- entry->gentry = -entry->gentry; // local file checked
- } else {
- ShowError("%s not found (grfio_reads - local file %s)\n", fname, lfname);
- return NULL;
- }
- }
- }
- if (entry != NULL && entry->gentry > 0) { // Archive[GRF] File Read
- char *gfname = gentry_table[entry->gentry - 1];
- in = fopen(gfname, "rb");
- if(in != NULL) {
- unsigned char *buf = (unsigned char *)aMallocA(entry->srclen_aligned + 1024);
- fseek(in, entry->srcpos, 0);
- fread(buf, 1, entry->srclen_aligned, in);
- fclose(in);
- buf2 = (unsigned char *)aMallocA(entry->declen + 1024);
- if (entry->type == 1 || entry->type == 3 || entry->type == 5) {
- uLongf len;
- if (entry->cycle >= 0)
- decode_des_etc(buf, entry->srclen_aligned, entry->cycle == 0, entry->cycle);
- len = entry->declen;
- decode_zip(buf2, &len, buf, entry->srclen);
- if (len != entry->declen) {
- ShowError("decode_zip size miss match err: %d != %d\n", (int)len, entry->declen);
- aFree(buf);
- aFree(buf2);
- return NULL;
- }
- } else {
- memcpy(buf2, buf, entry->declen);
- }
- aFree(buf);
- } else {
- ShowError("%s not found (grfio_reads - grf file %s)\n", fname, gfname);
- return NULL;
- }
- }
- if (size != NULL && entry != NULL)
- *size = entry->declen;
-
- return buf2;
-}
-
-/*==========================================
- * Resource filename decode
- *------------------------------------------
- */
-static char * decode_filename(unsigned char *buf,int len)
-{
- int lop;
- for(lop=0;lop<len;lop+=8) {
- NibbleSwap(&buf[lop],8);
- BitConvert(&buf[lop],BitSwapTable1);
- BitConvert4(&buf[lop]);
- BitConvert(&buf[lop],BitSwapTable2);
- }
- return (char*)buf;
-}
-
-/*==========================================
- * Grfio : Entry table read
- *------------------------------------------
- */
-static int grfio_entryread(char *gfname,int gentry)
-{
- FILE *fp;
- long grf_size,list_size;
- unsigned char grf_header[0x2e];
- int lop,entry,entrys,ofs,grf_version;
- char *fname;
- unsigned char *grf_filelist;
-
- fp = fopen(gfname, "rb");
- if (fp == NULL) {
- ShowWarning("GRF Data File not found: '"CL_WHITE"%s"CL_RESET"'.\n",gfname);
- return 1; // 1:not found error
- }
-
- fseek(fp,0,2); // SEEK_END
- grf_size = ftell(fp);
- fseek(fp,0,0); // SEEK_SET
- fread(grf_header,1,0x2e,fp);
- if (strcmp((const char *) grf_header,"Master of Magic") ||
- fseek(fp,getlong(grf_header+0x1e),1)) // SEEK_CUR
- {
- fclose(fp);
- ShowError("GRF %s read error\n",gfname);
- return 2; // 2:file format error
- }
-
- grf_version = getlong(grf_header+0x2a) >> 8;
-
- if (grf_version == 0x01) { //****** Grf version 01xx ******
- list_size = grf_size - ftell(fp);
- grf_filelist = (unsigned char *) aMallocA(list_size);
- /*if (grf_filelist == NULL){
- fclose(fp);
- ShowError("out of memory : grf_filelist\n");
- return 3; // 3:memory alloc error
- }*/
- fread(grf_filelist,1,list_size,fp);
- fclose(fp);
-
- entrys = getlong(grf_header+0x26) - getlong(grf_header+0x22) - 7;
-
- // Get an entry
- for (entry = 0,ofs = 0; entry < entrys; entry++) {
- int ofs2, srclen, srccount, type;
- char *period_ptr;
- FILELIST aentry;
-
- ofs2 = ofs+getlong(grf_filelist+ofs)+4;
- type = grf_filelist[ofs2+12];
- if (type != 0) { // Directory Index ... skip
- fname = decode_filename(grf_filelist+ofs+6, grf_filelist[ofs]-6);
- if (strlen(fname) > sizeof(aentry.fn) - 1) {
- ShowFatalError("GRF file name %s is too long\n", fname);
- aFree(grf_filelist);
- exit(1);
- }
- srclen = 0;
- if ((period_ptr = strrchr(fname, '.')) != NULL) {
- for(lop = 0; lop < 4; lop++) {
- if (strcmpi(period_ptr, ".gnd\0.gat\0.act\0.str"+lop*5) == 0)
- break;
- }
- srclen = getlong(grf_filelist+ofs2) - getlong(grf_filelist+ofs2+8) - 715;
- if(lop == 4) {
- for(lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
- } else {
- srccount = 0;
- }
- } else {
- srccount = 0;
- }
-
- aentry.srclen = srclen;
- aentry.srclen_aligned = getlong(grf_filelist+ofs2+4)-37579;
- aentry.declen = getlong(grf_filelist+ofs2+8);
- aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
- aentry.cycle = srccount;
- aentry.type = type;
- strncpy(aentry.fn, fname,sizeof(aentry.fn)-1);
- aentry.fnd = NULL;
-#ifdef GRFIO_LOCAL
- aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
-#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
-#endif
- filelist_modify(&aentry);
- }
- ofs = ofs2 + 17;
- }
- aFree(grf_filelist);
-
- } else if (grf_version == 0x02) { //****** Grf version 02xx ******
- unsigned char eheader[8];
- unsigned char *rBuf;
- uLongf rSize, eSize;
-
- fread(eheader,1,8,fp);
- rSize = getlong(eheader); // Read Size
- eSize = getlong(eheader+4); // Extend Size
-
- if ((long)rSize > grf_size-ftell(fp)) { // Warning fix [Lance]
- fclose(fp);
- ShowError("Illegal data format : grf compress entry size\n");
- return 4;
- }
-
- rBuf = (unsigned char *)aMallocA(rSize); // Get a Read Size
- /*if (rBuf==NULL) {
- fclose(fp);
- ShowError("out of memory : grf compress entry table buffer\n");
- return 3;
- }*/
- grf_filelist = (unsigned char *)aMallocA(eSize); // Get a Extend Size
- /*if (grf_filelist==NULL) {
- aFree(rBuf);
- fclose(fp);
- ShowError("out of memory : grf extract entry table buffer\n");
- return 3;
- }*/
- fread(rBuf,1,rSize,fp);
- fclose(fp);
- decode_zip(grf_filelist, &eSize, rBuf, rSize); // Decode function
- list_size = eSize;
- aFree(rBuf);
-
- entrys = getlong(grf_header+0x26) - 7;
-
- // Get an entry
- for(entry = 0, ofs = 0; entry < entrys; entry++){
- int ofs2, srclen, srccount, type;
- FILELIST aentry;
-
- fname = (char*)(grf_filelist+ofs);
- if (strlen(fname) > sizeof(aentry.fn)-1) {
- ShowFatalError("GRF file name %s is too long\n", fname);
- aFree(grf_filelist);
- exit(1);
- }
- //ofs2 = ofs+strlen((char*)(grf_filelist+ofs))+1;
- ofs2 = ofs + strlen(fname)+1;
- type = grf_filelist[ofs2+12];
- if (type == 1 || type == 3 || type == 5) {
- srclen = getlong(grf_filelist+ofs2);
- if (grf_filelist[ofs2+12] == 3) {
- for (lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
- } else if (grf_filelist[ofs2+12] == 5) {
- srccount = 0;
- } else { // if (grf_filelist[ofs2+12]==1) {
- srccount = -1;
- }
-
- aentry.srclen = srclen;
- aentry.srclen_aligned = getlong(grf_filelist+ofs2+4);
- aentry.declen = getlong(grf_filelist+ofs2+8);
- aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
- aentry.cycle = srccount;
- aentry.type = type;
- strncpy(aentry.fn,fname,sizeof(aentry.fn)-1);
- aentry.fnd = NULL;
-#ifdef GRFIO_LOCAL
- aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
-#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
-#endif
- filelist_modify(&aentry);
- }
- ofs = ofs2 + 17;
- }
- aFree(grf_filelist);
-
- } else { //****** Grf Other version ******
- fclose(fp);
- ShowError("GRF version %04x not supported\n",getlong(grf_header+0x2a));
- return 4;
- }
-
- filelist_adjust(); // Unnecessary area release of filelist
-
- return 0; // 0:no error
-}
-
-/*==========================================
- * Grfio : Resource file check
- *------------------------------------------
- */
-static void grfio_resourcecheck(void)
-{
- char w1[256], w2[256], src[256], dst[256], restable[256], line[256];
- char *ptr, *buf;
- FILELIST *entry;
- int size, i = 0;
- FILE *fp;
-
- // read resnametable from data directory and return if successful
- sprintf(restable, "%sdata\\resnametable.txt", data_dir);
- for (ptr = &restable[0]; *ptr != 0; ptr++)
- if (*ptr == '\\') *ptr = '/';
-
- fp = fopen(restable,"rb");
- if (fp) {
- while (fgets(line, sizeof(line) - 1, fp)) {
- if (sscanf(line, "%[^#]#%[^#]#", w1, w2) == 2 &&
- // we only need the map names and text files
- (strstr(w2, ".gat") || strstr(w2, ".txt")))
- {
- sprintf(src, "data\\%s", w1);
- sprintf(dst, "data\\%s", w2);
- entry = filelist_find(dst);
- // create new entries reusing the original's info
- if (entry != NULL) {
- FILELIST fentry;
- memcpy(&fentry, entry, sizeof(FILELIST));
- strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
- fentry.fnd = grfio_alloc_ptr(dst);
- filelist_modify(&fentry);
- i++;
- }
- }
- }
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, "resnametable.txt");
- return; // we're done here!
- }
-
- // read resnametable from loaded GRF's, only if it cannot be
- // loaded from the data directory
- buf = (char *)grfio_reads("data\\resnametable.txt", &size);
- if (buf) {
- buf[size] = 0;
- ptr = buf;
-
- while (ptr - buf < size) {
- if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
- (strstr(w2, ".gat") || strstr(w2, ".txt")))
- {
- sprintf(src, "data\\%s", w1);
- sprintf(dst, "data\\%s", w2);
- entry = filelist_find(dst);
- if (entry != NULL) {
- FILELIST fentry;
- memcpy(&fentry, entry, sizeof(FILELIST));
- strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
- fentry.fnd = grfio_alloc_ptr(dst);
- filelist_modify(&fentry);
- i++;
- }
- }
- ptr = strchr(ptr,'\n'); // Next line
- if (!ptr) break;
- ptr++;
- }
- aFree(buf);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, "data\\resnametable.txt");
- return;
- }
-
- //ShowWarning("GRF: No resnametable found! Panic?\n");
-}
-
-/*==========================================
- * Grfio : Resource add
- *------------------------------------------
- */
-#define GENTRY_ADDS 4 // The number increment of gentry_table entries
-
-static int grfio_add(char *fname)
-{
- grfio_alloc_ptr(fname);
-
- return grfio_entryread(fname, gentry_entrys - 1);
-}
-
-char *grfio_alloc_ptr(char *fname)
-{
- int len;
- char *buf;
-
- if (gentry_entrys >= GENTRY_LIMIT) {
- ShowFatalError("gentrys limit : grfio_add\n");
- exit(1);
- }
-
- if (gentry_entrys >= gentry_maxentry) {
- gentry_maxentry += GENTRY_ADDS;
- gentry_table = (char**)aRealloc(gentry_table, gentry_maxentry * sizeof(char*));
- memset(gentry_table + (gentry_maxentry - GENTRY_ADDS), 0, sizeof(char*) * GENTRY_ADDS);
- }
- len = strlen( fname );
- buf = (char*)aMallocA(len + 1);
- strcpy(buf, fname);
- gentry_table[gentry_entrys++] = buf;
-
- return buf;
-}
-
-/*==========================================
- * Grfio : Finalize
- *------------------------------------------
- */
-void grfio_final(void)
-{
- if (filelist != NULL)
- aFree(filelist);
-
- filelist_entrys = filelist_maxentry = 0;
-
- if (gentry_table != NULL) {
- int lop;
- for (lop = 0; lop < gentry_entrys; lop++) {
- if (gentry_table[lop] != NULL)
- aFree(gentry_table[lop]);
- }
- aFree(gentry_table);
- }
- gentry_table = NULL;
- gentry_entrys = gentry_maxentry = 0;
-}
-
-/*==========================================
- * Grfio : Initialize
- *------------------------------------------
- */
-void grfio_init(char *fname)
-{
- FILE *data_conf;
- char line[1024], w1[1024], w2[1024];
- int result = 0;
-
- hashinit(); // hash table initialization
-
- data_conf = fopen(fname, "r");
- // It will read, if there is grf-files.txt.
- if (data_conf) {
- while(fgets(line, sizeof(line) - 1, data_conf)) {
- if (line[0] == '/' && line[1] == '/')
- continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
- continue;
- // Entry table reading
- if(strcmp(w1, "grf") == 0 ||
- strcmp(w1, "data") == 0 || // Primary data file
- strcmp(w1, "sdata") == 0 || // Sakray data file
- strcmp(w1, "adata") == 0) // Alpha version data file
- // increment if successfully loaded
- result += (grfio_add(w2) == 0);
- else if(strcmp(w1,"data_dir") == 0) // Data directory
- strcpy(data_dir, w2);
- }
-
- fclose(data_conf);
- ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n", fname);
- } // end of reading grf-files.txt
-
- if (result == 0) {
- ShowInfo("No grf's loaded.. using default data directory\n");
- //exit(1); // It ends, if a resource cannot read one.
- }
-
- // Unnecessary area release of filelist
- filelist_adjust();
- // Resource check
- grfio_resourcecheck();
-
- return;
-}
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 01489ce93..439075b99 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -20,11 +20,11 @@ struct indexes {
static unsigned short max_index = 0;
-char mapindex_cfgfile[80] = "db/map_index.txt";
+char mapindex_cfgfile[80] = "db/map_list.txt";
/// Adds a map to the specified index
/// Returns 1 if successful, 0 oherwise
-static int mapindex_addmap(int index, const char *name)
+int mapindex_addmap(int index, const char *name)
{
char map_name[1024];
char *ext;
@@ -41,25 +41,13 @@ static int mapindex_addmap(int index, const char *name)
ShowError("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
return 0;
}
- if ((ext = strstr(map_name, ".gat")) != NULL) { //Gat map
+ if ((ext = strstr(map_name, ".")) != NULL) { // Remove extension
length = ext-map_name;
- } else if ((ext = strstr(map_name, ".afm")) != NULL || (ext = strstr(map_name, ".af2")) != NULL) { //afm map
- length = ext-map_name;
- sprintf(ext, ".gat"); //Change the extension to gat
- } else if ((ext = strstr(map_name, ".")) != NULL) { //Generic extension?
- length = ext-map_name;
- sprintf(ext, ".gat");
- } else { //No extension?
- length = strlen(map_name);
- strcat(map_name, ".gat");
- }
- if (length > MAP_NAME_LENGTH - 4) {
- ShowError("(mapindex_add) Adjusted Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
- return 0;
+ sprintf(ext, "\0");
}
if (indexes[index].length)
- ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", indexes[index].name, map_name);
+ ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);
strncpy(indexes[index].name, map_name, MAP_NAME_LENGTH);
indexes[index].length = length;
@@ -77,7 +65,7 @@ unsigned short mapindex_name2id(const char* name) {
length = ext-name; //Base map-name length without the extension.
for (i = 1; i < max_index; i++)
{
- if (indexes[i].length == length && strncmp(indexes[i].name,name,length)==0)
+ if (strncmp(indexes[i].name,name,length)==0)
return i;
}
#ifdef MAPINDEX_AUTOADD
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index a4aabbc7b..dfcb150e2 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -12,31 +12,32 @@ extern char mapindex_cfgfile[80];
//#define MAPINDEX_AUTOADD
//Some definitions for the mayor city maps.
-#define MAP_PRONTERA "prontera.gat"
-#define MAP_GEFFEN "geffen.gat"
-#define MAP_MORROC "morocc.gat"
-#define MAP_ALBERTA "alberta.gat"
-#define MAP_PAYON "payon.gat"
-#define MAP_IZLUDE "izlude.gat"
-#define MAP_ALDEBARAN "aldebaran.gat"
-#define MAP_LUTIE "xmas.gat"
-#define MAP_COMODO "comodo.gat"
-#define MAP_YUNO "yuno.gat"
-#define MAP_AMATSU "amatsu.gat"
-#define MAP_GONRYUN "gonryun.gat"
-#define MAP_UMBALA "umbala.gat"
-#define MAP_NIFLHEIM "niflheim.gat"
-#define MAP_LOUYANG "louyang.gat"
-#define MAP_JAWAII "jawaii.gat"
-#define MAP_AYOTHAYA "ayothaya.gat"
-#define MAP_EINBROCH "einbroch.gat"
-#define MAP_LIGHTHALZEN "lighthalzen.gat"
-#define MAP_EINBECH "einbech.gat"
-#define MAP_HUGEL "hugel.gat"
-#define MAP_RACHEL "rachel.gat"
-#define MAP_VEINS "veins.gat"
-#define MAP_JAIL "sec_pri.gat"
-#define MAP_NOVICE "new_zone01.gat"
+#define MAP_PRONTERA "prontera"
+#define MAP_GEFFEN "geffen"
+#define MAP_MORROC "morocc"
+#define MAP_ALBERTA "alberta"
+#define MAP_PAYON "payon"
+#define MAP_IZLUDE "izlude"
+#define MAP_ALDEBARAN "aldebaran"
+#define MAP_LUTIE "xmas"
+#define MAP_COMODO "comodo"
+#define MAP_YUNO "yuno"
+#define MAP_AMATSU "amatsu"
+#define MAP_GONRYUN "gonryun"
+#define MAP_UMBALA "umbala"
+#define MAP_NIFLHEIM "niflheim"
+#define MAP_LOUYANG "louyang"
+#define MAP_JAWAII "jawaii"
+#define MAP_AYOTHAYA "ayothaya"
+#define MAP_EINBROCH "einbroch"
+#define MAP_LIGHTHALZEN "lighthalzen"
+#define MAP_EINBECH "einbech"
+#define MAP_HUGEL "hugel"
+#define MAP_RACHEL "rachel"
+#define MAP_VEINS "veins"
+#define MAP_JAIL "sec_pri"
+#define MAP_NOVICE "new_zone01"
+int mapindex_addmap(int index, const char *name);
unsigned short mapindex_name2id(const char*);
const char* mapindex_id2name(unsigned short);
void mapindex_init(void);
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b104633a6..5ec3c1f1b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1327,9 +1327,6 @@ int atcommand_rura( const int fd, struct map_session_data* sd, const char* comma
return -1;
}
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
-
mapindex = mapindex_name2id(map_name);
if (mapindex)
m = map_mapindex2mapid(mapindex);
@@ -1713,8 +1710,6 @@ int atcommand_whomap3(const int fd, struct map_session_data* sd, const char* com
map_id = sd->bl.m;
else {
sscanf(message, "%15s", map_name);
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
if ((map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
@@ -1771,8 +1766,6 @@ int atcommand_whomap2(const int fd, struct map_session_data* sd, const char* com
map_id = sd->bl.m;
else {
sscanf(message, "%15s", map_name);
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
if ((map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
@@ -1835,8 +1828,6 @@ int atcommand_whomap(const int fd, struct map_session_data* sd, const char* comm
map_id = sd->bl.m;
else {
sscanf(message, "%15s", map_name);
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
if ((map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
@@ -3252,77 +3243,75 @@ int atcommand_go(const int fd, struct map_session_data* sd, const char* command,
clif_displaymessage(fd, " 24=Veins");
return -1;
} else {
- // get possible name of the city and add .gat if not in the name
+ // get possible name of the city
map_name[MAP_NAME_LENGTH-1] = '\0';
for (i = 0; map_name[i]; i++)
map_name[i] = tolower(map_name[i]);
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
// try to see if it's a name, and not a number (try a lot of possibilities, write errors and abbreviations too)
- if (strncmp(map_name, "prontera.gat", 3) == 0) { // 3 first characters
+ if (strncmp(map_name, "prontera", 3) == 0) { // 3 first characters
town = 0;
- } else if (strncmp(map_name, "morocc.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "morocc", 3) == 0) { // 3 first characters
town = 1;
- } else if (strncmp(map_name, "geffen.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "geffen", 3) == 0) { // 3 first characters
town = 2;
- } else if (strncmp(map_name, "payon.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "paion.gat", 3) == 0) { // writing error (3 first characters)
+ } else if (strncmp(map_name, "payon", 3) == 0 || // 3 first characters
+ strncmp(map_name, "paion", 3) == 0) { // writing error (3 first characters)
town = 3;
- } else if (strncmp(map_name, "alberta.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "alberta", 3) == 0) { // 3 first characters
town = 4;
- } else if (strncmp(map_name, "izlude.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "islude.gat", 3) == 0) { // writing error (3 first characters)
+ } else if (strncmp(map_name, "izlude", 3) == 0 || // 3 first characters
+ strncmp(map_name, "islude", 3) == 0) { // writing error (3 first characters)
town = 5;
- } else if (strncmp(map_name, "aldebaran.gat", 3) == 0 || // 3 first characters
- strcmp(map_name, "al.gat") == 0) { // al (de baran)
+ } else if (strncmp(map_name, "aldebaran", 3) == 0 || // 3 first characters
+ strcmp(map_name, "al") == 0) { // al (de baran)
town = 6;
- } else if (strncmp(map_name, "lutie.gat", 3) == 0 || // name of the city, not name of the map (3 first characters)
- strcmp(map_name, "christmas.gat") == 0 || // name of the symbol
- strncmp(map_name, "xmas.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "x-mas.gat", 3) == 0) { // writing error (3 first characters)
+ } else if (strncmp(map_name, "lutie", 3) == 0 || // name of the city, not name of the map (3 first characters)
+ strcmp(map_name, "christmas") == 0 || // name of the symbol
+ strncmp(map_name, "xmas", 3) == 0 || // 3 first characters
+ strncmp(map_name, "x-mas", 3) == 0) { // writing error (3 first characters)
town = 7;
- } else if (strncmp(map_name, "comodo.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "comodo", 3) == 0) { // 3 first characters
town = 8;
- } else if (strncmp(map_name, "yuno.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "yuno", 3) == 0) { // 3 first characters
town = 9;
- } else if (strncmp(map_name, "amatsu.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "ammatsu.gat", 3) == 0) { // writing error (3 first characters)
+ } else if (strncmp(map_name, "amatsu", 3) == 0 || // 3 first characters
+ strncmp(map_name, "ammatsu", 3) == 0) { // writing error (3 first characters)
town = 10;
- } else if (strncmp(map_name, "gonryun.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "gonryun", 3) == 0) { // 3 first characters
town = 11;
- } else if (strncmp(map_name, "umbala.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "umbala", 3) == 0) { // 3 first characters
town = 12;
- } else if (strncmp(map_name, "niflheim.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "niflheim", 3) == 0) { // 3 first characters
town = 13;
- } else if (strncmp(map_name, "louyang.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "louyang", 3) == 0) { // 3 first characters
town = 14;
- } else if (strncmp(map_name, "new_zone01.gat", 3) == 0 || // 3 first characters (or "newbies")
- strncmp(map_name, "startpoint.gat", 3) == 0 || // name of the position (3 first characters)
- strncmp(map_name, "begining.gat", 3) == 0) { // name of the position (3 first characters)
+ } else if (strncmp(map_name, "new_zone01", 3) == 0 || // 3 first characters (or "newbies")
+ strncmp(map_name, "startpoint", 3) == 0 || // name of the position (3 first characters)
+ strncmp(map_name, "begining", 3) == 0) { // name of the position (3 first characters)
town = 15;
- } else if (strncmp(map_name, "sec_pri.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "prison.gat", 3) == 0 || // name of the position (3 first characters)
- strncmp(map_name, "jails.gat", 3) == 0) { // name of the position
+ } else if (strncmp(map_name, "sec_pri", 3) == 0 || // 3 first characters
+ strncmp(map_name, "prison", 3) == 0 || // name of the position (3 first characters)
+ strncmp(map_name, "jails", 3) == 0) { // name of the position
town = 16;
- } else if (strncmp(map_name, "jawaii.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "jawai.gat", 3) == 0) { // writing error (3 first characters)
+ } else if (strncmp(map_name, "jawaii", 3) == 0 || // 3 first characters
+ strncmp(map_name, "jawai", 3) == 0) { // writing error (3 first characters)
town = 17;
- } else if (strncmp(map_name, "ayothaya.gat", 2) == 0 || // 2 first characters
- strncmp(map_name, "ayotaya.gat", 2) == 0) { // writing error (2 first characters)
+ } else if (strncmp(map_name, "ayothaya", 2) == 0 || // 2 first characters
+ strncmp(map_name, "ayotaya", 2) == 0) { // writing error (2 first characters)
town = 18;
- } else if (strncmp(map_name, "einbroch.gat", 5) == 0 || // 5 first characters
- strncmp(map_name, "ainbroch.gat", 5) == 0) { // writing error (5 first characters)
+ } else if (strncmp(map_name, "einbroch", 5) == 0 || // 5 first characters
+ strncmp(map_name, "ainbroch", 5) == 0) { // writing error (5 first characters)
town = 19;
- } else if (strncmp(map_name, "lighthalzen.gat", 3) == 0 || // 3 first characters
- strncmp(map_name, "reichthalzen.gat", 3) == 0) { // 'alternative' name (3 first characters)
+ } else if (strncmp(map_name, "lighthalzen", 3) == 0 || // 3 first characters
+ strncmp(map_name, "reichthalzen", 3) == 0) { // 'alternative' name (3 first characters)
town = 20;
- } else if (strncmp(map_name, "einbech.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "einbech", 3) == 0) { // 3 first characters
town = 21;
- } else if (strncmp(map_name, "hugel.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "hugel", 3) == 0) { // 3 first characters
town = 22;
- } else if (strncmp(map_name, "rachel.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "rachel", 3) == 0) { // 3 first characters
town = 23;
- } else if (strncmp(map_name, "veins.gat", 3) == 0) { // 3 first characters
+ } else if (strncmp(map_name, "veins", 3) == 0) { // 3 first characters
town = 24;
}
@@ -3650,8 +3639,6 @@ void atcommand_killmonster_sub(const int fd, struct map_session_data* sd, const
if (!message || !*message || sscanf(message, "%15s", map_name) < 1)
map_id = sd->bl.m;
else {
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
if ((map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
@@ -5446,8 +5433,6 @@ int atcommand_mapinfo(const int fd, struct map_session_data* sd, const char* com
atcmd_player_name[MAP_NAME_LENGTH] = '\0';
m_id = map_mapindex2mapid(sd->mapindex);
} else {
- if (strstr(atcmd_player_name, ".gat") == NULL && strstr(atcmd_player_name, ".afm") == NULL && strlen(atcmd_player_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(atcmd_player_name, ".gat");
m_id = map_mapname2mapid(atcmd_player_name);
}
if (m_id < 0) {
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 5eb03dd1f..743f456f6 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -628,9 +628,6 @@ int charcommand_save(
return -1;
}
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
-
if ((pl_sd = map_nick2sd(character)) != NULL) {
if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change save point only to lower or same gm level
m = map_mapname2mapid(map_name);
@@ -1146,9 +1143,6 @@ int charcommand_warp(
return -1;
}
- if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
- strcat(map_name, ".gat");
-
if ((pl_sd = map_nick2sd(character)) == NULL) {
clif_displaymessage(fd, msg_table[3]); // Character not found.
return -1;
diff --git a/src/map/clif.c b/src/map/clif.c
index bcfae2bf2..f5dff2f85 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1596,14 +1596,17 @@ void clif_setwaitclose(int fd) {
*/
int clif_changemap(struct map_session_data *sd, short map, int x, int y) {
int fd;
+ char map_name[MAP_NAME_LENGTH];
nullpo_retr(0, sd);
fd = sd->fd;
-
+
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(map));
+
WFIFOHEAD(fd, packet_len(0x91));
WFIFOW(fd,0) = 0x91;
- memcpy(WFIFOP(fd,2), mapindex_id2name(map), MAP_NAME_LENGTH);
+ memcpy(WFIFOP(fd,2), map_name, MAP_NAME_LENGTH);
WFIFOW(fd,18) = x;
WFIFOW(fd,20) = y;
WFIFOSET(fd, packet_len(0x91));
@@ -5616,12 +5619,17 @@ int clif_party_created(struct map_session_data *sd,int flag)
int clif_party_member_info(struct party_data *p, struct map_session_data *sd)
{
unsigned char buf[96];
+ char map_name[MAP_NAME_LENGTH];
+
if (!sd) { //Pick any party member (this call is used when changing item share rules)
int i;
for (i=0; i<MAX_PARTY && !p->data[i].sd; i++);
if (i >= MAX_PARTY) return 0; //Should never happen...
sd = p->data[i].sd;
}
+
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(sd->mapindex));
+
WBUFW(buf,0)=0x1e9;
WBUFL(buf,2)= sd->status.account_id;
WBUFL(buf,6)= 0; //Apparently setting this to 1 makes you adoptable.
@@ -5630,7 +5638,7 @@ int clif_party_member_info(struct party_data *p, struct map_session_data *sd)
WBUFB(buf,14)=0; //Unconfirmed byte, could be online/offline.
memcpy(WBUFP(buf,15), p->party.name, NAME_LENGTH);
memcpy(WBUFP(buf,39), sd->status.name, NAME_LENGTH);
- memcpy(WBUFP(buf,63), mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
+ memcpy(WBUFP(buf,63), map_name, MAP_NAME_LENGTH);
WBUFB(buf,79) = (p->party.item&1)?1:0;
WBUFB(buf,80) = (p->party.item&2)?1:0;
clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY);
@@ -5655,13 +5663,17 @@ int clif_party_info(struct party_data* p, struct map_session_data *sd)
for(i = 0, c = 0; i < MAX_PARTY; i++)
{
struct party_member* m = &p->party.member[i];
+ char map_name[MAP_NAME_LENGTH];
+
if(!m->account_id) continue;
if(party_sd == NULL) party_sd = p->data[i].sd;
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(m->map));
+
WBUFL(buf,28+c*46) = m->account_id;
memcpy(WBUFP(buf,28+c*46+4), m->name, NAME_LENGTH);
- memcpy(WBUFP(buf,28+c*46+28), mapindex_id2name(m->map), MAP_NAME_LENGTH);
+ memcpy(WBUFP(buf,28+c*46+28), map_name, MAP_NAME_LENGTH);
WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1;
WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1;
c++;
@@ -5940,10 +5952,13 @@ int clif_hpmeter(struct map_session_data *sd)
int clif_party_move(struct party *p,struct map_session_data *sd,int online)
{
unsigned char buf[128];
+ char map_name[MAP_NAME_LENGTH];
nullpo_retr(0, sd);
nullpo_retr(0, p);
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", map[sd->bl.m].name);
+
WBUFW(buf, 0)=0x104;
WBUFL(buf, 2)=sd->status.account_id;
WBUFL(buf, 6)=0;
@@ -5952,7 +5967,7 @@ int clif_party_move(struct party *p,struct map_session_data *sd,int online)
WBUFB(buf,14)=!online;
memcpy(WBUFP(buf,15),p->name, NAME_LENGTH);
memcpy(WBUFP(buf,39),sd->status.name, NAME_LENGTH);
- memcpy(WBUFP(buf,63),map[sd->bl.m].name, MAP_NAME_LENGTH);
+ memcpy(WBUFP(buf,63),map_name, MAP_NAME_LENGTH);
clif_send(buf,packet_len(0x104),&sd->bl,PARTY);
return 0;
}
@@ -7794,9 +7809,13 @@ void clif_gospel_info(struct map_session_data *sd, int type)
void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type)
{
int fd=sd->fd;
+ char map_name[MAP_NAME_LENGTH];
+
+ snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(sd->feel_map[feel_level].index));
+
WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
- memcpy(WFIFOP(fd,2),mapindex_id2name(sd->feel_map[feel_level].index), MAP_NAME_LENGTH);
+ memcpy(WFIFOP(fd,2),map_name, MAP_NAME_LENGTH);
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=feel_level;
WFIFOB(fd,31)=type?1:0;
diff --git a/src/map/guild.c b/src/map/guild.c
index c53343703..64af2e12a 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -253,6 +253,9 @@ struct guild_castle *guild_mapname2gc(char *mapname)
{
int i;
struct guild_castle *gc=NULL;
+
+ map_normalize_name(mapname);
+
for(i=0;i<MAX_GUILDCASTLE;i++){
gc=guild_castle_search(i);
if(!gc) continue;
@@ -261,14 +264,15 @@ struct guild_castle *guild_mapname2gc(char *mapname)
return NULL;
}
-struct guild_castle *guild_mapindex2gc(short mapname)
+struct guild_castle *guild_mapindex2gc(short mapindex)
{
int i;
struct guild_castle *gc=NULL;
+
for(i=0;i<MAX_GUILDCASTLE;i++){
gc=guild_castle_search(i);
if(!gc) continue;
- if(strcmp(gc->map_name,mapindex_id2name(mapname))==0) return gc;
+ if(strcmp(gc->map_name,mapindex_id2name(mapindex))==0) return gc;
}
return NULL;
}
diff --git a/src/map/guild.h b/src/map/guild.h
index d5b501e3a..9f21cd550 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -25,7 +25,7 @@ struct guild *guild_searchname(char *str);
struct guild_castle *guild_castle_search(int gcid);
struct guild_castle *guild_mapname2gc(char *mapname);
-struct guild_castle *guild_mapindex2gc(short mapname);
+struct guild_castle *guild_mapindex2gc(short mapindex);
struct map_session_data *guild_getavailablesd(struct guild *g);
int guild_getindex(struct guild *g,int account_id,int char_id);
diff --git a/src/map/map.c b/src/map/map.c
index 3f37c430e..dfdda95b7 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2432,12 +2432,6 @@ int map_eraseipport(unsigned short mapindex,unsigned long ip,int port)
* Map cache reading
*===========================================*/
-// This is the main header found at the very beginning of the file
-/*struct map_cache_head {
- long filesize;
- unsigned short map_count;
-};*/
-
// This is the header appended before every compressed map cells info
struct map_cache_info {
char name[MAP_NAME_LENGTH];
@@ -2449,6 +2443,7 @@ struct map_cache_info {
FILE *map_cache_fp;
+// Removes the extension from a map name
char *map_normalize_name(char *mapname)
{
char *ptr, *ptr2;
@@ -2457,7 +2452,8 @@ char *map_normalize_name(char *mapname)
while (ptr[1] && (ptr2 = strchr(ptr+1, '.')))
ptr = ptr2; //Skip to the last dot.
if(stricmp(ptr,".gat") == 0 ||
- stricmp(ptr,".afm") == 0)
+ stricmp(ptr,".afm") == 0 ||
+ stricmp(ptr,".af2") == 0)
*ptr = '\0'; //Remove extension.
}
return mapname;
@@ -2471,6 +2467,9 @@ int map_readmap(struct map_data *m)
unsigned long size;
unsigned char *buf;
+ if(!map_cache_fp)
+ return 0;
+
fseek(map_cache_fp, 0, SEEK_SET);
fread(&map_count, sizeof(map_count), 1, map_cache_fp);
@@ -2628,6 +2627,7 @@ int map_readallmaps (void)
map[i].block_count = (int*)aCallocA(size, 1);
map[i].block_mob_count = (int*)aCallocA(size, 1);
+ mapindex_addmap(map[i].index, map[i].name);
uidb_put(map_db, (unsigned int)map[i].index, &map[i]);
}
@@ -3177,8 +3177,6 @@ void do_final(void) {
if (map[i].moblist[j]) aFree(map[i].moblist[j]);
}
}
-
- mapindex_final();
id_db->destroy(id_db, NULL);
pc_db->destroy(pc_db, NULL);
@@ -3337,9 +3335,6 @@ int do_init(int argc, char *argv[]) {
charsql_db_init(1); //Connecting to chardb
#endif /* not TXT_ONLY */
- mapindex_init();
- grfio_init(GRF_PATH_FILENAME);
-
map_readallmaps();
add_timer_func_list(map_freeblock_timer, "map_freeblock_timer");
@@ -3378,9 +3373,6 @@ int do_init(int argc, char *argv[]) {
npc_event_do_oninit(); // npcのOnInitイベント?行
- //Done loading with the maps, no need for the grf module anymore.
- grfio_final();
-
if( console )
{
//##TODO invoke a CONSOLE_START plugin event
diff --git a/src/map/script.c b/src/map/script.c
index 11f5c6dda..6f862400f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4593,7 +4593,7 @@ BUILDIN_FUNC(areawarp)
* warpchar [LuzZza]
* Useful for warp one player from
* another player npc-session.
- * Using: warpchar "mapname.gat",x,y,Char_ID;
+ * Using: warpchar "mapname",x,y,Char_ID;
*------------------------------------------
*/
BUILDIN_FUNC(warpchar)
@@ -4631,7 +4631,7 @@ BUILDIN_FUNC(warpchar)
/*==========================================
* Warpparty - [Fredzilla]
- * Syntax: warpparty "mapname.gat",x,y,Party_ID;
+ * Syntax: warpparty "mapname",x,y,Party_ID;
*------------------------------------------
*/
BUILDIN_FUNC(warpparty)
@@ -4714,7 +4714,7 @@ BUILDIN_FUNC(warpparty)
}
/*==========================================
* Warpguild - [Fredzilla]
- * Syntax: warpguild "mapname.gat",x,y,Guild_ID;
+ * Syntax: warpguild "mapname",x,y,Guild_ID;
*------------------------------------------
*/
BUILDIN_FUNC(warpguild)
@@ -7806,7 +7806,7 @@ BUILDIN_FUNC(getusersname)
return 0;
}
/*==========================================
- * getmapguildusers("mapname.gat",guild ID) Returns the number guild members present on a map [Reddozen]
+ * getmapguildusers("mapname",guild ID) Returns the number guild members present on a map [Reddozen]
*------------------------------------------
*/
BUILDIN_FUNC(getmapguildusers)
@@ -9132,16 +9132,12 @@ BUILDIN_FUNC(flagemblem)
BUILDIN_FUNC(getcastlename)
{
- const char *mapname=conv_str(st,& (st->stack->stack_data[st->start+2]));
- struct guild_castle *gc=NULL;
- int i;
- for(i=0;i<MAX_GUILDCASTLE;i++){
- if( (gc=guild_castle_search(i)) != NULL ){
- if(strcmp(mapname,gc->map_name)==0){
- break;
- }
- }
- }
+ char mapname[MAP_NAME_LENGTH];
+ struct guild_castle *gc;
+
+ strncpy(mapname, conv_str(st,script_getdata(st,2)), MAP_NAME_LENGTH);
+ gc = guild_mapname2gc(mapname);
+
if(gc)
push_str(st->stack,C_CONSTSTR,gc->castle_name);
else
@@ -9151,66 +9147,67 @@ BUILDIN_FUNC(getcastlename)
BUILDIN_FUNC(getcastledata)
{
- char mapname[MAP_NAME_LENGTH+1];
+ char mapname[MAP_NAME_LENGTH];
int index=conv_num(st,& (st->stack->stack_data[st->start+3]));
const char *event=NULL;
struct guild_castle *gc;
- int i,j;
+ int i;
strncpy(mapname, conv_str(st,script_getdata(st,2)), MAP_NAME_LENGTH);
- mapname[MAP_NAME_LENGTH] = '\0';
- map_normalize_name(mapname);
-
- if( st->end>st->start+4 && index==0){
- for(i=0,j=-1;i<MAX_GUILDCASTLE;i++)
- if( (gc=guild_castle_search(i)) != NULL &&
- strcmp(mapname,gc->map_name)==0 )
- j=i;
- if(j>=0){
- event=conv_str(st,& (st->stack->stack_data[st->start+4]));
- check_event(st, event);
- guild_addcastleinfoevent(j,17,event);
- }
- }
-
- for(i=0;i<MAX_GUILDCASTLE;i++){
- if( (gc=guild_castle_search(i)) != NULL ){
- if(strcmp(mapname,gc->map_name)==0){
- switch(index){
- case 0: for(j=1;j<26;j++) guild_castledataload(gc->castle_id,j); break; // Initialize[AgitInit]
- case 1: push_val(st->stack,C_INT,gc->guild_id); break;
- case 2: push_val(st->stack,C_INT,gc->economy); break;
- case 3: push_val(st->stack,C_INT,gc->defense); break;
- case 4: push_val(st->stack,C_INT,gc->triggerE); break;
- case 5: push_val(st->stack,C_INT,gc->triggerD); break;
- case 6: push_val(st->stack,C_INT,gc->nextTime); break;
- case 7: push_val(st->stack,C_INT,gc->payTime); break;
- case 8: push_val(st->stack,C_INT,gc->createTime); break;
- case 9: push_val(st->stack,C_INT,gc->visibleC); break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- push_val(st->stack,C_INT,gc->guardian[index-10].visible); break;
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- push_val(st->stack,C_INT,gc->guardian[index-18].hp); break;
- default:
- push_val(st->stack,C_INT,0); break;
- }
- return 0;
- }
+ gc = guild_mapname2gc(mapname);
+
+ if(st->end>st->start+4 && index==0 && gc) {
+ event=conv_str(st,& (st->stack->stack_data[st->start+4]));
+ check_event(st, event);
+ guild_addcastleinfoevent(gc->castle_id,17,event);
+ }
+
+ if(gc){
+ switch(index){
+ case 0:
+ for(i=1;i<26;i++) // Initialize[AgitInit]
+ guild_castledataload(gc->castle_id,i);
+ break;
+ case 1:
+ push_val(st->stack,C_INT,gc->guild_id); break;
+ case 2:
+ push_val(st->stack,C_INT,gc->economy); break;
+ case 3:
+ push_val(st->stack,C_INT,gc->defense); break;
+ case 4:
+ push_val(st->stack,C_INT,gc->triggerE); break;
+ case 5:
+ push_val(st->stack,C_INT,gc->triggerD); break;
+ case 6:
+ push_val(st->stack,C_INT,gc->nextTime); break;
+ case 7:
+ push_val(st->stack,C_INT,gc->payTime); break;
+ case 8:
+ push_val(st->stack,C_INT,gc->createTime); break;
+ case 9:
+ push_val(st->stack,C_INT,gc->visibleC); break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ push_val(st->stack,C_INT,gc->guardian[index-10].visible); break;
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ push_val(st->stack,C_INT,gc->guardian[index-18].hp); break;
+ default:
+ push_val(st->stack,C_INT,0); break;
}
+ return 0;
}
push_val(st->stack,C_INT,0);
return 0;
@@ -9218,69 +9215,72 @@ BUILDIN_FUNC(getcastledata)
BUILDIN_FUNC(setcastledata)
{
- char mapname[MAP_NAME_LENGTH+1];
+ char mapname[MAP_NAME_LENGTH];
int index=conv_num(st,& (st->stack->stack_data[st->start+3]));
int value=conv_num(st,& (st->stack->stack_data[st->start+4]));
struct guild_castle *gc;
- int i;
strncpy(mapname, conv_str(st,script_getdata(st,2)), MAP_NAME_LENGTH);
- mapname[MAP_NAME_LENGTH] = '\0';
- map_normalize_name(mapname);
-
- for(i=0;i<MAX_GUILDCASTLE;i++){
- if( (gc=guild_castle_search(i)) != NULL ){
- if(strcmp(mapname,gc->map_name)==0){
- // Save Data byself First
- switch(index){
- case 1: gc->guild_id = value; break;
- case 2: gc->economy = value; break;
- case 3: gc->defense = value; break;
- case 4: gc->triggerE = value; break;
- case 5: gc->triggerD = value; break;
- case 6: gc->nextTime = value; break;
- case 7: gc->payTime = value; break;
- case 8: gc->createTime = value; break;
- case 9: gc->visibleC = value; break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- gc->guardian[index-10].visible = value; break;
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- gc->guardian[index-18].hp = value;
- if (gc->guardian[index-18].id)
- { //Update this mob's HP.
- struct block_list *bl = map_id2bl(gc->guardian[index-18].id);
- if (!bl)
- { //Wrong target?
- gc->guardian[index-18].id = 0;
- break;
- }
- if (value < 1) {
- status_kill(bl);
- break;
- }
- status_set_hp(bl, value, 0);
+ gc = guild_mapname2gc(mapname);
+
+ if(gc) {
+ // Save Data byself First
+ switch(index){
+ case 1:
+ gc->guild_id = value; break;
+ case 2:
+ gc->economy = value; break;
+ case 3:
+ gc->defense = value; break;
+ case 4:
+ gc->triggerE = value; break;
+ case 5:
+ gc->triggerD = value; break;
+ case 6:
+ gc->nextTime = value; break;
+ case 7:
+ gc->payTime = value; break;
+ case 8:
+ gc->createTime = value; break;
+ case 9:
+ gc->visibleC = value; break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ gc->guardian[index-10].visible = value; break;
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ gc->guardian[index-18].hp = value;
+ if (gc->guardian[index-18].id)
+ { //Update this mob's HP.
+ struct block_list *bl = map_id2bl(gc->guardian[index-18].id);
+ if (!bl)
+ { //Wrong target?
+ gc->guardian[index-18].id = 0;
+ break;
}
- break;
- default: return 0;
+ if (value < 1) {
+ status_kill(bl);
+ break;
+ }
+ status_set_hp(bl, value, 0);
}
- guild_castledatasave(gc->castle_id,index,value);
+ break;
+ default:
return 0;
- }
}
+ guild_castledatasave(gc->castle_id,index,value);
}
return 0;
}
@@ -10853,7 +10853,7 @@ BUILDIN_FUNC(prompt)
/*==========================================
* GetMapMobs
returns mob counts on a set map:
- e.g. GetMapMobs("prontera.gat")
+ e.g. GetMapMobs("prontera")
use "this" - for player's map
*------------------------------------------
*/
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index e73723e66..79de65e0b 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -12,8 +12,8 @@
#include "grfio.h"
-char grf_list_file[256] = "tools/mapcache/grf_files.txt";
-char map_list_file[256] = "tools/mapcache/map_list.txt";
+char grf_list_file[256] = "db/grf_files.txt";
+char map_list_file[256] = "db/map_list.txt";
char map_cache_file[256] = "db/map_cache.dat";
#define MAP_NAME_LENGTH 16
@@ -226,8 +226,7 @@ int main(int argc, char *argv[])
printf("Map file not found in GRF\n");
// If the 2nd argument is omitted at next line, we'll keep last used index + 1
index++;
- } else
- printf("Skipping incorrect line\n");
+ }
}
printf("Closing map list: %s\n", map_list_file);
diff --git a/vcproj-8/char-server_txt.vcproj b/vcproj-8/char-server_txt.vcproj
index b42153d6c..5947caa83 100644
--- a/vcproj-8/char-server_txt.vcproj
+++ b/vcproj-8/char-server_txt.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8.00"
+ Version="8,00"
Name="char-server_txt"
ProjectGUID="{D356871D-58E1-450B-967A-E3E9646175AF}"
RootNamespace="char-server_txt"