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 {
|
else {
|
||||||
sprintf(value, "%d", child->valueint);
|
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\","
|
"\"string\" : \"1d4\","
|
||||||
"\"integer\" : 14,"
|
"\"integer\" : 14,"
|
||||||
"\"true\": true,"
|
"\"true\": true,"
|
||||||
|
"\"game.id\": 4,"
|
||||||
"\"false\": false,"
|
"\"false\": false,"
|
||||||
"\"float\" : 1.5 }}";
|
"\"float\" : 1.5 }}";
|
||||||
cJSON *json = cJSON_Parse(data);
|
cJSON *json = cJSON_Parse(data);
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
config_set("game.id", "42"); // should not be replaced
|
||||||
json_config(json);
|
json_config(json);
|
||||||
|
CuAssertStrEquals(tc, "42", config_get("game.id"));
|
||||||
CuAssertStrEquals(tc, "1", config_get("true"));
|
CuAssertStrEquals(tc, "1", config_get("true"));
|
||||||
CuAssertStrEquals(tc, "0", config_get("false"));
|
CuAssertStrEquals(tc, "0", config_get("false"));
|
||||||
CuAssertStrEquals(tc, "1d4", config_get("string"));
|
CuAssertStrEquals(tc, "1d4", config_get("string"));
|
||||||
|
|
Loading…
Reference in a new issue