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;