summaryrefslogtreecommitdiff
path: root/src/char/inter.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-01-25 09:43:09 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-01-25 10:14:44 -0800
commit34f0540da418b01dd4d49f6ecf72569d3cfecfdf (patch)
treebf7c4623b0d794e4db8c72b0906bb40807d62ba8 /src/char/inter.cpp
parent9a4c3a44476f3306a8deed8a836e8fbc25ceb55f (diff)
downloadtmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.gz
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.bz2
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.tar.xz
tmwa-34f0540da418b01dd4d49f6ecf72569d3cfecfdf.zip
Implement unified config parsing (mostly)
Diffstat (limited to 'src/char/inter.cpp')
-rw-r--r--src/char/inter.cpp43
1 files changed, 7 insertions, 36 deletions
diff --git a/src/char/inter.cpp b/src/char/inter.cpp
index 38e6194..a0569a7 100644
--- a/src/char/inter.cpp
+++ b/src/char/inter.cpp
@@ -15,6 +15,7 @@
#include "../io/lock.hpp"
#include "../io/read.hpp"
+#include "../common/config_parse.hpp"
#include "../common/db.hpp"
#include "../common/extract.hpp"
#include "../common/socket.hpp"
@@ -106,13 +107,13 @@ bool extract(XString str, struct accreg *reg)
// アカウント変数の読み込み
static
-int inter_accreg_init(void)
+void inter_accreg_init(void)
{
int c = 0;
io::ReadFile in(accreg_txt);
if (!in.is_open())
- return 1;
+ return;
FString line;
while (in.getline(line))
{
@@ -128,8 +129,6 @@ int inter_accreg_init(void)
}
c++;
}
-
- return 0;
}
// アカウント変数のセーブ用
@@ -160,30 +159,9 @@ int inter_accreg_save(void)
return 0;
}
-//--------------------------------------------------------
-
-/*==========================================
- * 設定ファイルを読み込む
- *------------------------------------------
- */
-static
-int inter_config_read(ZString cfgName)
+bool inter_config(XString w1, ZString w2)
{
- io::ReadFile in(cfgName);
- if (!in.is_open())
- {
- PRINTF("file not found: %s\n", cfgName);
- return 1;
- }
-
- FString line;
- while (in.getline(line))
{
- XString w1;
- ZString w2;
- if (!split_key_value(line, &w1, &w2))
- continue;
-
if (w1 == "storage_txt")
{
storage_txt = w2;
@@ -202,18 +180,13 @@ int inter_config_read(ZString cfgName)
if (party_share_level < 0)
party_share_level = 0;
}
- else if (w1 == "import")
- {
- inter_config_read(w2);
- }
else
{
- FString w1z = w1;
- PRINTF("WARNING: unknown inter config key: %s\n", w1z);
+ return false;
}
}
- return 0;
+ return true;
}
// セーブ
@@ -225,10 +198,8 @@ void inter_save(void)
}
// 初期化
-void inter_init(ZString file)
+void inter_init2()
{
- inter_config_read(file);
-
inter_party_init();
inter_storage_init();
inter_accreg_init();