forked from github/server
add a liberal sprinkling of assertions to catch negative peasants bug 2182
This commit is contained in:
parent
3d7b22fa21
commit
023686fab2
1 changed files with 9 additions and 4 deletions
|
@ -595,14 +595,19 @@ bool is_coastregion(region * r)
|
||||||
|
|
||||||
int rpeasants(const region * r)
|
int rpeasants(const region * r)
|
||||||
{
|
{
|
||||||
return ((r)->land ? (r)->land->peasants : 0);
|
int value = 0;
|
||||||
|
if (r->land) {
|
||||||
|
value = r->land->peasants;
|
||||||
|
assert(value >= 0);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rsetpeasants(region * r, int value)
|
void rsetpeasants(region * r, int value)
|
||||||
{
|
{
|
||||||
if (r->land) r->land->peasants = value;
|
assert(r->land);
|
||||||
else assert(value>=0);
|
assert(value >= 0);
|
||||||
|
r->land->peasants = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rmoney(const region * r)
|
int rmoney(const region * r)
|
||||||
|
|
Loading…
Reference in a new issue