]> git.pond.sub.org Git - empserver/commitdiff
Do not update player's bank balance when the change is zero
authorRon Koenderink <rkoenderink@yahoo.ca>
Sat, 13 Sep 2008 23:33:24 +0000 (17:33 -0600)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sat, 13 Sep 2008 23:33:24 +0000 (17:33 -0600)
Hackish work around for a race condition in the nightly build's
regression tests: sometimes the update starts right after the
force command yields, sometimes a bit later.  If it is late, we
use one random number here, for the bye, and throwing off the
random sequence.

src/lib/player/player.c

index b4b9367169f0d32b7f0c2fe3beb5931fba2c01d6..e5facc28d6cba62efdd95b4d7facc6a6b7395df9 100644 (file)
@@ -165,8 +165,17 @@ status(void)
        pr("That just cost you $%.2f\n", player->dolcost);
     else if (player->dolcost < -100.0)
        pr("You just made $%.2f\n", -player->dolcost);
-    natp->nat_money -= roundavg(player->dolcost);
-    player->dolcost = 0.0;
+    if (player->dolcost != 0.0) {\r
+       /*\r
+        * Hackish work around for a race condition in the nightly\r
+        * build's regression tests: sometimes the update starts right\r
+        * after the force command yields, sometimes a bit later.  If\r
+        * it is late, we use one random number here, for the bye,\r
+        * and throwing off the random sequence.\r
+        */\r
+       natp->nat_money -= roundavg(player->dolcost);\r
+       player->dolcost = 0.0;\r
+    }\r
 
     old_nstat = player->nstat;
     player_set_nstat(player, natp);