paused units have no weekly maintenance cost.

This commit is contained in:
Enno Rehling 2021-05-20 21:09:45 +02:00
parent e5b4d925c6
commit bed6cdff58
3 changed files with 10 additions and 4 deletions

View File

@ -163,7 +163,8 @@ extern "C" {
struct faction *get_or_create_monsters(void);
void save_special_items(struct unit *u);
#define is_monsters(f) (f->no==MONSTER_ID)
#define is_monsters(f) ((f)->no==MONSTER_ID)
#define is_paused(f) ((f)->flags & FFL_PAUSED)
#ifdef __cplusplus
}

View File

@ -1789,8 +1789,12 @@ bool has_horses(const unit * u)
#define MAINTENANCE 10
int maintenance_cost(const struct unit *u)
{
if (u == NULL)
if (u == NULL) {
return MAINTENANCE;
}
if (is_paused(u->faction)) {
return 0;
}
return u_race(u)->maintenance * u->number;
}

View File

@ -28,8 +28,9 @@ int lifestyle(const unit * u)
int need;
plane *pl;
if (is_monsters(u->faction))
if (is_monsters(u->faction)) {
return 0;
}
need = maintenance_cost(u);