Merge pull request #470 from ennorehling/feature/issue-468-jsonconf-errorrs

fix reading building maintenance
This commit is contained in:
Enno Rehling 2016-02-01 14:15:01 +01:00
commit 4804b2c30a
3 changed files with 9 additions and 6 deletions

View File

@ -114,7 +114,7 @@ static void json_maintenance_i(cJSON *json, maintenance *mt) {
} }
break; break;
default: default:
log_error("maintenance contains unknown attribute %s", child->string); log_error("maintenance contains unknown attribute %s of type %d", child->string, child->type);
} }
} }
} }
@ -139,8 +139,10 @@ static void json_maintenance(cJSON *json, maintenance **mtp) {
} }
} }
} }
else {
json_maintenance_i(json, mt); json_maintenance_i(json, mt);
} }
}
static void json_construction(cJSON *json, construction **consp) { static void json_construction(cJSON *json, construction **consp) {
cJSON *child; cJSON *child;

View File

@ -262,6 +262,7 @@ static void test_write_unit(CuTest *tc) {
locale_setstring(lang, "nr_skills", "Talente"); locale_setstring(lang, "nr_skills", "Talente");
locale_setstring(lang, "skill::sailing", "Segeln"); locale_setstring(lang, "skill::sailing", "Segeln");
locale_setstring(lang, "skill::alchemy", "Alchemie"); locale_setstring(lang, "skill::alchemy", "Alchemie");
locale_setstring(lang, "status_aggressive", "aggressiv");
init_skills(lang); init_skills(lang);
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0)); u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
u->faction->locale = lang; u->faction->locale = lang;
@ -271,15 +272,15 @@ static void test_write_unit(CuTest *tc) {
unit_setid(u, 1); unit_setid(u, 1);
bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer)); bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer));
CuAssertStrEquals(tc, "Hodor (1), 1 human, status_aggressive.", buffer); CuAssertStrEquals(tc, "Hodor (1), 1 human, aggressiv.", buffer);
set_level(u, SK_SAILING, 1); set_level(u, SK_SAILING, 1);
bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer)); bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer));
CuAssertStrEquals(tc, "Hodor (1), 1 human, status_aggressive, Talente: Segeln 1.", buffer); CuAssertStrEquals(tc, "Hodor (1), 1 human, aggressiv, Talente: Segeln 1.", buffer);
set_level(u, SK_ALCHEMY, 1); set_level(u, SK_ALCHEMY, 1);
bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer)); bufunit(u->faction, u, 0, 0, buffer, sizeof(buffer));
CuAssertStrEquals(tc, "Hodor (1), 1 human, status_aggressive, Talente: Segeln 1, Alchemie 2.", buffer); CuAssertStrEquals(tc, "Hodor (1), 1 human, aggressiv, Talente: Segeln 1, Alchemie 2.", buffer);
f = test_create_faction(0); f = test_create_faction(0);
f->locale = get_or_create_locale("de"); f->locale = get_or_create_locale("de");

View File

@ -265,6 +265,7 @@ void test_create_world(void)
locale_setstring(loc, parameters[P_ANY], "ALLE"); locale_setstring(loc, parameters[P_ANY], "ALLE");
init_parameters(loc); init_parameters(loc);
locale_setstring(loc, "status_aggressive", "aggressiv");
locale_setstring(loc, keyword(K_RESERVE), "RESERVIEREN"); locale_setstring(loc, keyword(K_RESERVE), "RESERVIEREN");
locale_setstring(loc, "money", "SILBER"); locale_setstring(loc, "money", "SILBER");
init_resources(); init_resources();
@ -280,7 +281,6 @@ void test_create_world(void)
test_create_itemtype("iron"); test_create_itemtype("iron");
test_create_itemtype("stone"); test_create_itemtype("stone");
t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO); t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO);
t_plain->size = 1000; t_plain->size = 1000;
t_plain->max_road = 100; t_plain->max_road = 100;