forked from github/server
paused units have no weekly maintenance cost.
This commit is contained in:
parent
e5b4d925c6
commit
bed6cdff58
3 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
int lifestyle(const unit * u)
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue