summaryrefslogtreecommitdiff
path: root/src/map/mapreg_sql.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-07 01:42:31 +0200
committerHaru <haru@dotalux.com>2016-08-19 21:32:13 +0200
commitea9ceb17bdf4ea4acf28dca84508b62bd7e94fd4 (patch)
treed122655c806ae3a9dfea3688e6837da6272ffc7d /src/map/mapreg_sql.c
parent9783ce1d536d0f3f5d7e34d90717a65779ff923a (diff)
downloadhercules-ea9ceb17bdf4ea4acf28dca84508b62bd7e94fd4.tar.gz
hercules-ea9ceb17bdf4ea4acf28dca84508b62bd7e94fd4.tar.bz2
hercules-ea9ceb17bdf4ea4acf28dca84508b62bd7e94fd4.tar.xz
hercules-ea9ceb17bdf4ea4acf28dca84508b62bd7e94fd4.zip
Ported inter-server.conf to libconfig
Ported to modern Hercules and cleaned up from Panikon's commits: 40f9ec33868e2240cab013308897898ed252b3e0, a9d646da19e25ab6fcf44dbd1ae7d90c30f6686c, 1aa8581a0aecbfd53e877686c399ffb731dcd75e, 72c645b015ae6130ca7d4309d0fb1413340e7f23, f8c906a0496b9acdae1d8244b1544fa03592061e, 51d88a58983c9552dfd1a0f059e5a031742aed61, 443684b3c77f4c32fe7877a7f8d62debf73b1e93, cf93eafef1f322cd1583226272b7d4008f562da4 Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mapreg_sql.c')
-rw-r--r--src/map/mapreg_sql.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 82ce39d64..4cdb91b21 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -25,6 +25,7 @@
#include "map/map.h" // map-"mysql_handle
#include "map/script.h"
#include "common/cbasetypes.h"
+#include "common/conf.h"
#include "common/db.h"
#include "common/ers.h"
#include "common/memmgr.h"
@@ -349,13 +350,19 @@ void mapreg_init(void) {
/**
* Loads the mapreg configuration file.
+ *
+ * @param filename Path to configuration file (used in error and warning messages).
+ * @param config The current config being parsed.
+ * @param imported Whether the current config is imported from another file.
+ *
+ * @retval false in case of error.
*/
-bool mapreg_config_read(const char* w1, const char* w2) {
- nullpo_retr(false, w1);
- nullpo_retr(false, w2);
- if(!strcmpi(w1, "mapreg_db"))
- safestrncpy(mapreg->table, w2, sizeof(mapreg->table));
- else
+bool mapreg_config_read(const char *filename, const struct config_setting_t *config, bool imported)
+{
+ nullpo_retr(false, filename);
+ nullpo_retr(false, config);
+
+ if (libconfig->setting_lookup_mutable_string(config, "mapreg_db", mapreg->table, sizeof(mapreg->table)) != CONFIG_TRUE)
return false;
return true;