change_resource did not return new value for some types

This commit is contained in:
Enno Rehling 2012-05-25 15:35:11 -07:00
parent ae9f12c904
commit 88db0a8df7
2 changed files with 6 additions and 7 deletions

View File

@ -66,36 +66,34 @@ potion_type *potiontypes;
static int res_changeaura(unit * u, const resource_type * rtype, int delta)
{
assert(rtype != NULL);
change_spellpoints(u, delta);
return 0;
return change_spellpoints(u, delta);
}
static int res_changeperson(unit * u, const resource_type * rtype, int delta)
{
assert(rtype != NULL || !"not implemented");
scale_number(u, u->number + delta);
return 0;
return u->number;
}
static int res_changepermaura(unit * u, const resource_type * rtype, int delta)
{
assert(rtype != NULL);
change_maxspellpoints(u, delta);
return 0;
return change_maxspellpoints(u, delta);
}
static int res_changehp(unit * u, const resource_type * rtype, int delta)
{
assert(rtype != NULL);
u->hp += delta;
return 0;
return u->hp;
}
static int res_changepeasants(unit * u, const resource_type * rtype, int delta)
{
assert(rtype != NULL && u->region->land);
u->region->land->peasants += delta;
return 0;
return u->region->land->peasants;
}
int res_changeitem(unit * u, const resource_type * rtype, int delta)

View File

@ -79,6 +79,7 @@ int change_resource(unit * u, const resource_type * rtype, int change)
i = change_maxspellpoints(u, change);
else
assert(!"undefined resource detected. rtype->uchange not initialized.");
assert(i==get_resource(u, rtype));
assert(i >= 0);
if (i >= 100000000) {
log_warning("%s has %d %s\n", unitname(u), i, rtype->_name[0]);