renaming the pool funtions (no need for a new_ prefix anymore)

This commit is contained in:
Enno Rehling 2005-10-29 12:25:53 +00:00
parent 7017f27304
commit 3eef9447e9
7 changed files with 24 additions and 24 deletions

View File

@ -726,8 +726,8 @@ give_cmd(unit * u, order * ord)
item **itmp=&u->items; item **itmp=&u->items;
while (*itmp) { while (*itmp) {
if ((*itmp)->number > 0 if ((*itmp)->number > 0
&& (*itmp)->number - new_get_resvalue(u, (*itmp)->type->rtype) > 0) { && (*itmp)->number - get_reservation(u, (*itmp)->type->rtype) > 0) {
n = (*itmp)->number - new_get_resvalue(u, (*itmp)->type->rtype); n = (*itmp)->number - get_reservation(u, (*itmp)->type->rtype);
if (give_item(n, (*itmp)->type, u, u2, ord)==0) continue; if (give_item(n, (*itmp)->type, u, u2, ord)==0) continue;
} }
itmp = &(*itmp)->next; itmp = &(*itmp)->next;
@ -762,7 +762,7 @@ give_cmd(unit * u, order * ord)
if (itype!=NULL) { if (itype!=NULL) {
item * i = *i_find(&u->items, itype); item * i = *i_find(&u->items, itype);
if (i!=NULL) { 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); give_item(n, itype, u, u2, ord);
return; return;
} }

View File

@ -76,14 +76,14 @@
static void static void
reduce_weight(unit * u) 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); int capacity = walkingcapacity(u);
item ** itmp = &u->items; item ** itmp = &u->items;
int weight = 0; int weight = 0;
if (horses > 0) { if (horses > 0) {
horses = min(horses, (u->number*2)); 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 */ /* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */

View File

@ -446,7 +446,7 @@ destroy_cmd(unit * u, struct order * ord)
const requirement * rq = con->materials+c; const requirement * rq = con->materials+c;
int recycle = (int)(rq->recycle * rq->number * size/con->reqsize); int recycle = (int)(rq->recycle * rq->number * size/con->reqsize);
if (recycle) if (recycle)
new_change_resource(u, rq->rtype, recycle); change_resource(u, rq->rtype, recycle);
} }
} }
#endif #endif

View File

@ -117,10 +117,10 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
i_change(&dest->items, itype, n); i_change(&dest->items, itype, n);
#ifdef RESERVE_GIVE #ifdef RESERVE_GIVE
#ifdef RESERVE_DONATIONS #ifdef RESERVE_DONATIONS
new_change_resvalue(dest, item2resource(itype), n); change_reservation(dest, item2resource(itype), n);
#else #else
if (src->faction==dest->faction) { if (src->faction==dest->faction) {
new_change_resvalue(dest, item2resource(itype), n); change_reservation(dest, item2resource(itype), n);
} }
#endif #endif
#endif #endif

View File

@ -386,7 +386,7 @@ sacrifice_cmd(unit * u, struct order * ord)
cmistake(u, ord, 51, MSG_EVENT); cmistake(u, ord, 51, MSG_EVENT);
return 0; return 0;
} }
new_change_resource(u, oldresourcetype[R_SILVER], n); change_resource(u, oldresourcetype[R_SILVER], n);
karma = n/10000; karma = n/10000;
u->faction->karma += karma; u->faction->karma += karma;
break; break;

View File

@ -57,7 +57,7 @@ init_static(void)
} }
int 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); const item_type * itype = resource2item(rtype);
@ -91,7 +91,7 @@ new_get_resource(const unit * u, const resource_type * rtype)
} }
int 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; int i = 0;
@ -116,7 +116,7 @@ new_change_resource(unit * u, const resource_type * rtype, int change)
} }
int 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; struct reservation * res = u->reservations;
@ -132,7 +132,7 @@ new_get_resvalue(const unit * u, const resource_type * rtype)
} }
int 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; struct reservation *res, ** rp = &u->reservations;
@ -183,7 +183,7 @@ new_get_pooled(const unit * u, const resource_type * rtype, int mode)
unit *v; unit *v;
int use = 0; int use = 0;
region * r = u->region; region * r = u->region;
int have = new_get_resource(u, rtype); int have = get_resource(u, rtype);
if ((u->race->ec_flags & GETITEM) == 0) { if ((u->race->ec_flags & GETITEM) == 0) {
mode &= (GET_SLACK|GET_RESERVE); 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; if ((mode & GET_SLACK) && (mode & GET_RESERVE)) use = have;
else { else {
int reserve = new_get_resvalue(u, rtype); int reserve = get_reservation(u, rtype);
int slack = max(0, have-reserve); int slack = max(0, have-reserve);
if (mode & GET_RESERVE) use = have-slack; if (mode & GET_RESERVE) use = have-slack;
else if (mode & GET_SLACK) use = 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; unit *v;
int use = count; int use = count;
region * r = u->region; 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) { if ((u->race->ec_flags & GETITEM) == 0) {
mode &= (GET_SLACK|GET_RESERVE); 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)) { if ((mode & GET_SLACK) && (mode & GET_RESERVE)) {
n = min(use, have); n = min(use, have);
} else { } else {
int reserve = new_get_resvalue(u, rtype); int reserve = get_reservation(u, rtype);
int slack = max(0, have-reserve); int slack = max(0, have-reserve);
if (mode & GET_RESERVE) { if (mode & GET_RESERVE) {
n = have-slack; n = have-slack;
n = min(use, n); n = min(use, n);
new_change_resvalue(u, rtype, -n); change_reservation(u, rtype, -n);
} }
else if (mode & GET_SLACK) { else if (mode & GET_SLACK) {
n = min(use, slack); n = min(use, slack);
} }
} }
if (n>0) { if (n>0) {
new_change_resource(u, rtype, -n); change_resource(u, rtype, -n);
use -= n; use -= n;
} }
@ -298,7 +298,7 @@ init_pool(void)
use = new_use_pooled(u, rtype, GET_DEFAULT, count); use = new_use_pooled(u, rtype, GET_DEFAULT, count);
if (use) { if (use) {
new_set_resvalue(u, rtype, use); new_set_resvalue(u, rtype, use);
new_change_resource(u, rtype, use); change_resource(u, rtype, use);
} }
} }
} }

View File

@ -40,11 +40,11 @@ int new_use_pooled(struct unit * u, const struct resource_type * res, int mode,
* von der Einheit reservierten Resourcen * von der Einheit reservierten Resourcen
*/ */
int new_get_resource(const struct unit * u, const struct resource_type * res); int 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 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 get_reservation(const struct unit * u, const struct resource_type * res);
int new_change_resvalue(struct unit * u, const struct resource_type * res, int value); int change_reservation(struct unit * u, const struct resource_type * res, int value);
void init_pool(void); void init_pool(void);