From 3a476bb279afbe9d649b23398aa4654fbde505bd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 24 May 2008 18:29:27 +0000 Subject: [PATCH] stupid assert needs a fix --- src/common/kernel/unit.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/kernel/unit.c b/src/common/kernel/unit.c index 8179a10e3..d72b262c6 100644 --- a/src/common/kernel/unit.c +++ b/src/common/kernel/unit.c @@ -1050,13 +1050,15 @@ set_number(unit * u, int count) assert (count <= UNIT_MAXSIZE); #ifndef NDEBUG - assert (u->faction != NULL || u->number > 0); + assert(u->faction || count==0); #endif - if (playerrace(u->race)) { - u->faction->num_people += count - u->number; + if (u->faction) { + if (playerrace(u->race)) { + u->faction->num_people += count - u->number; + } + u->number = (unsigned short)count; } - u->number = (unsigned short)count; } boolean