gcc reports unused variable.

and for once, that points to a bug!
This commit is contained in:
Enno Rehling 2017-03-02 13:01:27 +01:00
parent 3cb24299fa
commit 326f543ece
2 changed files with 2 additions and 1 deletions

View File

@ -72,6 +72,7 @@ void setguard(unit * u, bool enabled)
} else { } else {
assert(!fval(u, UFL_MOVED)); assert(!fval(u, UFL_MOVED));
assert(u->status < ST_FLEE); assert(u->status < ST_FLEE);
assert(u->region->land);
fset(u, UFL_GUARD); fset(u, UFL_GUARD);
fset(u->region, RF_GUARDED); fset(u->region, RF_GUARDED);
} }

View File

@ -143,7 +143,7 @@ static void test_update_guard(CuTest * tc)
t_plain = test_create_terrain("plain", LAND_REGION); t_plain = test_create_terrain("plain", LAND_REGION);
itype = it_get_or_create(rt_get_or_create("sword")); itype = it_get_or_create(rt_get_or_create("sword"));
new_weapontype(itype, 0, frac_zero, NULL, 0, 0, 0, SK_MELEE, 2); new_weapontype(itype, 0, frac_zero, NULL, 0, 0, 0, SK_MELEE, 2);
r = test_create_region(0, 0, t_ocean); r = test_create_region(0, 0, t_plain);
ug = test_create_unit(test_create_faction(0), r); ug = test_create_unit(test_create_faction(0), r);
i_change(&ug->items, itype, 1); i_change(&ug->items, itype, 1);
set_level(ug, SK_MELEE, 2); set_level(ug, SK_MELEE, 2);