update betting information just before writting it out
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 13 May 1983 14:35:19 +0000 (06:35 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 13 May 1983 14:35:19 +0000 (06:35 -0800)
SCCS-vsn: games/canfield/canfield/canfield.c 4.7

usr/src/games/canfield/canfield/canfield.c

index d7d7050..778f037 100644 (file)
@@ -989,12 +989,6 @@ updatebettinginfo()
        time_t now;
        register long dollars;
 
        time_t now;
        register long dollars;
 
-       thiscosts = this.hand + this.inspection + this.game +
-               this.runs + this.information + this.thinktime;
-       totalcosts = total.hand + total.inspection + total.game +
-               total.runs + total.information + total.thinktime;
-       this.worth = this.wins - thiscosts;
-       total.worth = total.wins - totalcosts;
        time(&now);
        dollars = (now - acctstart) / secondsperdollar;
        if (dollars > 0) {
        time(&now);
        dollars = (now - acctstart) / secondsperdollar;
        if (dollars > 0) {
@@ -1002,6 +996,12 @@ updatebettinginfo()
                total.thinktime += dollars;
                acctstart += dollars * secondsperdollar;
        }
                total.thinktime += dollars;
                acctstart += dollars * secondsperdollar;
        }
+       thiscosts = this.hand + this.inspection + this.game +
+               this.runs + this.information + this.thinktime;
+       totalcosts = total.hand + total.inspection + total.game +
+               total.runs + total.information + total.thinktime;
+       this.worth = this.wins - thiscosts;
+       total.worth = total.wins - totalcosts;
        if (status != BETTINGBOX)
                return;
        move(tboxrow + 3, boxcol + 13);
        if (status != BETTINGBOX)
                return;
        move(tboxrow + 3, boxcol + 13);
@@ -1562,6 +1562,8 @@ cleanup()
 {
 
        total.thinktime += 1;
 {
 
        total.thinktime += 1;
+       status = NOBOX;
+       updatebettinginfo();
        if (dbfd != -1) {
                write(dbfd, (char *)&total, sizeof(total));
                close(dbfd);
        if (dbfd != -1) {
                write(dbfd, (char *)&total, sizeof(total));
                close(dbfd);