From c97e881dbfeb45f4be2730b347c7430ade8eb985 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 3 Aug 2019 20:58:13 +0200 Subject: [PATCH] let horses be short, too. --- src/kernel/region.c | 6 +++++- src/kernel/region.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kernel/region.c b/src/kernel/region.c index 01dd08b33..85cb2a944 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -643,7 +643,11 @@ void rsethorses(const region * r, int value) assert(r->land || value==0); assert(value >= 0); if (r->land) { - r->land->horses = value; + if (value > USHRT_MAX) { + log_warning("region %s cannot have %d horses.", regionname(r, NULL), value); + value = USHRT_MAX; + } + r->land->horses = (unsigned short)value; } } diff --git a/src/kernel/region.h b/src/kernel/region.h index 096d68b11..7bd6cb2c4 100644 --- a/src/kernel/region.h +++ b/src/kernel/region.h @@ -97,12 +97,12 @@ extern "C" { char *display; demand *demands; const struct item_type *herbtype; + unsigned short horses; unsigned short herbs; unsigned short peasants; unsigned short morale; short newpeasants; int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */ - int horses; int money; struct region_owner *ownership; } land_region;