(player_set_nstat): New, factored out of init_nats().

(init_nats): Use it.  No functional change.

(status): Use it.  This sets player->nstat from scratch, not just
MONEY and CAP.
(brea): Don't bother to update player->nstat, status() will.
This commit is contained in:
Markus Armbruster 2007-12-08 19:27:41 +00:00
parent 96b20c90b2
commit 2b5ebf1f3f
4 changed files with 31 additions and 28 deletions

View file

@ -46,7 +46,6 @@
#include "player.h"
#include "proto.h"
#include "prototypes.h"
#include "sect.h"
#include "tel.h"
@ -156,7 +155,6 @@ status(void)
{
struct natstr *natp;
int minute;
struct sctstr sect;
char buf[128];
if (player->state == PS_SHUTDOWN)
@ -172,23 +170,17 @@ status(void)
pr("You just made $%.2f\n", -player->dolcost);
natp->nat_money -= roundavg(player->dolcost);
player->dolcost = 0.0;
if (natp->nat_money < 0 && !player->broke) {
player->broke = 1;
player->nstat &= ~MONEY;
pr("You are now broke; industries are on strike.\n");
} else if (player->broke && natp->nat_money >= 0) {
player->broke = 0;
player->nstat |= MONEY;
pr("You are no longer broke!\n");
}
getsect(natp->nat_xcap, natp->nat_ycap, &sect);
if (influx(natp))
player->nstat &= ~CAP;
else
player->nstat |= CAP;
player_set_nstat(player, natp);
player->ncomstat = player->nstat;
if (player->god)
player->ncomstat |= CAP | MONEY;
time(&player->curup);
minute = (player->curup - player->lasttime) / 60;
if (minute > 0) {