Merge branch 'master' into develop

Conflicts:
	src/buildno.h
	src/kernel/region.c
This commit is contained in:
Enno Rehling 2016-01-24 14:53:18 +01:00
commit a66e81e90d
2 changed files with 28 additions and 4 deletions

View File

@ -595,13 +595,27 @@ bool is_coastregion(region * r)
int rpeasants(const region * r)
{
<<<<<<< HEAD
return r->land ? r->land->peasants : 0;
=======
int value = 0;
if (r->land) {
value = r->land->peasants;
assert(value >= 0);
}
return value;
>>>>>>> master
}
void rsetpeasants(region * r, int value)
{
<<<<<<< HEAD
if (r->land) {
assert(value >= 0);
=======
assert(value >= 0);
if (r->land) {
>>>>>>> master
r->land->peasants = value;
}
}
@ -613,8 +627,14 @@ int rmoney(const region * r)
void rsethorses(const region * r, int value)
{
<<<<<<< HEAD
if (r->land) {
assert(value >= 0);
=======
assert(r->land || value==0);
assert(value >= 0);
if (r->land) {
>>>>>>> master
r->land->horses = value;
}
}

View File

@ -949,15 +949,19 @@ static region *readregion(struct gamedata *data, int x, int y)
READ_INT(data->store, &n);
rsetherbs(r, (short)n);
READ_INT(data->store, &n);
if (n < 0) {
/* bug 2182 */
log_error("data has negative peasants: %d in %s", n, regionname(r, 0));
rsetpeasants(r, 0);
}
else {
rsetpeasants(r, n);
}
READ_INT(data->store, &n);
rsetmoney(r, n);
}
assert(r->terrain != NULL);
assert(rhorses(r) >= 0);
assert(rpeasants(r) >= 0);
assert(rmoney(r) >= 0);
if (r->land) {
int n;