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);
|
struct faction *get_or_create_monsters(void);
|
||||||
void save_special_items(struct unit *u);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1789,8 +1789,12 @@ bool has_horses(const unit * u)
|
||||||
#define MAINTENANCE 10
|
#define MAINTENANCE 10
|
||||||
int maintenance_cost(const struct unit *u)
|
int maintenance_cost(const struct unit *u)
|
||||||
{
|
{
|
||||||
if (u == NULL)
|
if (u == NULL) {
|
||||||
return MAINTENANCE;
|
return MAINTENANCE;
|
||||||
|
}
|
||||||
|
if (is_paused(u->faction)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return u_race(u)->maintenance * u->number;
|
return u_race(u)->maintenance * u->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,14 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
int lifestyle(const unit * u)
|
int lifestyle(const unit *u)
|
||||||
{
|
{
|
||||||
int need;
|
int need;
|
||||||
plane *pl;
|
plane *pl;
|
||||||
|
|
||||||
if (is_monsters(u->faction))
|
if (is_monsters(u->faction)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
need = maintenance_cost(u);
|
need = maintenance_cost(u);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue