summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-10-20 17:43:44 +0200
committerGitHub <noreply@github.com>2019-10-20 17:43:44 +0200
commit275edef51c858e9e55934ec3af92ec19db74f3d3 (patch)
tree81c4367dfb4d51fec9c71c2a407f502a514b6a67 /src/map/map.c
parentddd0e461fb8e451912a6aee90869023e2c2d8272 (diff)
parentbe955e59bcd950d6430189a8a23a608927665c02 (diff)
downloadhercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.gz
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.bz2
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.xz
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.zip
Merge pull request #2547 from guilherme-gm/201910-dehardcode-db
Dehardcode DB files path
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 957098dd4..50ad9a5cd 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -4054,6 +4054,7 @@ static bool map_config_read_database(const char *filename, struct config_t *conf
return false;
}
libconfig->setting_lookup_mutable_string(setting, "db_path", map->db_path, sizeof(map->db_path));
+ libconfig->set_db_path(map->db_path);
libconfig->setting_lookup_int(setting, "save_settings", &map->save_settings);
if (libconfig->setting_lookup_int(setting, "autosave_time", &map->autosave_interval) == CONFIG_TRUE) {
@@ -5573,12 +5574,8 @@ static void read_map_zone_db(void)
{
struct config_t map_zone_db;
struct config_setting_t *zones = NULL;
- /* TODO: #ifndef required for re/pre-re */
-#ifdef RENEWAL
- const char *config_filename = "db/re/map_zone_db.conf"; // FIXME hardcoded name
-#else
- const char *config_filename = "db/pre-re/map_zone_db.conf"; // FIXME hardcoded name
-#endif
+ char config_filename[256];
+ libconfig->format_db_path(DBPATH"map_zone_db.conf", config_filename, sizeof(config_filename));
if (!libconfig->load_file(&map_zone_db, config_filename))
return;
@@ -6776,6 +6773,7 @@ void map_defaults(void)
map->extra_scripts_count = 0;
sprintf(map->db_path ,"db");
+ libconfig->set_db_path(map->db_path);
sprintf(map->help_txt ,"conf/help.txt");
sprintf(map->charhelp_txt ,"conf/charhelp.txt");