forked from github/server
- versorgung durch vertraute gefixt - is_monstrous entfernt, und sinnvoll ersetzt.
This commit is contained in:
parent
f413603e0f
commit
4ad249acc6
|
@ -153,7 +153,12 @@ checkorders(void)
|
|||
if (f->no!=MONSTER_FACTION && turn - f->lastorders == NMRTimeout() - 1)
|
||||
ADDMSG(&f->msgs, msg_message("turnreminder", ""));
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
static boolean
|
||||
help_money(const unit * u)
|
||||
{
|
||||
if (u->race->ec_flags & GIVEITEM) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
get_food(region *r)
|
||||
|
@ -176,12 +181,11 @@ get_food(region *r)
|
|||
if (need > 0) {
|
||||
unit *v;
|
||||
|
||||
for (v = r->units; need && v; v = v->next)
|
||||
if (v->faction == u->faction && !is_monstrous(v)) {
|
||||
for (v = r->units; need && v; v = v->next) {
|
||||
if (v->faction == u->faction && help_money(v)) {
|
||||
int give = get_money(v) - lifestyle(v);
|
||||
give = max(0, give);
|
||||
give = min(need, give);
|
||||
if (give) {
|
||||
if (give>0) {
|
||||
change_money(v, -give);
|
||||
change_money(u, give);
|
||||
need -= give;
|
||||
|
@ -189,11 +193,13 @@ get_food(region *r)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 2. Versorgung durch Fremde. Das Silber alliierter Einheiten wird
|
||||
* entsprechend verteilt. */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
int need = lifestyle(u);
|
||||
faction * f = u->faction;
|
||||
|
||||
need -= max(0, get_money(u));
|
||||
|
||||
|
@ -201,13 +207,11 @@ get_food(region *r)
|
|||
unit *v;
|
||||
|
||||
for (v = r->units; need && v; v = v->next) {
|
||||
if (v->faction != u->faction && alliedunit(v, u->faction, HELP_MONEY)
|
||||
&& !is_monstrous(v)) {
|
||||
int give = lifestyle(v);
|
||||
give = max(0, get_money(v) - give);
|
||||
if (v->faction != f && alliedunit(v, f, HELP_MONEY) && help_money(v)) {
|
||||
int give = get_money(v) - lifestyle(v);
|
||||
give = min(need, give);
|
||||
|
||||
if (give) {
|
||||
if (give>0) {
|
||||
change_money(v, -give);
|
||||
change_money(u, give);
|
||||
need -= give;
|
||||
|
@ -288,17 +292,16 @@ get_food(region *r)
|
|||
static void
|
||||
live(region * r)
|
||||
{
|
||||
unit *u, *un;
|
||||
unit **up = &r->units;
|
||||
|
||||
get_food(r);
|
||||
|
||||
for (u = r->units; u; u = un) {
|
||||
while (*up) {
|
||||
unit * u = *up;
|
||||
/* IUW: age_unit() kann u löschen, u->next ist dann
|
||||
* undefiniert, also müssen wir hier schon das nächste
|
||||
* Element bestimmen */
|
||||
un = u->next;
|
||||
|
||||
if (!is_monstrous(u)) {
|
||||
int effect = get_effect(u, oldpotiontype[P_FOOL]);
|
||||
if (effect > 0) { /* Trank "Dumpfbackenbrot" */
|
||||
skill * sv = u->skills, * sb = NULL;
|
||||
|
@ -316,8 +319,8 @@ live(region * r)
|
|||
} /* sonst Glück gehabt: wer nix weiß, kann nix vergessen... */
|
||||
change_effect(u, oldpotiontype[P_FOOL], -effect);
|
||||
}
|
||||
}
|
||||
age_unit(r, u);
|
||||
if (*up==u) up=&u->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2590,7 +2590,7 @@ lifestyle(const unit * u)
|
|||
static plane * astralspace = NULL;
|
||||
int need;
|
||||
|
||||
if(is_monstrous(u)) return 0;
|
||||
if (u->faction->no == MONSTER_FACTION) return 0;
|
||||
|
||||
need = u->number * u->race->maintenance;
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ new_group(faction * f, const char * name, int gid)
|
|||
group ** gp = &f->groups;
|
||||
int index = gid % GMAXHASH;
|
||||
group * g = calloc(sizeof(group), 1);
|
||||
attrib *a;
|
||||
|
||||
while (*gp) gp = &(*gp)->next;
|
||||
*gp = g;
|
||||
|
|
|
@ -1085,12 +1085,6 @@ invisible(const unit *u)
|
|||
#endif
|
||||
}
|
||||
|
||||
boolean
|
||||
is_monstrous(const unit * u)
|
||||
{
|
||||
return (boolean) (u->faction->no == MONSTER_FACTION || !playerrace(u->race));
|
||||
}
|
||||
|
||||
void
|
||||
unitlist_clear(struct unit_list **ul)
|
||||
{
|
||||
|
|
|
@ -192,8 +192,6 @@ extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
|
|||
|
||||
extern int invisible(const unit *u);
|
||||
|
||||
extern boolean is_monstrous(const unit * u);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue