[Commit] rrserver games.5c,1.7,1.8 protocol,1.16,1.17

Keith Packard commit at keithp.com
Fri May 30 14:32:46 PDT 2003


Committed by: keithp

Update of /local/src/CVS/rrserver
In directory home.keithp.com:/tmp/cvs-serv12166

Modified Files:
	games.5c protocol 
Log Message:
Score on MOVE instead of TURN

Index: games.5c
===================================================================
RCS file: /local/src/CVS/rrserver/games.5c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- games.5c	30 May 2003 20:26:07 -0000	1.7
+++ games.5c	30 May 2003 20:32:44 -0000	1.8
@@ -208,10 +208,6 @@
 
 	/* select the next target */
 	void next_target (&Game g) {
-	    /* score */
-	    if (g.active != ClientRef.none && Boards::solved (&g.board))
-		g.active.client.score++;
-
 	    Target  t = g.targets[0];
 	    g.targets = (Target[dim(g.targets)-1]) { [i] = g.targets[i+1] };
 	    g.history = (ObjectLoc[*]) {};
@@ -345,8 +341,18 @@
 	    Array::push (&g.history, src);
 	    Boards::position_robot (&g.board, color, dst.x, dst.y);
 	    game_send (&g, "NOTICE MOVE %d %C %D\n", count (&g), color, dir);
-	    if (Boards::solved (&g.board))
+	    if (g.state != GameState.Solved && Boards::solved (&g.board))
+	    {
+		if (g.active != ClientRef.none)
+		{
+		    /* score */
+		    g.active.client.score++;
+		    game_send (&g, "NOTICE SCORE %s %d\n",
+			       g.active.client.user.username,
+			       g.active.client.score);
+		}
 		set_state (&g, GameState.Solved);
+	    }
 	}
 
 	public bool solved (&Game g) {

Index: protocol
===================================================================
RCS file: /local/src/CVS/rrserver/protocol,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- protocol	30 May 2003 20:26:07 -0000	1.16
+++ protocol	30 May 2003 20:32:44 -0000	1.17
@@ -363,6 +363,10 @@
 
 	Only the active player may move the robots
 
+2.10. Score (game)
+
+	NOTICE SCORE <username> <score>
+
 2.10. Game state change
 
 	NOTICE GAMESTATE <state>




More information about the Commit mailing list