forked from github/server
renaming the pool funtions (no need for a new_ prefix anymore)
This commit is contained in:
parent
7017f27304
commit
3eef9447e9
|
@ -726,8 +726,8 @@ give_cmd(unit * u, order * ord)
|
|||
item **itmp=&u->items;
|
||||
while (*itmp) {
|
||||
if ((*itmp)->number > 0
|
||||
&& (*itmp)->number - new_get_resvalue(u, (*itmp)->type->rtype) > 0) {
|
||||
n = (*itmp)->number - new_get_resvalue(u, (*itmp)->type->rtype);
|
||||
&& (*itmp)->number - get_reservation(u, (*itmp)->type->rtype) > 0) {
|
||||
n = (*itmp)->number - get_reservation(u, (*itmp)->type->rtype);
|
||||
if (give_item(n, (*itmp)->type, u, u2, ord)==0) continue;
|
||||
}
|
||||
itmp = &(*itmp)->next;
|
||||
|
@ -762,7 +762,7 @@ give_cmd(unit * u, order * ord)
|
|||
if (itype!=NULL) {
|
||||
item * i = *i_find(&u->items, itype);
|
||||
if (i!=NULL) {
|
||||
n = i->number - new_get_resvalue(u, itype->rtype);
|
||||
n = i->number - get_reservation(u, itype->rtype);
|
||||
give_item(n, itype, u, u2, ord);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -76,14 +76,14 @@
|
|||
static void
|
||||
reduce_weight(unit * u)
|
||||
{
|
||||
int horses = new_get_resource(u, oldresourcetype[R_HORSE]);
|
||||
int horses = get_resource(u, oldresourcetype[R_HORSE]);
|
||||
int capacity = walkingcapacity(u);
|
||||
item ** itmp = &u->items;
|
||||
int weight = 0;
|
||||
|
||||
if (horses > 0) {
|
||||
horses = min(horses, (u->number*2));
|
||||
new_change_resource(u, oldresourcetype[R_HORSE], - horses);
|
||||
change_resource(u, oldresourcetype[R_HORSE], - horses);
|
||||
}
|
||||
|
||||
/* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
|
||||
|
|
|
@ -446,7 +446,7 @@ destroy_cmd(unit * u, struct order * ord)
|
|||
const requirement * rq = con->materials+c;
|
||||
int recycle = (int)(rq->recycle * rq->number * size/con->reqsize);
|
||||
if (recycle)
|
||||
new_change_resource(u, rq->rtype, recycle);
|
||||
change_resource(u, rq->rtype, recycle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -117,10 +117,10 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
|
|||
i_change(&dest->items, itype, n);
|
||||
#ifdef RESERVE_GIVE
|
||||
#ifdef RESERVE_DONATIONS
|
||||
new_change_resvalue(dest, item2resource(itype), n);
|
||||
change_reservation(dest, item2resource(itype), n);
|
||||
#else
|
||||
if (src->faction==dest->faction) {
|
||||
new_change_resvalue(dest, item2resource(itype), n);
|
||||
change_reservation(dest, item2resource(itype), n);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -386,7 +386,7 @@ sacrifice_cmd(unit * u, struct order * ord)
|
|||
cmistake(u, ord, 51, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
new_change_resource(u, oldresourcetype[R_SILVER], n);
|
||||
change_resource(u, oldresourcetype[R_SILVER], n);
|
||||
karma = n/10000;
|
||||
u->faction->karma += karma;
|
||||
break;
|
||||
|
|
|
@ -57,7 +57,7 @@ init_static(void)
|
|||
}
|
||||
|
||||
int
|
||||
new_get_resource(const unit * u, const resource_type * rtype)
|
||||
get_resource(const unit * u, const resource_type * rtype)
|
||||
{
|
||||
const item_type * itype = resource2item(rtype);
|
||||
|
||||
|
@ -91,7 +91,7 @@ new_get_resource(const unit * u, const resource_type * rtype)
|
|||
}
|
||||
|
||||
int
|
||||
new_change_resource(unit * u, const resource_type * rtype, int change)
|
||||
change_resource(unit * u, const resource_type * rtype, int change)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -116,7 +116,7 @@ new_change_resource(unit * u, const resource_type * rtype, int change)
|
|||
}
|
||||
|
||||
int
|
||||
new_get_resvalue(const unit * u, const resource_type * rtype)
|
||||
get_reservation(const unit * u, const resource_type * rtype)
|
||||
{
|
||||
struct reservation * res = u->reservations;
|
||||
|
||||
|
@ -132,7 +132,7 @@ new_get_resvalue(const unit * u, const resource_type * rtype)
|
|||
}
|
||||
|
||||
int
|
||||
new_change_resvalue(unit * u, const resource_type * rtype, int value)
|
||||
change_reservation(unit * u, const resource_type * rtype, int value)
|
||||
{
|
||||
struct reservation *res, ** rp = &u->reservations;
|
||||
|
||||
|
@ -183,7 +183,7 @@ new_get_pooled(const unit * u, const resource_type * rtype, int mode)
|
|||
unit *v;
|
||||
int use = 0;
|
||||
region * r = u->region;
|
||||
int have = new_get_resource(u, rtype);
|
||||
int have = get_resource(u, rtype);
|
||||
|
||||
if ((u->race->ec_flags & GETITEM) == 0) {
|
||||
mode &= (GET_SLACK|GET_RESERVE);
|
||||
|
@ -191,7 +191,7 @@ new_get_pooled(const unit * u, const resource_type * rtype, int mode)
|
|||
|
||||
if ((mode & GET_SLACK) && (mode & GET_RESERVE)) use = have;
|
||||
else {
|
||||
int reserve = new_get_resvalue(u, rtype);
|
||||
int reserve = get_reservation(u, rtype);
|
||||
int slack = max(0, have-reserve);
|
||||
if (mode & GET_RESERVE) use = have-slack;
|
||||
else if (mode & GET_SLACK) use = slack;
|
||||
|
@ -226,7 +226,7 @@ new_use_pooled(unit * u, const resource_type * rtype, int mode, int count)
|
|||
unit *v;
|
||||
int use = count;
|
||||
region * r = u->region;
|
||||
int n = 0, have = new_get_resource(u, rtype);
|
||||
int n = 0, have = get_resource(u, rtype);
|
||||
|
||||
if ((u->race->ec_flags & GETITEM) == 0) {
|
||||
mode &= (GET_SLACK|GET_RESERVE);
|
||||
|
@ -235,19 +235,19 @@ new_use_pooled(unit * u, const resource_type * rtype, int mode, int count)
|
|||
if ((mode & GET_SLACK) && (mode & GET_RESERVE)) {
|
||||
n = min(use, have);
|
||||
} else {
|
||||
int reserve = new_get_resvalue(u, rtype);
|
||||
int reserve = get_reservation(u, rtype);
|
||||
int slack = max(0, have-reserve);
|
||||
if (mode & GET_RESERVE) {
|
||||
n = have-slack;
|
||||
n = min(use, n);
|
||||
new_change_resvalue(u, rtype, -n);
|
||||
change_reservation(u, rtype, -n);
|
||||
}
|
||||
else if (mode & GET_SLACK) {
|
||||
n = min(use, slack);
|
||||
}
|
||||
}
|
||||
if (n>0) {
|
||||
new_change_resource(u, rtype, -n);
|
||||
change_resource(u, rtype, -n);
|
||||
use -= n;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ init_pool(void)
|
|||
use = new_use_pooled(u, rtype, GET_DEFAULT, count);
|
||||
if (use) {
|
||||
new_set_resvalue(u, rtype, use);
|
||||
new_change_resource(u, rtype, use);
|
||||
change_resource(u, rtype, use);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ int new_use_pooled(struct unit * u, const struct resource_type * res, int mode,
|
|||
* von der Einheit reservierten Resourcen
|
||||
*/
|
||||
|
||||
int new_get_resource(const struct unit * u, const struct resource_type * res);
|
||||
int new_change_resource(struct unit * u, const struct resource_type * res, int change);
|
||||
int get_resource(const struct unit * u, const struct resource_type * res);
|
||||
int change_resource(struct unit * u, const struct resource_type * res, int change);
|
||||
|
||||
int new_get_resvalue(const struct unit * u, const struct resource_type * res);
|
||||
int new_change_resvalue(struct unit * u, const struct resource_type * res, int value);
|
||||
int get_reservation(const struct unit * u, const struct resource_type * res);
|
||||
int change_reservation(struct unit * u, const struct resource_type * res, int value);
|
||||
|
||||
void init_pool(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue