forked from github/server
quick changes to remove the old pool functions that use resource_t
This commit is contained in:
parent
43e44a083e
commit
7017f27304
|
@ -345,9 +345,9 @@ do_recruiting(recruitment * recruits, int available)
|
||||||
|
|
||||||
number = min(req->qty, get / multi);
|
number = min(req->qty, get / multi);
|
||||||
if (rc->recruitcost) {
|
if (rc->recruitcost) {
|
||||||
int afford = get_pooled(u, u->region, R_SILVER) / rc->recruitcost;
|
int afford = new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / rc->recruitcost;
|
||||||
number = min(number, afford);
|
number = min(number, afford);
|
||||||
use_pooled(u, u->region, R_SILVER, rc->recruitcost*number);
|
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, rc->recruitcost*number);
|
||||||
}
|
}
|
||||||
add_recruits(u, number, req->qty);
|
add_recruits(u, number, req->qty);
|
||||||
if ((rc->ec_flags & ECF_REC_ETHEREAL)==0) {
|
if ((rc->ec_flags & ECF_REC_ETHEREAL)==0) {
|
||||||
|
@ -504,7 +504,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_pooled(u, r, R_SILVER) < recruitcost) {
|
if (new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < recruitcost) {
|
||||||
cmistake(u, ord, 142, MSG_EVENT);
|
cmistake(u, ord, 142, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
||||||
cmistake(u, ord, 156, MSG_EVENT);
|
cmistake(u, ord, 156, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (recruitcost) n = min(n, get_pooled(u, r, R_SILVER) / recruitcost);
|
if (recruitcost) n = min(n, new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) / recruitcost);
|
||||||
|
|
||||||
u->wants = n;
|
u->wants = n;
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ maintain(building * b, boolean first)
|
||||||
/* first ist im ersten versuch true, im zweiten aber false! Das
|
/* first ist im ersten versuch true, im zweiten aber false! Das
|
||||||
* bedeutet, das in der Runde in die Region geschafften Resourcen
|
* bedeutet, das in der Runde in die Region geschafften Resourcen
|
||||||
* nicht genutzt werden können, weil die reserviert sind! */
|
* nicht genutzt werden können, weil die reserviert sind! */
|
||||||
if (!first) need -= get_all(u, m->rtype);
|
if (!first) need -= new_get_pooled(u, m->rtype, GET_ALL);
|
||||||
else need -= new_get_pooled(u, m->rtype, GET_DEFAULT);
|
else need -= new_get_pooled(u, m->rtype, GET_DEFAULT);
|
||||||
if (!first && need > 0) {
|
if (!first && need > 0) {
|
||||||
unit * ua;
|
unit * ua;
|
||||||
|
@ -912,7 +912,7 @@ maintain(building * b, boolean first)
|
||||||
fset(u->faction, FL_DH); /* hat schon */
|
fset(u->faction, FL_DH); /* hat schon */
|
||||||
for (ua=r->units;ua;ua=ua->next) {
|
for (ua=r->units;ua;ua=ua->next) {
|
||||||
if (!fval(ua->faction, FL_DH) && (ua->faction == u->faction || alliedunit(ua, u->faction, HELP_MONEY))) {
|
if (!fval(ua->faction, FL_DH) && (ua->faction == u->faction || alliedunit(ua, u->faction, HELP_MONEY))) {
|
||||||
need -= get_all(ua, m->rtype);
|
need -= new_get_pooled(ua, m->rtype, GET_ALL);
|
||||||
fset(ua->faction, FL_DH);
|
fset(ua->faction, FL_DH);
|
||||||
if (need<=0) break;
|
if (need<=0) break;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ maintain(building * b, boolean first)
|
||||||
if (!fval(m, MTF_VITAL) && !work) continue;
|
if (!fval(m, MTF_VITAL) && !work) continue;
|
||||||
if (fval(m, MTF_VARIABLE)) cost = cost * b->size;
|
if (fval(m, MTF_VARIABLE)) cost = cost * b->size;
|
||||||
|
|
||||||
if (!first) cost -= use_all(u, m->rtype, cost);
|
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);
|
else cost -= new_use_pooled(u, m->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, cost);
|
||||||
if (!first && cost > 0) {
|
if (!first && cost > 0) {
|
||||||
unit * ua;
|
unit * ua;
|
||||||
|
@ -953,7 +953,7 @@ maintain(building * b, boolean first)
|
||||||
fset(u->faction, FL_DH); /* hat schon */
|
fset(u->faction, FL_DH); /* hat schon */
|
||||||
for (ua=r->units;ua;ua=ua->next) {
|
for (ua=r->units;ua;ua=ua->next) {
|
||||||
if (!fval(ua->faction, FL_DH) && alliedunit(ua, u->faction, HELP_MONEY)) {
|
if (!fval(ua->faction, FL_DH) && alliedunit(ua, u->faction, HELP_MONEY)) {
|
||||||
int give = use_all(ua, m->rtype, cost);
|
int give = new_use_pooled(ua, m->rtype, GET_ALL, cost);
|
||||||
if (!give) continue;
|
if (!give) continue;
|
||||||
cost -= give;
|
cost -= give;
|
||||||
fset(ua->faction, FL_DH);
|
fset(ua->faction, FL_DH);
|
||||||
|
@ -1804,7 +1804,7 @@ expandbuying(region * r, request * buyorders)
|
||||||
if (trade->number + 1 > max_products) ++multi;
|
if (trade->number + 1 > max_products) ++multi;
|
||||||
price = ltype->price * multi;
|
price = ltype->price * multi;
|
||||||
|
|
||||||
if (get_pooled(oa[j].unit, r, R_SILVER) >= price) {
|
if (new_get_pooled(oa[j].unit, oldresourcetype[R_SILVER], GET_DEFAULT) >= price) {
|
||||||
unit * u = oa[j].unit;
|
unit * u = oa[j].unit;
|
||||||
|
|
||||||
/* litems zählt die Güter, die verkauft wurden, u->n das Geld, das
|
/* 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));
|
if (a==NULL) a = a_add(&u->attribs, a_new(&at_luxuries));
|
||||||
i_change((item**)&a->data.v, ltype->itype, 1);
|
i_change((item**)&a->data.v, ltype->itype, 1);
|
||||||
i_change(&oa[j].unit->items, ltype->itype, 1);
|
i_change(&oa[j].unit->items, ltype->itype, 1);
|
||||||
use_pooled(u, r, R_SILVER, price);
|
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, price);
|
||||||
if (u->n < 0)
|
if (u->n < 0)
|
||||||
u->n = 0;
|
u->n = 0;
|
||||||
u->n += price;
|
u->n += price;
|
||||||
|
@ -2296,7 +2296,7 @@ expandstealing(region * r, request * stealorders)
|
||||||
for (i = 0; i != norders && oa[i].unit->n <= oa[i].unit->wants; i++) {
|
for (i = 0; i != norders && oa[i].unit->n <= oa[i].unit->wants; i++) {
|
||||||
unit *u = findunitg(oa[i].no, r);
|
unit *u = findunitg(oa[i].no, r);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
if (u && u->region==r) n = get_all(u, r_silver);
|
if (u && u->region==r) n = new_get_pooled(u, r_silver, GET_ALL);
|
||||||
#ifndef GOBLINKILL
|
#ifndef GOBLINKILL
|
||||||
if (oa[i].type.goblin) { /* Goblin-Spezialklau */
|
if (oa[i].type.goblin) { /* Goblin-Spezialklau */
|
||||||
int uct = 0;
|
int uct = 0;
|
||||||
|
@ -2314,7 +2314,7 @@ expandstealing(region * r, request * stealorders)
|
||||||
}
|
}
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
n = min(n, oa[i].unit->wants);
|
n = min(n, oa[i].unit->wants);
|
||||||
use_all(u, r_silver, n);
|
new_use_pooled(u, r_silver, GET_ALL, n);
|
||||||
oa[i].unit->n = n;
|
oa[i].unit->n = n;
|
||||||
change_money(oa[i].unit, n);
|
change_money(oa[i].unit, n);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
|
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
|
||||||
|
@ -2350,7 +2350,7 @@ plant(region *r, unit *u, int raw)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Wasser des Lebens prüfen */
|
/* Wasser des Lebens prüfen */
|
||||||
if (get_pooled(u, r, R_TREES) == 0) {
|
if (new_get_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT) == 0) {
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "resource_missing", "missing",
|
msg_feedback(u, u->thisorder, "resource_missing", "missing",
|
||||||
oldresourcetype[R_TREES]));
|
oldresourcetype[R_TREES]));
|
||||||
|
|
|
@ -2509,7 +2509,7 @@ promotion_cmd(unit * u, struct order * ord)
|
||||||
u->race));
|
u->race));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
money = get_all(u, i_silver->rtype);
|
money = new_get_pooled(u, i_silver->rtype, GET_ALL);
|
||||||
people = count_all(u->faction) * u->number;
|
people = count_all(u->faction) * u->number;
|
||||||
|
|
||||||
if (people>money) {
|
if (people>money) {
|
||||||
|
@ -2517,7 +2517,7 @@ promotion_cmd(unit * u, struct order * ord)
|
||||||
people, money));
|
people, money));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
use_all(u, i_silver->rtype, people);
|
new_use_pooled(u, i_silver->rtype, GET_ALL, people);
|
||||||
fset(u, UFL_HERO);
|
fset(u, UFL_HERO);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("hero_promotion", "unit cost",
|
ADDMSG(&u->faction->msgs, msg_message("hero_promotion", "unit cost",
|
||||||
u, people));
|
u, people));
|
||||||
|
|
|
@ -194,7 +194,7 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
|
||||||
int j = study_cost(student, sk);
|
int j = study_cost(student, sk);
|
||||||
j = max(50, j * 2);
|
j = max(50, j * 2);
|
||||||
/* kann Einheit das zahlen? */
|
/* kann Einheit das zahlen? */
|
||||||
if (get_pooled(student, student->region, R_SILVER) >= j) {
|
if (new_get_pooled(student, oldresourcetype[R_SILVER], GET_DEFAULT) >= j) {
|
||||||
/* Jeder Schüler zusätzlich +10 Tage wenn in Uni. */
|
/* Jeder Schüler zusätzlich +10 Tage wenn in Uni. */
|
||||||
teach->value += (n / 30) * 10; /* learning erhöhen */
|
teach->value += (n / 30) * 10; /* learning erhöhen */
|
||||||
/* Lehrer zusätzlich +1 Tag pro Schüler. */
|
/* Lehrer zusätzlich +1 Tag pro Schüler. */
|
||||||
|
@ -608,7 +608,7 @@ learn(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (studycost) {
|
if (studycost) {
|
||||||
money = get_pooled(u, r, R_SILVER);
|
money = new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT);
|
||||||
money = min(money, studycost * u->number);
|
money = min(money, studycost * u->number);
|
||||||
}
|
}
|
||||||
if (money < studycost * u->number) {
|
if (money < studycost * u->number) {
|
||||||
|
@ -631,7 +631,7 @@ learn(void)
|
||||||
teach->teachers[0] = 0;
|
teach->teachers[0] = 0;
|
||||||
}
|
}
|
||||||
if (money>0) {
|
if (money>0) {
|
||||||
use_pooled(u, r, R_SILVER, money);
|
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, money);
|
||||||
add_message(&u->faction->msgs, msg_message("studycost",
|
add_message(&u->faction->msgs, msg_message("studycost",
|
||||||
"unit region cost skill", u, u->region, money, sk));
|
"unit region cost skill", u, u->region, money, sk));
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,7 @@ build_road(region * r, unit * u, int size, direction_t d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!get_pooled(u, r, R_STONE) && u->race != new_race[RC_STONEGOLEM]) {
|
if (!new_get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT) && u->race != new_race[RC_STONEGOLEM]) {
|
||||||
cmistake(u, u->thisorder, 151, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 151, MSG_PRODUCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ build_road(region * r, unit * u, int size, direction_t d)
|
||||||
if (u->race == new_race[RC_STONEGOLEM]){
|
if (u->race == new_race[RC_STONEGOLEM]){
|
||||||
n = u->number * GOLEM_STONE;
|
n = u->number * GOLEM_STONE;
|
||||||
} else {
|
} else {
|
||||||
n = get_pooled(u, r, R_STONE);
|
n = new_get_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT);
|
||||||
}
|
}
|
||||||
left = min(n, left);
|
left = min(n, left);
|
||||||
if (size>0) left = min(size, 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);
|
scale_number(u, u->number - golemsused);
|
||||||
} else {
|
} else {
|
||||||
use_pooled(u, r, R_STONE, n);
|
new_use_pooled(u, oldresourcetype[R_STONE], GET_DEFAULT, n);
|
||||||
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
||||||
produceexp(u, SK_ROAD_BUILDING, min(n, u->number));
|
produceexp(u, SK_ROAD_BUILDING, min(n, u->number));
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,7 +747,7 @@ use_tacticcrystal(region * r, unit * u, int amount, struct order * ord)
|
||||||
c->data.i = SK_TACTICS;
|
c->data.i = SK_TACTICS;
|
||||||
unused(ord);
|
unused(ord);
|
||||||
}
|
}
|
||||||
use_pooled(u, u->region, R_TACTICCRYSTAL, amount);
|
new_use_pooled(u, oldresourcetype[R_TACTICCRYSTAL], GET_DEFAULT, amount);
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
new_message(u->faction, "use_tacticcrystal%u:unit%r:region", u, r));
|
new_message(u->faction, "use_tacticcrystal%u:unit%r:region", u, r));
|
||||||
return;
|
return;
|
||||||
|
@ -1219,8 +1219,6 @@ init_olditems(void)
|
||||||
con->materials[n].number = itemdata[i].material[m];
|
con->materials[n].number = itemdata[i].material[m];
|
||||||
con->materials[n].recycle = 0.0;
|
con->materials[n].recycle = 0.0;
|
||||||
++n;
|
++n;
|
||||||
if (m==M_EISEN) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ buy_special(unit *u, struct order * ord, fspecial_t special)
|
||||||
|
|
||||||
/* Alles ok, attribut geben */
|
/* Alles ok, attribut geben */
|
||||||
|
|
||||||
if(a2) {
|
if (a2) {
|
||||||
if(a2->data.sa[1] < fspecials[special].maxlevel) {
|
if(a2->data.sa[1] < fspecials[special].maxlevel) {
|
||||||
a2->data.sa[1]++;
|
a2->data.sa[1]++;
|
||||||
add_message(&f->msgs, new_message(f,
|
add_message(&f->msgs, new_message(f,
|
||||||
|
@ -364,7 +364,6 @@ fspecial(const faction *f, fspecial_t special)
|
||||||
static int
|
static int
|
||||||
sacrifice_cmd(unit * u, struct order * ord)
|
sacrifice_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
|
||||||
int n = 1, karma;
|
int n = 1, karma;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
|
@ -382,7 +381,7 @@ sacrifice_cmd(unit * u, struct order * ord)
|
||||||
|
|
||||||
switch(findparam(s, u->faction->locale)) {
|
switch(findparam(s, u->faction->locale)) {
|
||||||
case P_SILVER:
|
case P_SILVER:
|
||||||
n = use_pooled(u, r, R_SILVER, n);
|
n = new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, n);
|
||||||
if(n < 10000) {
|
if(n < 10000) {
|
||||||
cmistake(u, ord, 51, MSG_EVENT);
|
cmistake(u, ord, 51, MSG_EVENT);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -270,64 +270,6 @@ new_use_pooled(unit * u, const resource_type * rtype, int mode, int count)
|
||||||
return count-use;
|
return count-use;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
get_reserved(const unit * u, resource_t resource)
|
|
||||||
{
|
|
||||||
return new_get_pooled(u, oldresourcetype[resource], GET_RESERVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
use_reserved(unit * u, resource_t resource, int count)
|
|
||||||
{
|
|
||||||
return new_use_pooled(u, oldresourcetype[resource], GET_RESERVE, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
get_slack(const unit * u, resource_t resource)
|
|
||||||
{
|
|
||||||
return new_get_pooled(u, oldresourcetype[resource], GET_SLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
use_slack(unit * u, resource_t resource, int count)
|
|
||||||
{
|
|
||||||
return new_use_pooled(u, oldresourcetype[resource], GET_SLACK, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
get_pooled(const unit * u, const region * r, resource_t resource)
|
|
||||||
{
|
|
||||||
return new_get_pooled(u, oldresourcetype[resource], GET_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
use_pooled(unit * u, region * r, resource_t resource, int count)
|
|
||||||
{
|
|
||||||
return new_use_pooled(u, oldresourcetype[resource], GET_DEFAULT, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
use_pooled_give(unit * u, region * r, resource_t resource, int count)
|
|
||||||
{
|
|
||||||
int use = count;
|
|
||||||
use -= new_use_pooled(u, oldresourcetype[resource], GET_SLACK, use);
|
|
||||||
if (use>0) use -= new_use_pooled(u, oldresourcetype[resource], GET_RESERVE|GET_POOLED_SLACK, use);
|
|
||||||
return count-use;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
get_all(const unit * u, const resource_type * rtype)
|
|
||||||
{
|
|
||||||
return new_get_pooled(u, rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
use_all(unit * u, const resource_type * rtype, int count)
|
|
||||||
{
|
|
||||||
return new_use_pooled(u, rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK|GET_POOLED_RESERVE|GET_POOLED_FORCE, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
init_pool(void)
|
init_pool(void)
|
||||||
|
|
|
@ -18,22 +18,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int get_pooled(const struct unit * u, const struct region * r, resource_t itm);
|
|
||||||
int use_pooled(struct unit * u, struct region * r, resource_t itm, int count);
|
|
||||||
int use_pooled_give(struct unit * u, struct region * r, resource_t itm, int count);
|
|
||||||
|
|
||||||
/** use_pooled
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm'
|
|
||||||
* unter zuhilfenahme des Pools der struct region und Aufbrauch des
|
|
||||||
* von der Einheit reservierten Resourcen
|
|
||||||
*
|
|
||||||
* use_pooled_give
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm' wie use_pooled, jedoch
|
|
||||||
* zuerst vom nicht reservierten.
|
|
||||||
* (wichtig bei gib, da sonst beim zweiten GIB des selben Gegenstandes
|
|
||||||
* jede Reservierung gelöscht wird)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* bitfield values for get/use/change operations */
|
/* bitfield values for get/use/change operations */
|
||||||
#define GET_SLACK 0x01
|
#define GET_SLACK 0x01
|
||||||
#define GET_RESERVE 0x02
|
#define GET_RESERVE 0x02
|
||||||
|
@ -46,39 +30,7 @@ int use_pooled_give(struct unit * u, struct region * r, resource_t itm, int coun
|
||||||
|
|
||||||
/* for convenience: */
|
/* for convenience: */
|
||||||
#define GET_DEFAULT (GET_RESERVE|GET_SLACK|GET_POOLED_SLACK)
|
#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)
|
||||||
|
|
||||||
extern int get_all(const struct unit * u, const struct resource_type * rtype);
|
|
||||||
extern int use_all(struct unit * u, const struct resource_type * rtype, int count);
|
|
||||||
|
|
||||||
/** use_all
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm'
|
|
||||||
* unter zuhilfenahme aller Einheiten der struct region
|
|
||||||
*/
|
|
||||||
|
|
||||||
int get_allied(const struct unit * u, struct region * r, resource_t itm);
|
|
||||||
int use_allied(struct unit * u, struct region * r, resource_t itm, int count);
|
|
||||||
|
|
||||||
/** use_allied
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm'
|
|
||||||
* unter zuhilfenahme des alliierten in der struct region
|
|
||||||
*/
|
|
||||||
|
|
||||||
int get_reserved(const struct unit * u, resource_t itm);
|
|
||||||
int use_reserved(struct unit * u, resource_t itm, int count);
|
|
||||||
|
|
||||||
/** use_reserved
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm'
|
|
||||||
* aus den reservierten Objekten der Einheit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int use_slack(struct unit * u, resource_t itm, int count);
|
|
||||||
int get_slack(const struct unit * u, resource_t itm);
|
|
||||||
|
|
||||||
/** use_slack
|
|
||||||
* verbraucht 'count' Objekte der resource 'itm'
|
|
||||||
* aus den nicht-reservierten Objekten der Einheit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int new_get_pooled(const struct unit * u, const struct resource_type * res, int mode);
|
int new_get_pooled(const struct unit * u, const struct resource_type * res, int mode);
|
||||||
int new_use_pooled(struct unit * u, const struct resource_type * res, int mode, int count);
|
int new_use_pooled(struct unit * u, const struct resource_type * res, int mode, int count);
|
||||||
|
|
|
@ -120,7 +120,7 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
|
||||||
if (fee>2000) fee = 2000;
|
if (fee>2000) fee = 2000;
|
||||||
if (getplane(r)==arena) return -1;
|
if (getplane(r)==arena) return -1;
|
||||||
if (u->number!=1 && enter_fail(u)) return -1;
|
if (u->number!=1 && enter_fail(u)) return -1;
|
||||||
if (get_pooled(u, r, R_SILVER) < fee && enter_fail(u)) return -1;
|
if (new_get_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT) < fee && enter_fail(u)) return -1;
|
||||||
for (sk=0;sk!=MAXSKILLS;++sk) {
|
for (sk=0;sk!=MAXSKILLS;++sk) {
|
||||||
if (get_level(u, sk)>1 && enter_fail(u)) return -1;
|
if (get_level(u, sk)>1 && enter_fail(u)) return -1;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ 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));
|
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);
|
addmessage(NULL, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
|
||||||
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE, 1);
|
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE, 1);
|
||||||
use_pooled(u, r, R_SILVER, fee);
|
new_use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, fee);
|
||||||
set_money(u, 109);
|
set_money(u, 109);
|
||||||
fset(u, UFL_PARTEITARNUNG);
|
fset(u, UFL_PARTEITARNUNG);
|
||||||
move_unit(u, start_region[rand() % 6], NULL);
|
move_unit(u, start_region[rand() % 6], NULL);
|
||||||
|
|
Loading…
Reference in New Issue