forked from github/server
noch mehr funktionen mit new_ prefix aus pool.h bekommen den entfernt.
This commit is contained in:
parent
9b7128b660
commit
eba19999f4
|
@ -345,9 +345,9 @@ do_recruiting(recruitment * recruits, int available)
|
|||
|
||||
number = min(req->qty, get / multi);
|
||||
if (rc->recruitcost) {
|
||||
int afford = new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / rc->recruitcost;
|
||||
int afford = get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / rc->recruitcost;
|
||||
number = min(number, afford);
|
||||
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, rc->recruitcost*number);
|
||||
use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, rc->recruitcost*number);
|
||||
}
|
||||
add_recruits(u, number, req->qty);
|
||||
if ((rc->ec_flags & ECF_REC_ETHEREAL)==0) {
|
||||
|
@ -504,7 +504,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
|||
return;
|
||||
}
|
||||
|
||||
if (new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < recruitcost) {
|
||||
if (get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < recruitcost) {
|
||||
cmistake(u, ord, 142, MSG_EVENT);
|
||||
return;
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
|||
cmistake(u, ord, 156, MSG_EVENT);
|
||||
return;
|
||||
}
|
||||
if (recruitcost) n = min(n, new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / recruitcost);
|
||||
if (recruitcost) n = min(n, get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / recruitcost);
|
||||
|
||||
u->wants = n;
|
||||
|
||||
|
@ -904,15 +904,15 @@ maintain(building * b, boolean first)
|
|||
/* first ist im ersten versuch true, im zweiten aber false! Das
|
||||
* bedeutet, das in der Runde in die Region geschafften Resourcen
|
||||
* nicht genutzt werden können, weil die reserviert sind! */
|
||||
if (!first) need -= new_get_pooled(u, m->rtype, GET_ALL);
|
||||
else need -= new_get_pooled(u, m->rtype, GET_DEFAULT);
|
||||
if (!first) need -= get_pooled(u, m->rtype, GET_ALL);
|
||||
else need -= get_pooled(u, m->rtype, GET_DEFAULT);
|
||||
if (!first && need > 0) {
|
||||
unit * ua;
|
||||
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FL_DH);
|
||||
fset(u->faction, FL_DH); /* hat schon */
|
||||
for (ua=r->units;ua;ua=ua->next) {
|
||||
if (!fval(ua->faction, FL_DH) && (ua->faction == u->faction || alliedunit(ua, u->faction, HELP_MONEY))) {
|
||||
need -= new_get_pooled(ua, m->rtype, GET_ALL);
|
||||
need -= get_pooled(ua, m->rtype, GET_ALL);
|
||||
fset(ua->faction, FL_DH);
|
||||
if (need<=0) break;
|
||||
}
|
||||
|
@ -945,15 +945,15 @@ maintain(building * b, boolean first)
|
|||
if (!fval(m, MTF_VITAL) && !work) continue;
|
||||
if (fval(m, MTF_VARIABLE)) cost = cost * b->size;
|
||||
|
||||
if (!first) cost -= new_use_pooled(u, m->rtype, GET_ALL, cost);
|
||||
else cost -= new_use_pooled(u, m->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, cost);
|
||||
if (!first) cost -= use_pooled(u, m->rtype, GET_ALL, cost);
|
||||
else cost -= use_pooled(u, m->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, cost);
|
||||
if (!first && cost > 0) {
|
||||
unit * ua;
|
||||
for (ua=r->units;ua;ua=ua->next) freset(ua->faction, FL_DH);
|
||||
fset(u->faction, FL_DH); /* hat schon */
|
||||
for (ua=r->units;ua;ua=ua->next) {
|
||||
if (!fval(ua->faction, FL_DH) && alliedunit(ua, u->faction, HELP_MONEY)) {
|
||||
int give = new_use_pooled(ua, m->rtype, GET_ALL, cost);
|
||||
int give = use_pooled(ua, m->rtype, GET_ALL, cost);
|
||||
if (!give) continue;
|
||||
cost -= give;
|
||||
fset(ua->faction, FL_DH);
|
||||
|
@ -1804,7 +1804,7 @@ expandbuying(region * r, request * buyorders)
|
|||
if (trade->number + 1 > max_products) ++multi;
|
||||
price = ltype->price * multi;
|
||||
|
||||
if (new_get_pooled(oa[j].unit, oldresourcetype[R_SILVER], GET_DEFAULT) >= price) {
|
||||
if (get_pooled(oa[j].unit, oldresourcetype[R_SILVER], GET_DEFAULT) >= price) {
|
||||
unit * u = oa[j].unit;
|
||||
|
||||
/* litems zählt die Güter, die verkauft wurden, u->n das Geld, das
|
||||
|
@ -1815,7 +1815,7 @@ expandbuying(region * r, request * buyorders)
|
|||
if (a==NULL) a = a_add(&u->attribs, a_new(&at_luxuries));
|
||||
i_change((item**)&a->data.v, ltype->itype, 1);
|
||||
i_change(&oa[j].unit->items, ltype->itype, 1);
|
||||
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, price);
|
||||
use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, price);
|
||||
if (u->n < 0)
|
||||
u->n = 0;
|
||||
u->n += price;
|
||||
|
@ -2096,9 +2096,9 @@ expandselling(region * r, request * sellorders, int limit)
|
|||
}
|
||||
if (use>0) {
|
||||
#ifdef NDEBUG
|
||||
new_use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
#else
|
||||
/* int i = */ new_use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
/* int i = */ use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
/* assert(i==use); */
|
||||
#endif
|
||||
}
|
||||
|
@ -2229,13 +2229,13 @@ sell(unit * u, request ** sellorders, struct order * ord)
|
|||
cmistake(u, ord, 263, MSG_COMMERCE);
|
||||
return false;
|
||||
}
|
||||
available = new_get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
available = get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
|
||||
/* Wenn andere Einheiten das selbe verkaufen, muß ihr Zeug abgezogen
|
||||
* werden damit es nicht zweimal verkauft wird: */
|
||||
for (o=*sellorders;o;o=o->next) {
|
||||
if (o->type.ltype==ltype && o->unit->faction == u->faction) {
|
||||
int fpool = o->qty - new_get_pooled(o->unit, itype->rtype, GET_RESERVE);
|
||||
int fpool = o->qty - get_pooled(o->unit, itype->rtype, GET_RESERVE);
|
||||
available -= max(0, fpool);
|
||||
}
|
||||
}
|
||||
|
@ -2296,7 +2296,7 @@ expandstealing(region * r, request * stealorders)
|
|||
for (i = 0; i != norders && oa[i].unit->n <= oa[i].unit->wants; i++) {
|
||||
unit *u = findunitg(oa[i].no, r);
|
||||
int n = 0;
|
||||
if (u && u->region==r) n = new_get_pooled(u, r_silver, GET_ALL);
|
||||
if (u && u->region==r) n = get_pooled(u, r_silver, GET_ALL);
|
||||
#ifndef GOBLINKILL
|
||||
if (oa[i].type.goblin) { /* Goblin-Spezialklau */
|
||||
int uct = 0;
|
||||
|
@ -2314,7 +2314,7 @@ expandstealing(region * r, request * stealorders)
|
|||
}
|
||||
if (n > 0) {
|
||||
n = min(n, oa[i].unit->wants);
|
||||
new_use_pooled(u, r_silver, GET_ALL, n);
|
||||
use_pooled(u, r_silver, GET_ALL, n);
|
||||
oa[i].unit->n = n;
|
||||
change_money(oa[i].unit, n);
|
||||
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
|
||||
|
@ -2353,12 +2353,12 @@ plant(region *r, unit *u, int raw)
|
|||
return;
|
||||
}
|
||||
/* Wasser des Lebens prüfen */
|
||||
if (new_get_pooled(u, rt_water, GET_DEFAULT) == 0) {
|
||||
if (get_pooled(u, rt_water, GET_DEFAULT) == 0) {
|
||||
add_message(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "resource_missing", "missing", rt_water));
|
||||
return;
|
||||
}
|
||||
n = new_get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
n = get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
/* Kräuter prüfen */
|
||||
if (n==0) {
|
||||
add_message(&u->faction->msgs,
|
||||
|
@ -2376,8 +2376,8 @@ plant(region *r, unit *u, int raw)
|
|||
produceexp(u, SK_HERBALISM, u->number);
|
||||
|
||||
/* Alles ok. Abziehen. */
|
||||
new_use_pooled(u, rt_water, GET_DEFAULT, 1);
|
||||
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
||||
use_pooled(u, rt_water, GET_DEFAULT, 1);
|
||||
use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
||||
rsetherbs(r, rherbs(r)+planted);
|
||||
ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb",
|
||||
u, r, planted, itype->rtype));
|
||||
|
@ -2415,7 +2415,7 @@ planttrees(region *r, unit *u, int raw)
|
|||
return;
|
||||
}
|
||||
|
||||
n = new_get_pooled(u, rtype, GET_DEFAULT);
|
||||
n = get_pooled(u, rtype, GET_DEFAULT);
|
||||
/* Samen prüfen */
|
||||
if (n==0) {
|
||||
add_message(&u->faction->msgs,
|
||||
|
@ -2435,7 +2435,7 @@ planttrees(region *r, unit *u, int raw)
|
|||
|
||||
/* Alles ok. Abziehen. */
|
||||
produceexp(u, SK_HERBALISM, u->number);
|
||||
new_use_pooled(u, rtype, GET_DEFAULT, n);
|
||||
use_pooled(u, rtype, GET_DEFAULT, n);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("plant",
|
||||
"unit region amount herb", u, r, planted, rtype));
|
||||
|
@ -2474,7 +2474,7 @@ breedtrees(region *r, unit *u, int raw)
|
|||
planttrees(r, u, raw);
|
||||
return;
|
||||
}
|
||||
n = new_get_pooled(u, rtype, GET_DEFAULT);
|
||||
n = get_pooled(u, rtype, GET_DEFAULT);
|
||||
/* Samen prüfen */
|
||||
if (n==0) {
|
||||
add_message(&u->faction->msgs,
|
||||
|
@ -2494,7 +2494,7 @@ breedtrees(region *r, unit *u, int raw)
|
|||
|
||||
/* Alles ok. Abziehen. */
|
||||
produceexp(u, SK_HERBALISM, u->number);
|
||||
new_use_pooled(u, rtype, GET_DEFAULT, n);
|
||||
use_pooled(u, rtype, GET_DEFAULT, n);
|
||||
|
||||
add_message(&u->faction->msgs, new_message(u->faction,
|
||||
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, rtype));
|
||||
|
|
|
@ -153,7 +153,7 @@ use_antimagiccrystal(unit * u, const struct item_type * itype, int amount, struc
|
|||
create_curse(u, &r->attribs, ct_find("antimagiczone"), force, duration, var, 0);
|
||||
}
|
||||
}
|
||||
new_use_pooled(u, rt_crystal, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
use_pooled(u, rt_crystal, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
ADDMSG(&u->faction->msgs, msg_message("use_antimagiccrystal",
|
||||
"unit region", u, r));
|
||||
return 0;
|
||||
|
|
|
@ -2509,7 +2509,7 @@ promotion_cmd(unit * u, struct order * ord)
|
|||
u->race));
|
||||
return 0;
|
||||
}
|
||||
money = new_get_pooled(u, i_silver->rtype, GET_ALL);
|
||||
money = get_pooled(u, i_silver->rtype, GET_ALL);
|
||||
people = count_all(u->faction) * u->number;
|
||||
|
||||
if (people>money) {
|
||||
|
@ -2517,7 +2517,7 @@ promotion_cmd(unit * u, struct order * ord)
|
|||
people, money));
|
||||
return 0;
|
||||
}
|
||||
new_use_pooled(u, i_silver->rtype, GET_ALL, people);
|
||||
use_pooled(u, i_silver->rtype, GET_ALL, people);
|
||||
fset(u, UFL_HERO);
|
||||
ADDMSG(&u->faction->msgs, msg_message("hero_promotion", "unit cost",
|
||||
u, people));
|
||||
|
@ -3602,7 +3602,7 @@ use_item(unit * u, const item_type * itype, int amount, struct order * ord)
|
|||
int i;
|
||||
int target = read_unitid(u->faction, u->region);
|
||||
|
||||
i = new_get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
i = get_pooled(u, itype->rtype, GET_DEFAULT);
|
||||
|
||||
if (amount>i) {
|
||||
amount = i;
|
||||
|
|
|
@ -194,7 +194,7 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
|
|||
int j = study_cost(student, sk);
|
||||
j = max(50, j * 2);
|
||||
/* kann Einheit das zahlen? */
|
||||
if (new_get_pooled(student, oldresourcetype[R_SILVER], GET_DEFAULT) >= j) {
|
||||
if (get_pooled(student, oldresourcetype[R_SILVER], GET_DEFAULT) >= j) {
|
||||
/* Jeder Schüler zusätzlich +10 Tage wenn in Uni. */
|
||||
teach->value += (n / 30) * 10; /* learning erhöhen */
|
||||
/* Lehrer zusätzlich +1 Tag pro Schüler. */
|
||||
|
@ -608,7 +608,7 @@ learn(void)
|
|||
}
|
||||
}
|
||||
if (studycost) {
|
||||
money = new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT);
|
||||
money = get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT);
|
||||
money = min(money, studycost * u->number);
|
||||
}
|
||||
if (money < studycost * u->number) {
|
||||
|
@ -631,7 +631,7 @@ learn(void)
|
|||
teach->teachers[0] = 0;
|
||||
}
|
||||
if (money>0) {
|
||||
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, money);
|
||||
use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, money);
|
||||
add_message(&u->faction->msgs, msg_message("studycost",
|
||||
"unit region cost skill", u, u->region, money, sk));
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ attack_catapult(const troop * at, const struct weapon_type * wtype, int * casual
|
|||
assert(af->person[at->index].reload==0);
|
||||
|
||||
if (it_catapultammo!=NULL) {
|
||||
if (new_get_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK) <= 0) {
|
||||
if (get_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK) <= 0) {
|
||||
/* No ammo. Use other weapon if available. */
|
||||
return true;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ attack_catapult(const troop * at, const struct weapon_type * wtype, int * casual
|
|||
n = min(CATAPULT_ATTACKS, count_enemies(b, af->side, minrow, maxrow, true));
|
||||
|
||||
if (it_catapultammo!=NULL) {
|
||||
new_use_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
|
||||
use_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
|
||||
}
|
||||
|
||||
while (--n >= 0) {
|
||||
|
|
|
@ -106,10 +106,10 @@ use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
|
|||
|
||||
/* für die Aufforstung von Mallornwäldern braucht man Mallorn */
|
||||
if (fval(r, RF_MALLORN)) {
|
||||
holz = new_use_pooled(u, oldresourcetype[R_MALLORN],
|
||||
holz = use_pooled(u, oldresourcetype[R_MALLORN],
|
||||
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
||||
} else {
|
||||
holz = new_use_pooled(u, oldresourcetype[R_WOOD],
|
||||
holz = use_pooled(u, oldresourcetype[R_WOOD],
|
||||
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
||||
}
|
||||
if (r->land==0) holz=0;
|
||||
|
@ -139,7 +139,7 @@ use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
|
|||
} else {
|
||||
change_effect(u, ptype, 10*amount);
|
||||
}
|
||||
new_use_pooled(u, ptype->itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
use_pooled(u, ptype->itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
usetpotionuse(u, ptype);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
||||
|
|
|
@ -221,7 +221,7 @@ siege_cmd(unit * u, order * ord)
|
|||
/* schaden durch katapulte */
|
||||
|
||||
d = min(u->number,
|
||||
min(new_get_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK), get_item(u, I_CATAPULT)));
|
||||
min(get_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK), get_item(u, I_CATAPULT)));
|
||||
if (eff_skill(u, SK_CATAPULT, r) >= 1) {
|
||||
katapultiere = d;
|
||||
d *= eff_skill(u, SK_CATAPULT, r);
|
||||
|
@ -255,7 +255,7 @@ siege_cmd(unit * u, order * ord)
|
|||
/* meldung, schaden anrichten */
|
||||
if (d && !curse_active(get_curse(b->attribs, magicwalls_ct))) {
|
||||
b->size -= d;
|
||||
new_use_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, d);
|
||||
use_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, d);
|
||||
d = 100 * d / b->size;
|
||||
} else d = 0;
|
||||
|
||||
|
@ -508,7 +508,7 @@ build_road(region * r, unit * u, int size, direction_t d)
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (!new_get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT) && u->race != new_race[RC_STONEGOLEM]) {
|
||||
if (!get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT) && u->race != new_race[RC_STONEGOLEM]) {
|
||||
cmistake(u, u->thisorder, 151, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ build_road(region * r, unit * u, int size, direction_t d)
|
|||
if (u->race == new_race[RC_STONEGOLEM]){
|
||||
n = u->number * GOLEM_STONE;
|
||||
} else {
|
||||
n = new_get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT);
|
||||
n = get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT);
|
||||
}
|
||||
left = min(n, left);
|
||||
if (size>0) left = min(size, left);
|
||||
|
@ -568,7 +568,7 @@ build_road(region * r, unit * u, int size, direction_t d)
|
|||
}
|
||||
scale_number(u, u->number - golemsused);
|
||||
} else {
|
||||
new_use_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT, n);
|
||||
use_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT, n);
|
||||
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
||||
produceexp(u, SK_ROAD_BUILDING, min(n, u->number));
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ build(unit * u, const construction * ctype, int completed, int want)
|
|||
if (type->materials) for (c=0;n>0 && type->materials[c].number;c++) {
|
||||
const struct resource_type * rtype = type->materials[c].rtype;
|
||||
int need;
|
||||
int have = new_get_pooled(u, rtype, GET_DEFAULT);
|
||||
int have = get_pooled(u, rtype, GET_DEFAULT);
|
||||
int prebuilt;
|
||||
int canuse = have;
|
||||
if (inside_building(u)) {
|
||||
|
@ -756,7 +756,7 @@ build(unit * u, const construction * ctype, int completed, int want)
|
|||
multi = canuse/100;
|
||||
if (canuse<0) return canuse; /* pass errors to caller */
|
||||
|
||||
new_use_pooled(u, rtype, GET_DEFAULT, (need-prebuilt+multi-1)/multi);
|
||||
use_pooled(u, rtype, GET_DEFAULT, (need-prebuilt+multi-1)/multi);
|
||||
}
|
||||
made += n;
|
||||
skills -= n * type->minskill;
|
||||
|
@ -778,7 +778,7 @@ maxbuild(const unit * u, const construction * cons)
|
|||
int maximum = INT_MAX;
|
||||
for (c=0;cons->materials[c].number;c++) {
|
||||
const resource_type * rtype = cons->materials[c].rtype;
|
||||
int have = new_get_pooled(u, rtype, GET_DEFAULT);
|
||||
int have = get_pooled(u, rtype, GET_DEFAULT);
|
||||
int need = required(1, cons->reqsize, cons->materials[c].number);
|
||||
if (have<need) {
|
||||
cmistake(u, u->thisorder, 88, MSG_PRODUCE);
|
||||
|
|
|
@ -96,7 +96,7 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
|
|||
int n;
|
||||
|
||||
assert(itype!=NULL);
|
||||
n = new_get_pooled(src, item2resource(itype), GET_DEFAULT);
|
||||
n = get_pooled(src, item2resource(itype), GET_DEFAULT);
|
||||
n = min(want, n);
|
||||
if (dest && src->faction != dest->faction && src->faction->age < GiveRestriction()) {
|
||||
if (ord!=NULL) {
|
||||
|
@ -111,8 +111,8 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
|
|||
} else if (itype->give && !itype->give(src, dest, itype, n, ord)) {
|
||||
return -1;
|
||||
} else {
|
||||
int use = new_use_pooled(src, item2resource(itype), GET_SLACK, n);
|
||||
if (use<n) use += new_use_pooled(src, item2resource(itype), GET_RESERVE|GET_POOLED_SLACK, n-use);
|
||||
int use = use_pooled(src, item2resource(itype), GET_SLACK, n);
|
||||
if (use<n) use += use_pooled(src, item2resource(itype), GET_RESERVE|GET_POOLED_SLACK, n-use);
|
||||
if (dest) {
|
||||
i_change(&dest->items, itype, n);
|
||||
#ifdef RESERVE_GIVE
|
||||
|
|
|
@ -690,7 +690,7 @@ use_tacticcrystal(region * r, unit * u, int amount, struct order * ord)
|
|||
c->data.i = SK_TACTICS;
|
||||
unused(ord);
|
||||
}
|
||||
new_use_pooled(u, oldresourcetype[R_TACTICCRYSTAL], GET_DEFAULT, amount);
|
||||
use_pooled(u, oldresourcetype[R_TACTICCRYSTAL], GET_DEFAULT, amount);
|
||||
add_message(&u->faction->msgs,
|
||||
new_message(u->faction, "use_tacticcrystal%u:unit%r:region", u, r));
|
||||
return;
|
||||
|
@ -1266,7 +1266,7 @@ use_healingpotion(struct unit *user, const struct item_type *itype, int amount,
|
|||
}
|
||||
u = u->next;
|
||||
}
|
||||
new_use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
usetpotionuse(user, itype->rtype->ptype);
|
||||
|
||||
ADDMSG(&user->faction->msgs, msg_message("usepotion",
|
||||
|
@ -1284,7 +1284,7 @@ use_warmthpotion(struct unit *u, const struct item_type *itype, int amount, stru
|
|||
cmistake(u, ord, 163, MSG_EVENT);
|
||||
return ECUSTOM;
|
||||
}
|
||||
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
usetpotionuse(u, itype->rtype->ptype);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
||||
|
@ -1308,7 +1308,7 @@ use_foolpotion(struct unit *u, int targetno, const struct item_type *itype, int
|
|||
"unit recipient amount", u, target, amount));
|
||||
|
||||
change_effect(target, itype->rtype->ptype, amount);
|
||||
new_use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
||||
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1324,7 +1324,7 @@ use_bloodpotion(struct unit *u, const struct item_type *itype, int amount, struc
|
|||
add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore));
|
||||
u->irace = u->race = new_race[RC_TOAD];
|
||||
}
|
||||
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||
usetpotionuse(u, itype->rtype->ptype);
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
||||
|
@ -1336,14 +1336,14 @@ use_bloodpotion(struct unit *u, const struct item_type *itype, int amount, struc
|
|||
static int
|
||||
use_mistletoe(struct unit * user, const struct item_type * itype, int amount, struct order * ord)
|
||||
{
|
||||
int mtoes = new_get_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK);
|
||||
int mtoes = get_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK);
|
||||
|
||||
if (user->number>mtoes) {
|
||||
ADDMSG(&user->faction->msgs, msg_message("use_singleperson",
|
||||
"unit item region command", user, itype->rtype, user->region, ord));
|
||||
return -1;
|
||||
}
|
||||
new_use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, user->number);
|
||||
use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, user->number);
|
||||
a_add(&user->attribs, make_fleechance((float)1.0));
|
||||
ADDMSG(&user->faction->msgs, msg_message("use_item",
|
||||
"unit item", user, itype->rtype));
|
||||
|
@ -1354,7 +1354,7 @@ use_mistletoe(struct unit * user, const struct item_type * itype, int amount, st
|
|||
static int
|
||||
use_magicboost(struct unit * user, const struct item_type * itype, int amount, struct order * ord)
|
||||
{
|
||||
int mtoes = new_get_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK);
|
||||
int mtoes = get_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK);
|
||||
faction * f = user->faction;
|
||||
if (user->number>mtoes) {
|
||||
ADDMSG(&user->faction->msgs, msg_message("use_singleperson",
|
||||
|
@ -1365,7 +1365,7 @@ use_magicboost(struct unit * user, const struct item_type * itype, int amount, s
|
|||
cmistake(user, user->thisorder, 214, MSG_EVENT);
|
||||
return -1;
|
||||
}
|
||||
new_use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, user->number);
|
||||
use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, user->number);
|
||||
|
||||
a_add(&f->attribs, make_key(atoi36("mbst")));
|
||||
set_level(user, sk_find("magic"), 3);
|
||||
|
|
|
@ -381,7 +381,7 @@ sacrifice_cmd(unit * u, struct order * ord)
|
|||
|
||||
switch(findparam(s, u->faction->locale)) {
|
||||
case P_SILVER:
|
||||
n = new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, n);
|
||||
n = use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, n);
|
||||
if(n < 10000) {
|
||||
cmistake(u, ord, 51, MSG_EVENT);
|
||||
return 0;
|
||||
|
|
|
@ -782,7 +782,7 @@ eff_spelllevel(unit *u, const spell * sp, int cast_level, int range)
|
|||
} else {
|
||||
needplevel = sp->components[k].amount * range;
|
||||
}
|
||||
maxlevel = new_get_pooled(u, sp->components[k].type, GET_DEFAULT)/needplevel;
|
||||
maxlevel = get_pooled(u, sp->components[k].type, GET_DEFAULT)/needplevel;
|
||||
|
||||
/* sind die Kosten fix, so muss die Komponente nur einmal vorhanden
|
||||
* sein und der cast_level ändert sich nicht */
|
||||
|
@ -836,7 +836,7 @@ pay_spell(unit * u, const spell * sp, int cast_level, int range)
|
|||
resuse *= cast_level;
|
||||
}
|
||||
|
||||
new_use_pooled(u, sp->components[k].type, GET_DEFAULT, resuse);
|
||||
use_pooled(u, sp->components[k].type, GET_DEFAULT, resuse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -927,7 +927,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
|||
break;
|
||||
}
|
||||
|
||||
if (new_get_pooled(u, rtype, GET_DEFAULT) < itemanz) {
|
||||
if (get_pooled(u, rtype, GET_DEFAULT) < itemanz) {
|
||||
if (b == false) {
|
||||
/* es fehlte schon eine andere Komponente, wir basteln die
|
||||
* Meldung weiter zusammen */
|
||||
|
|
|
@ -166,7 +166,7 @@ new_set_resvalue(unit * u, const resource_type * rtype, int value)
|
|||
}
|
||||
|
||||
int
|
||||
new_get_pooled(const unit * u, const resource_type * rtype, unsigned int mode)
|
||||
get_pooled(const unit * u, const resource_type * rtype, unsigned int mode)
|
||||
{
|
||||
const faction * f = u->faction;
|
||||
unit *v;
|
||||
|
@ -202,14 +202,14 @@ new_get_pooled(const unit * u, const resource_type * rtype, unsigned int mode)
|
|||
}
|
||||
else if (alliedunit(v, f, HELP_MONEY)) mask = (mode >> 6) & (GET_SLACK|GET_RESERVE);
|
||||
else continue;
|
||||
use += new_get_pooled(v, rtype, mask);
|
||||
use += get_pooled(v, rtype, mask);
|
||||
}
|
||||
}
|
||||
return use;
|
||||
}
|
||||
|
||||
int
|
||||
new_use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count)
|
||||
use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count)
|
||||
{
|
||||
const faction *f = u->faction;
|
||||
unit *v;
|
||||
|
@ -253,7 +253,7 @@ new_use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int cou
|
|||
}
|
||||
else if (alliedunit(v, f, HELP_MONEY)) mask = (mode >> 6) & (GET_SLACK|GET_RESERVE);
|
||||
else continue;
|
||||
use -= new_use_pooled(v, rtype, mask, use);
|
||||
use -= use_pooled(v, rtype, mask, use);
|
||||
}
|
||||
}
|
||||
return count-use;
|
||||
|
@ -284,7 +284,7 @@ init_pool(void)
|
|||
if (rtype == NULL) continue;
|
||||
|
||||
new_set_resvalue(u, rtype, 0); /* make sure the pool is empty */
|
||||
use = new_use_pooled(u, rtype, GET_DEFAULT, count);
|
||||
use = use_pooled(u, rtype, GET_DEFAULT, count);
|
||||
if (use) {
|
||||
new_set_resvalue(u, rtype, use);
|
||||
change_resource(u, rtype, use);
|
||||
|
|
|
@ -32,8 +32,8 @@ extern "C" {
|
|||
#define GET_DEFAULT (GET_RESERVE|GET_SLACK|GET_POOLED_SLACK)
|
||||
#define GET_ALL (GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE)
|
||||
|
||||
int new_get_pooled(const struct unit * u, const struct resource_type * res, unsigned int mode);
|
||||
int new_use_pooled(struct unit * u, const struct resource_type * res, unsigned int mode, int count);
|
||||
int get_pooled(const struct unit * u, const struct resource_type * res, unsigned int mode);
|
||||
int use_pooled(struct unit * u, const struct resource_type * res, unsigned int mode, int count);
|
||||
/** use_pooled
|
||||
* verbraucht 'count' Objekte der resource 'itm'
|
||||
* unter zuhilfenahme des Pools der struct region und Aufbrauch des
|
||||
|
|
|
@ -120,7 +120,7 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
|
|||
if (fee>2000) fee = 2000;
|
||||
if (getplane(r)==arena) return -1;
|
||||
if (u->number!=1 && enter_fail(u)) return -1;
|
||||
if (new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < fee && enter_fail(u)) return -1;
|
||||
if (get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < fee && enter_fail(u)) return -1;
|
||||
for (sk=0;sk!=MAXSKILLS;++sk) {
|
||||
if (get_level(u, sk)>1 && enter_fail(u)) return -1;
|
||||
}
|
||||
|
@ -145,8 +145,8 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
|
|||
}
|
||||
sprintf(buf, "In %s öffnet sich ein Portal. Eine Stimme ertönt, und spricht: 'Willkommen in der Ebene der Herausforderung'. %s durchschreitet das Tor zu einer anderen Welt.", regionname(u->region, u->faction), unitname(u));
|
||||
addmessage(NULL, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
|
||||
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE, 1);
|
||||
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, fee);
|
||||
use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE, 1);
|
||||
use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, fee);
|
||||
set_money(u, 109);
|
||||
fset(u, UFL_PARTEITARNUNG);
|
||||
move_unit(u, start_region[rand() % 6], NULL);
|
||||
|
|
Loading…
Reference in New Issue