From 326f543ece2aaf13966c76b598e4e76801f7a0e0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 2 Mar 2017 13:01:27 +0100 Subject: [PATCH] gcc reports unused variable. and for once, that points to a bug! --- src/guard.c | 1 + src/guard.test.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/guard.c b/src/guard.c index 1f2ee7f3f..a7fa1a97a 100644 --- a/src/guard.c +++ b/src/guard.c @@ -72,6 +72,7 @@ void setguard(unit * u, bool enabled) } else { assert(!fval(u, UFL_MOVED)); assert(u->status < ST_FLEE); + assert(u->region->land); fset(u, UFL_GUARD); fset(u->region, RF_GUARDED); } diff --git a/src/guard.test.c b/src/guard.test.c index 1ffd1b4da..cc59af4d8 100644 --- a/src/guard.test.c +++ b/src/guard.test.c @@ -143,7 +143,7 @@ static void test_update_guard(CuTest * tc) t_plain = test_create_terrain("plain", LAND_REGION); itype = it_get_or_create(rt_get_or_create("sword")); 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); i_change(&ug->items, itype, 1); set_level(ug, SK_MELEE, 2);