forked from github/server
config.json settings shall not override eressea.ini
This commit is contained in:
parent
8c4cccbc65
commit
f18f083922
2 changed files with 6 additions and 1 deletions
|
@ -806,7 +806,9 @@ static void json_settings(cJSON *json) {
|
|||
else {
|
||||
sprintf(value, "%d", child->valueint);
|
||||
}
|
||||
config_set(child->string, value);
|
||||
if (config_get(child->string) == NULL) {
|
||||
config_set(child->string, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,12 +69,15 @@ static void test_settings(CuTest * tc)
|
|||
"\"string\" : \"1d4\","
|
||||
"\"integer\" : 14,"
|
||||
"\"true\": true,"
|
||||
"\"game.id\": 4,"
|
||||
"\"false\": false,"
|
||||
"\"float\" : 1.5 }}";
|
||||
cJSON *json = cJSON_Parse(data);
|
||||
|
||||
test_cleanup();
|
||||
config_set("game.id", "42"); // should not be replaced
|
||||
json_config(json);
|
||||
CuAssertStrEquals(tc, "42", config_get("game.id"));
|
||||
CuAssertStrEquals(tc, "1", config_get("true"));
|
||||
CuAssertStrEquals(tc, "0", config_get("false"));
|
||||
CuAssertStrEquals(tc, "1d4", config_get("string"));
|
||||
|
|
Loading…
Reference in a new issue