(player): Remove member broke.
(player_set_nstat): Don't set it. (status): Check nstat instead of broke and nat_money.
This commit is contained in:
parent
2b5ebf1f3f
commit
f36aa0f89d
3 changed files with 7 additions and 9 deletions
|
@ -75,7 +75,6 @@ struct player {
|
|||
int nstat;
|
||||
int simulation; /* e.g. budget command */
|
||||
double dolcost;
|
||||
int broke;
|
||||
time_t curup; /* when last input was received */
|
||||
int aborted; /* interrupt cookie received? */
|
||||
int eof; /* EOF (cookie or real) received? */
|
||||
|
|
|
@ -78,8 +78,7 @@ player_set_nstat(struct player *pl, struct natstr *np)
|
|||
return pl->nstat;
|
||||
pl->god = np->nat_stat == STAT_GOD;
|
||||
pl->nstat = nstat[np->nat_stat];
|
||||
pl->broke = np->nat_money < 0;
|
||||
if (!pl->broke)
|
||||
if (np->nat_money >= 0)
|
||||
pl->nstat |= MONEY;
|
||||
if (np->nat_stat >= STAT_ACTIVE && !influx(np))
|
||||
pl->nstat |= CAP;
|
||||
|
|
|
@ -154,7 +154,7 @@ static int
|
|||
status(void)
|
||||
{
|
||||
struct natstr *natp;
|
||||
int minute;
|
||||
int old_nstat, minute;
|
||||
char buf[128];
|
||||
|
||||
if (player->state == PS_SHUTDOWN)
|
||||
|
@ -171,12 +171,12 @@ status(void)
|
|||
natp->nat_money -= roundavg(player->dolcost);
|
||||
player->dolcost = 0.0;
|
||||
|
||||
if (natp->nat_money < 0 && !player->broke) {
|
||||
pr("You are now broke; industries are on strike.\n");
|
||||
} else if (player->broke && natp->nat_money >= 0) {
|
||||
pr("You are no longer broke!\n");
|
||||
}
|
||||
old_nstat = player->nstat;
|
||||
player_set_nstat(player, natp);
|
||||
if ((old_nstat & MONEY) && !(player->nstat & MONEY))
|
||||
pr("You are now broke; industries are on strike.\n");
|
||||
if (!(old_nstat & MONEY) && (player->nstat & MONEY))
|
||||
pr("You are no longer broke!\n");
|
||||
player->ncomstat = player->nstat;
|
||||
if (player->god)
|
||||
player->ncomstat |= CAP | MONEY;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue