forked from github/server
change_resource did not return new value for some types
This commit is contained in:
parent
ae9f12c904
commit
88db0a8df7
|
@ -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)
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in New Issue