(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 nstat;
|
||||||
int simulation; /* e.g. budget command */
|
int simulation; /* e.g. budget command */
|
||||||
double dolcost;
|
double dolcost;
|
||||||
int broke;
|
|
||||||
time_t curup; /* when last input was received */
|
time_t curup; /* when last input was received */
|
||||||
int aborted; /* interrupt cookie received? */
|
int aborted; /* interrupt cookie received? */
|
||||||
int eof; /* EOF (cookie or real) received? */
|
int eof; /* EOF (cookie or real) received? */
|
||||||
|
|
|
@ -78,8 +78,7 @@ player_set_nstat(struct player *pl, struct natstr *np)
|
||||||
return pl->nstat;
|
return pl->nstat;
|
||||||
pl->god = np->nat_stat == STAT_GOD;
|
pl->god = np->nat_stat == STAT_GOD;
|
||||||
pl->nstat = nstat[np->nat_stat];
|
pl->nstat = nstat[np->nat_stat];
|
||||||
pl->broke = np->nat_money < 0;
|
if (np->nat_money >= 0)
|
||||||
if (!pl->broke)
|
|
||||||
pl->nstat |= MONEY;
|
pl->nstat |= MONEY;
|
||||||
if (np->nat_stat >= STAT_ACTIVE && !influx(np))
|
if (np->nat_stat >= STAT_ACTIVE && !influx(np))
|
||||||
pl->nstat |= CAP;
|
pl->nstat |= CAP;
|
||||||
|
|
|
@ -154,7 +154,7 @@ static int
|
||||||
status(void)
|
status(void)
|
||||||
{
|
{
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
int minute;
|
int old_nstat, minute;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if (player->state == PS_SHUTDOWN)
|
if (player->state == PS_SHUTDOWN)
|
||||||
|
@ -171,12 +171,12 @@ status(void)
|
||||||
natp->nat_money -= roundavg(player->dolcost);
|
natp->nat_money -= roundavg(player->dolcost);
|
||||||
player->dolcost = 0.0;
|
player->dolcost = 0.0;
|
||||||
|
|
||||||
if (natp->nat_money < 0 && !player->broke) {
|
old_nstat = player->nstat;
|
||||||
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");
|
|
||||||
}
|
|
||||||
player_set_nstat(player, natp);
|
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;
|
player->ncomstat = player->nstat;
|
||||||
if (player->god)
|
if (player->god)
|
||||||
player->ncomstat |= CAP | MONEY;
|
player->ncomstat |= CAP | MONEY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue