From 8b46e1323a119ec8c1c753758ab4163f23fb116f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Nov 2016 11:11:21 +0100 Subject: [PATCH 1/8] declare struct before use --- src/triggers/changerace.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/triggers/changerace.h b/src/triggers/changerace.h index 1b08110b3..e6b19dcb0 100644 --- a/src/triggers/changerace.h +++ b/src/triggers/changerace.h @@ -26,6 +26,7 @@ extern "C" { struct trigger_type; struct trigger; struct unit; + struct race; extern struct trigger_type tt_changerace; From 4d5c00be901198fb6beaf6c3662ee34a85b7f803 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Nov 2016 11:38:50 +0100 Subject: [PATCH 2/8] git rm --cached tolua, to fix travis builds? --- tolua | 1 - 1 file changed, 1 deletion(-) delete mode 160000 tolua diff --git a/tolua b/tolua deleted file mode 160000 index de289b60c..000000000 --- a/tolua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit de289b60c5009b6ac8e786f39432c08eadbb69b7 From 7d874f16065a34df6e25935c9b9986b6ecc8cec8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Nov 2016 13:24:50 +0100 Subject: [PATCH 3/8] fix clang builds --- src/CMakeLists.txt | 6 ++++-- src/kernel/messages.test.c | 3 ++- src/spells/flyingship.h | 3 ++- src/util/functions.c | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 34cea4037..7d7fba859 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,10 +17,12 @@ set_source_files_properties(kernel/version.c PROPERTIES COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}") ENDIF() -IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) +IF (CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") +ENDIF() +IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") add_definitions(-DHAVE__BOOL) ELSEIF(MSVC) diff --git a/src/kernel/messages.test.c b/src/kernel/messages.test.c index fc6079dfe..c391c8720 100644 --- a/src/kernel/messages.test.c +++ b/src/kernel/messages.test.c @@ -74,4 +74,5 @@ CuSuite *get_messages_suite(void) { SUITE_ADD_TEST(suite, test_merge_split); SUITE_ADD_TEST(suite, test_message); return suite; -} \ No newline at end of file +} + diff --git a/src/spells/flyingship.h b/src/spells/flyingship.h index 087357b9e..8b7bf0874 100644 --- a/src/spells/flyingship.h +++ b/src/spells/flyingship.h @@ -22,4 +22,5 @@ extern "C" { } #endif -#endif \ No newline at end of file +#endif + diff --git a/src/util/functions.c b/src/util/functions.c index 82792faaf..3776820eb 100644 --- a/src/util/functions.c +++ b/src/util/functions.c @@ -51,4 +51,5 @@ void register_function(pf_generic fun, const char *name) void free_functions(void) { cb_clear(&cb_functions); -} \ No newline at end of file +} + From ecbd0ba83c113b8bf6f6b89b635317b224c48e8b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Nov 2016 13:30:24 +0100 Subject: [PATCH 4/8] github issue #606 disable volcano terrain change for snowglobe test --- scripts/tests/xmas.lua | 1 + src/volcano.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/tests/xmas.lua b/scripts/tests/xmas.lua index 3667de0b6..153052d5a 100644 --- a/scripts/tests/xmas.lua +++ b/scripts/tests/xmas.lua @@ -7,6 +7,7 @@ function setup() eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.grow.formula", "0") eressea.settings.set("rules.peasants.growth.factor", "0") + eressea.settings.set("volcano.active.percent", "4") end function test_snowglobe_fail() diff --git a/src/volcano.c b/src/volcano.c index bd8c56b30..60beeaed7 100644 --- a/src/volcano.c +++ b/src/volcano.c @@ -284,7 +284,8 @@ void volcano_update(void) } } else if (r->terrain == t_volcano) { - if (rng_int() % 100 < 4) { + int volcano_chance = config_get_int("volcano.active.percent", 4); + if (rng_int() % 100 < volcano_chance) { ADDMSG(&r->msgs, msg_message("volcanostartsmoke", "region", r)); r->terrain = t_active; } From 14b4ae5859245151c3416051a3c2e09c3749f968 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 18 Nov 2016 22:31:06 +0100 Subject: [PATCH 5/8] set volcano acitvation chance to 0 during test. should fix issue #606 for good. also: additional tests for renumbering ships, Xolgrim is wrong. --- scripts/tests/common.lua | 15 +++++++++++++++ scripts/tests/xmas.lua | 2 +- src/renumber.test.c | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index c39f2ce30..670060816 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -380,6 +380,21 @@ function test_events() assert(fail==0) end +function test_renumber_ship() + local r = region.create(0, 0, "plain") + local f = faction.create("noreply4@eressea.de", "human", "de") + local u = unit.create(f, r) + local s = ship.create(r, config.ships[1]) + u.ship = s + u:add_order("NUMMER SCHIFF 1") + process_orders() + assert_equal(1, s.id) + u:clear_orders() + u:add_order("NUMMER SCHIFF 2") + process_orders() + assert_equal(2, s.id) +end + function test_recruit2() local r = region.create(0, 0, "plain") local f = faction.create("noreply4@eressea.de", "human", "de") diff --git a/scripts/tests/xmas.lua b/scripts/tests/xmas.lua index 153052d5a..7ac4ce731 100644 --- a/scripts/tests/xmas.lua +++ b/scripts/tests/xmas.lua @@ -7,7 +7,7 @@ function setup() eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.grow.formula", "0") eressea.settings.set("rules.peasants.growth.factor", "0") - eressea.settings.set("volcano.active.percent", "4") + eressea.settings.set("volcano.active.percent", "0") end function test_snowglobe_fail() diff --git a/src/renumber.test.c b/src/renumber.test.c index 9ab6b1e7b..6c3f0f17b 100644 --- a/src/renumber.test.c +++ b/src/renumber.test.c @@ -102,6 +102,27 @@ static void test_renumber_ship(CuTest *tc) { test_cleanup(); } +static void test_renumber_ship_twice(CuTest *tc) { + unit *u; + int uno, no; + const struct locale *lang; + + test_setup_ex(tc); + u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0)); + u->ship = test_create_ship(u->region, 0); + no = u->ship->no; + uno = (no > 1) ? no - 1 : no + 1; + lang = u->faction->locale; + u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_SHIP]), itoa36(uno)); + renumber_cmd(u, u->thisorder); + CuAssertIntEquals(tc, uno, u->ship->no); + free_order(u->thisorder); + u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_SHIP]), itoa36(no)); + renumber_cmd(u, u->thisorder); + CuAssertIntEquals(tc, no, u->ship->no); + test_cleanup(); +} + static void test_renumber_ship_duplicate(CuTest *tc) { unit *u; faction *f; @@ -204,6 +225,7 @@ CuSuite *get_renumber_suite(void) SUITE_ADD_TEST(suite, test_renumber_building); SUITE_ADD_TEST(suite, test_renumber_building_duplicate); SUITE_ADD_TEST(suite, test_renumber_ship); + SUITE_ADD_TEST(suite, test_renumber_ship_twice); SUITE_ADD_TEST(suite, test_renumber_ship_duplicate); SUITE_ADD_TEST(suite, test_renumber_faction); SUITE_ADD_TEST(suite, test_renumber_faction_duplicate); From 531da88b2a4c8735a4cc204e58015709f8c6f4f1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 19 Nov 2016 15:19:23 +0100 Subject: [PATCH 6/8] squash some static analysis warnings. --- src/alchemy.c | 9 ++------- src/battle.c | 22 +++++++--------------- src/lighthouse.c | 4 ++-- src/move.c | 4 ++-- src/spells.c | 5 ++--- src/teleport.c | 4 +--- tolua | 1 + 7 files changed, 17 insertions(+), 32 deletions(-) create mode 160000 tolua diff --git a/src/alchemy.c b/src/alchemy.c index 7eac102fb..cd33feadb 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -181,7 +181,7 @@ static int potion_power(unit *u, int amount) { if (u->number % 10 > 0) ++use; amount = use; } - /* Verfünffacht die HP von max. 10 Personen in der Einheit */ + /* Verf�nffacht die HP von max. 10 Personen in der Einheit */ u->hp += _min(u->number, 10 * amount) * unit_max_hp(u) * 4; return amount; } @@ -241,11 +241,6 @@ static void init_potiondelay(attrib * a) a->data.v = malloc(sizeof(potiondelay)); } -static void free_potiondelay(attrib * a) -{ - free(a->data.v); -} - static int age_potiondelay(attrib * a, void *owner) { potiondelay *pd = (potiondelay *)a->data.v; @@ -257,7 +252,7 @@ static int age_potiondelay(attrib * a, void *owner) attrib_type at_potiondelay = { "potiondelay", init_potiondelay, - free_potiondelay, + a_finalizeeffect, age_potiondelay, 0, 0 }; diff --git a/src/battle.c b/src/battle.c index b5d767535..3cf7b685a 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1022,16 +1022,15 @@ static int armor_bonus(const race *rc) { int natural_armor(unit * du) { const race *rc = u_race(du); - int bonus, an = rc->armor; + int an; assert(rc); - bonus = armor_bonus(rc); - if (bonus > 0) { + an = armor_bonus(rc); + if (an > 0) { int sk = effskill(du, SK_STAMINA, 0); - sk /= bonus; - an += sk; + an = sk / an; } - return an; + return an + rc->armor; } static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype) @@ -2042,19 +2041,12 @@ int hits(troop at, troop dt, weapon * awp) void dazzle(battle * b, troop * td) { /* Nicht kumulativ ! */ - if (td->fighter->person[td->index].flags & FL_DAZZLED) - return; - #ifdef TODO_RUNESWORD if (td->fighter->weapon[WP_RUNESWORD].count > td->index) { return; } #endif - if (td->fighter->person[td->index].flags & FL_COURAGE) { - return; - } - - if (td->fighter->person[td->index].flags & FL_DAZZLED) { + if (td->fighter->person[td->index].flags & (FL_COURAGE|FL_DAZZLED) { return; } @@ -2497,7 +2489,7 @@ static int loot_quota(const unit * src, const unit * dst, { if (dst && src && src->faction != dst->faction) { double divisor = config_get_flt("rules.items.loot_divisor", 1); - assert(divisor == 0 || divisor >= 1); + assert(divisor <= 0 || divisor >= 1); if (divisor >= 1) { double r = n / divisor; int x = (int)r; diff --git a/src/lighthouse.c b/src/lighthouse.c index dd1183558..d962b9b76 100644 --- a/src/lighthouse.c +++ b/src/lighthouse.c @@ -16,7 +16,7 @@ const attrib_type at_lighthouse = { "lighthouse" - /* Rest ist NULL; temporäres, nicht alterndes Attribut */ + /* Rest ist NULL; tempor�res, nicht alterndes Attribut */ }; /* update_lighthouse: call this function whenever the size of a lighthouse changes @@ -127,7 +127,7 @@ bool check_leuchtturm(region * r, faction * f) c += u->number; if (c > buildingcapacity(b)) break; - if (f == NULL || u->faction == f) { + if (u->faction == f) { if (!d) d = distance(r, r2); if (maxd < d) diff --git a/src/move.c b/src/move.c index 0888b6fde..b6a908837 100644 --- a/src/move.c +++ b/src/move.c @@ -1240,9 +1240,9 @@ static bool roadto(const region * r, direction_t dir) if (!r || dir >= MAXDIRECTIONS || dir < 0) return false; r2 = rconnect(r, dir); - if (r == NULL || r2 == NULL) + if (!r2) { return false; - + } if (r->attribs || r2->attribs) { const curse_type *roads_ct = ct_find("magicstreet"); if (roads_ct != NULL) { diff --git a/src/spells.c b/src/spells.c index ed17b8f42..57b1da3a5 100644 --- a/src/spells.c +++ b/src/spells.c @@ -3237,8 +3237,7 @@ static int sp_magicboost(castorder * co) } effect = 6; - c = create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1); - + create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1); /* one aura boost with 200% aura now: */ effect = 200; c = create_curse(mage, &mage->attribs, ct_auraboost, power, 4, effect, 1); @@ -4031,7 +4030,7 @@ static int sp_recruit(castorder * co) * ein mehrfaches von Stufe 1, denn in beiden Faellen gibt es nur 1 * Bauer, nur die Kosten steigen. */ n = (pow(force, 1.6) * 100) / f->race->recruitcost; - if (rc->recruit_multi != 0) { + if (rc->recruit_multi > 0) { double multp = (double)maxp / rc->recruit_multi; n = _min(multp, n); n = _max(n, 1); diff --git a/src/teleport.c b/src/teleport.c index c7e775345..74176f6af 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -185,9 +185,7 @@ plane *get_astralplane(void) if (!rule_astralplane) { return NULL; } - if (!astralspace) { - astralspace = getplanebyname("Astralraum"); - } + astralspace = getplanebyname("Astralraum"); if (!astralspace) { astralspace = create_new_plane(1, "Astralraum", TE_CENTER_X - 500, TE_CENTER_X + 500, diff --git a/tolua b/tolua new file mode 160000 index 000000000..de289b60c --- /dev/null +++ b/tolua @@ -0,0 +1 @@ +Subproject commit de289b60c5009b6ac8e786f39432c08eadbb69b7 From eabaf8bebba7eb110f2e0f0229d99fd3006b7bec Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 19 Nov 2016 16:27:37 +0100 Subject: [PATCH 7/8] fix last commit. --- src/alchemy.c | 6 +++++- src/battle.c | 6 +++--- tolua | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) delete mode 160000 tolua diff --git a/src/alchemy.c b/src/alchemy.c index cd33feadb..9f942fc5a 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -241,6 +241,10 @@ static void init_potiondelay(attrib * a) a->data.v = malloc(sizeof(potiondelay)); } +static void free_potiondelay(attrib * a) { + free(a->data.v); +} + static int age_potiondelay(attrib * a, void *owner) { potiondelay *pd = (potiondelay *)a->data.v; @@ -252,7 +256,7 @@ static int age_potiondelay(attrib * a, void *owner) attrib_type at_potiondelay = { "potiondelay", init_potiondelay, - a_finalizeeffect, + free_potiondelay, age_potiondelay, 0, 0 }; diff --git a/src/battle.c b/src/battle.c index 3cf7b685a..b4468e843 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1028,9 +1028,9 @@ int natural_armor(unit * du) an = armor_bonus(rc); if (an > 0) { int sk = effskill(du, SK_STAMINA, 0); - an = sk / an; + return rc->armor + sk / an; } - return an + rc->armor; + return rc->armor; } static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype) @@ -2046,7 +2046,7 @@ void dazzle(battle * b, troop * td) return; } #endif - if (td->fighter->person[td->index].flags & (FL_COURAGE|FL_DAZZLED) { + if (td->fighter->person[td->index].flags & (FL_COURAGE|FL_DAZZLED)) { return; } diff --git a/tolua b/tolua deleted file mode 160000 index de289b60c..000000000 --- a/tolua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit de289b60c5009b6ac8e786f39432c08eadbb69b7 From 19a0c2ddb32947d3a5480da90899fd1ebfd27f80 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 19 Nov 2016 20:57:10 +0100 Subject: [PATCH 8/8] quelling some static analysis complaints. --- src/kernel/connection.c | 11 ++++------- src/kernel/jsonconf.c | 2 +- src/kernel/ship.c | 6 +++--- src/move.test.c | 4 ++-- src/piracy.test.c | 4 ++-- src/reports.c | 7 ++++--- src/upkeep.test.c | 3 ++- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/kernel/connection.c b/src/kernel/connection.c index f10fbc53d..6eccf1f0c 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -211,7 +211,7 @@ border_type *find_bordertype(const char *name) { border_type *bt = bordertypes; - while (bt && strcmp(bt->__name, name)) + while (bt && strcmp(bt->__name, name)!=0) bt = bt->next; return bt; } @@ -620,7 +620,6 @@ int read_borders(gamedata *data) assert(type || !"connection type not registered"); } - READ_INT(store, &bid); if (data->version < UIDHASH_VERSION) { int fx, fy, tx, ty; @@ -639,9 +638,7 @@ int read_borders(gamedata *data) to = findregionbyid(tid); } if (!to || !from) { - if (!to || !from) { - log_error("%s connection %d has missing regions", zText, bid); - } + log_error("%s connection %d has missing regions", zText, bid); if (type->read) { // skip ahead connection dummy; @@ -650,7 +647,7 @@ int read_borders(gamedata *data) continue; } - if (to == from && type && from) { + if (to == from && from) { direction_t dir = (direction_t)(rng_int() % MAXDIRECTIONS); region *r = rconnect(from, dir); log_error("[read_borders] invalid %s in %s\n", type->__name, regionname(from, NULL)); @@ -659,7 +656,7 @@ int read_borders(gamedata *data) } if (type->read) { connection *b = new_border(type, from, to); - nextborder--; /* new_border erhöht den Wert */ + nextborder--; /* new_border erh�ht den Wert */ b->id = bid; assert(bid <= nextborder); type->read(b, data); diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index 6e60fc90c..d12238566 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -796,7 +796,7 @@ static void json_settings(cJSON *json) { else { char value[32]; if (child->type == cJSON_Number && child->valuedouble && child->valueintvaluedouble) { - _snprintf(value, sizeof(value), "%lf", child->valuedouble); + _snprintf(value, sizeof(value), "%f", child->valuedouble); } else { _snprintf(value, sizeof(value), "%d", child->valueint); diff --git a/src/kernel/ship.c b/src/kernel/ship.c index d01d0a788..6898630ff 100644 --- a/src/kernel/ship.c +++ b/src/kernel/ship.c @@ -297,10 +297,9 @@ int crew_skill(const ship *sh) { int shipspeed(const ship * sh, const unit * u) { - int k = sh->type->range; attrib *a; struct curse *c; - int bonus; + int k, bonus; assert(sh); if (!u) u = ship_owner(sh); @@ -310,6 +309,7 @@ int shipspeed(const ship * sh, const unit * u) assert(sh->type->construction); assert(sh->type->construction->improvement == NULL); /* sonst ist construction::size nicht ship_type::maxsize */ + k = sh->type->range; if (sh->size != sh->type->construction->maxsize) return 0; @@ -417,7 +417,7 @@ static unit * ship_owner_ex(const ship * sh, const struct faction * last_owner) { unit *u, *heir = 0; - /* Eigentümer tot oder kein Eigentümer vorhanden. Erste lebende Einheit + /* Eigent�mer tot oder kein Eigent�mer vorhanden. Erste lebende Einheit * nehmen. */ for (u = sh->region->units; u; u = u->next) { if (u->ship == sh) { diff --git a/src/move.test.c b/src/move.test.c index 5c89166c8..bc93ec124 100644 --- a/src/move.test.c +++ b/src/move.test.c @@ -273,10 +273,10 @@ void setup_drift (struct drift_fixture *fix) { fix->st_boat->cabins = 20000; fix->u = test_create_unit(fix->f = test_create_faction(0), fix->r=findregion(-1,0)); - assert(fix->r); + assert(fix->r && fix->u && fix->f); set_level(fix->u, SK_SAILING, fix->st_boat->sumskill); u_set_ship(fix->u, fix->sh = test_create_ship(fix->u->region, fix->st_boat)); - assert(fix->f && fix->u && fix->sh); + assert(fix->sh); } static void test_ship_no_overload(CuTest *tc) { diff --git a/src/piracy.test.c b/src/piracy.test.c index affb6f5c4..82e4e55b7 100644 --- a/src/piracy.test.c +++ b/src/piracy.test.c @@ -83,12 +83,12 @@ static void test_piracy_cmd(CuTest * tc) { t_ocean = get_or_create_terrain("ocean"); st_boat = st_get_or_create("boat"); u2 = test_create_unit(test_create_faction(0), test_create_region(1, 0, t_ocean)); - u_set_ship(u2, test_create_ship(u2->region, st_boat)); assert(u2); + u_set_ship(u2, test_create_ship(u2->region, st_boat)); u = test_create_unit(f = test_create_faction(0), r = test_create_region(0, 0, t_ocean)); + assert(f && u); set_level(u, SK_SAILING, st_boat->sumskill); u_set_ship(u, test_create_ship(u->region, st_boat)); - assert(f && u); f->locale = get_or_create_locale("de"); u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(u2->faction->no)); diff --git a/src/reports.c b/src/reports.c index fa39f0a85..f4c38712c 100644 --- a/src/reports.c +++ b/src/reports.c @@ -489,13 +489,14 @@ size_t size) building *b; bool isbattle = (bool)(mode == seen_battle); item *itm, *show = NULL; - faction *fv = visible_faction(f, u); + faction *fv; char *bufp = buf; int result = 0; item results[MAX_INVENTORY]; + assert(f); bufp = STRLCPY(bufp, unitname(u), size); - + fv = visible_faction(f, u); if (!isbattle) { attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction); if (u->faction == f) { @@ -770,7 +771,7 @@ size_t size) } dh = 0; - if (!getarnt && f) { + if (!getarnt) { if (alliedfaction(rplane(u->region), f, fv, HELP_ALL)) { dh = 1; } diff --git a/src/upkeep.test.c b/src/upkeep.test.c index b4f2ae412..e84402d4b 100644 --- a/src/upkeep.test.c +++ b/src/upkeep.test.c @@ -81,10 +81,11 @@ void test_upkeep_from_pool(CuTest * tc) i_silver = it_find("money"); assert(i_silver); r = findregion(0, 0); + assert(r); u1 = test_create_unit(test_create_faction(test_create_race("human")), r); assert(u1); u2 = test_create_unit(u1->faction, r); - assert(r && u1 && u2); + assert(u2); config_set("rules.food.flags", "0"); i_change(&u1->items, i_silver, 30);