Show treasury status on EOF, quit, shutdown
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 28 Jan 2012 14:34:25 +0000 (15:34 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 20 Feb 2012 06:43:23 +0000 (07:43 +0100)
status() informs the player of non-trivial command costs and earnings,
and when he goes broke or becomes solvent.  However, this is skipped
when the command gets aborted by the player signalling EOF, or by
server shutdown, and after a quit command.

Fix by moving the check for EOF or shutdown down to the may_play_now()
check.

This looks a bit like it would also fix charging of play time.  But
that's not broken, because player_main() charges, too.

src/lib/player/player.c

index 6d8571d8a28679c6a64c29e47cf2a70b2ceed643..c770c55388ae646f2c19df4043ad729d715bcc1b 100644 (file)
@@ -145,8 +145,6 @@ status(void)
     int old_nstat;
     char buf[128];
 
-    if (player->eof || player->state == PS_SHUTDOWN)
-       return 0;
     natp = getnatp(player->cnum);
     if (player->dolcost > 100.0)
        pr("That just cost you $%.2f\n", player->dolcost);
@@ -173,8 +171,10 @@ status(void)
 
     time(&player->curup);
     update_timeused(player->curup);
-    if (!may_play_now(natp, player->curup))
+    if (player->eof || player->state == PS_SHUTDOWN
+       || !may_play_now(natp, player->curup))
        return 0;
+
     if (player->btused) {
        natp->nat_btu -= player->btused;
        player->btused = 0;