rework network message codes + add NETCODE_ACCEPT_MOVE

Mon, 24 Aug 2026 14:38:15 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 24 Aug 2026 14:38:15 +0200
changeset 189
444dfdf790b8
parent 188
bb967c8e51e9
child 190
c90386d55cb2

rework network message codes + add NETCODE_ACCEPT_MOVE

relates to #976

src/main.c file | annotate | diff | comparison | revisions
src/network.h file | annotate | diff | comparison | revisions
--- a/src/main.c	Mon Aug 24 14:31:37 2026 +0200
+++ b/src/main.c	Mon Aug 24 14:38:15 2026 +0200
@@ -671,7 +671,7 @@
                         uint8_t reason;
                         net_recieve_data(opponent, &reason, 1);
                         eval_move_failed_msg(reason);
-                    } else if (code == NETCODE_ACCEPT) {
+                    } else if (code == NETCODE_ACCEPT_MOVE) {
                         format_move(gamestate, &move);
                         apply_move(gamestate, &move);
                         /* switch to waiting, even when the game ended.
@@ -818,7 +818,7 @@
             if (code == VALID_MOVE_SEMANTICS) {
                 format_move(gamestate, &move);
                 apply_move(gamestate, &move);
-                net_send_code(opponent, NETCODE_ACCEPT);
+                net_send_code(opponent, NETCODE_ACCEPT_MOVE);
 
                 /* send a code for ending the game, if required */
                 bool endgame = true;
--- a/src/network.h	Mon Aug 24 14:31:37 2026 +0200
+++ b/src/network.h	Mon Aug 24 14:38:15 2026 +0200
@@ -37,16 +37,17 @@
 extern "C" {
 #endif
     
-#define NETCODE_ACCEPT 0x02
-#define NETCODE_DECLINE 0x04
-#define NETCODE_DECLINE_MOVE 0x05
+#define NETCODE_ACCEPT 0x01
+#define NETCODE_DECLINE 0x02
 #define NETCODE_GAMEINFO 0x10
 #define NETCODE_PGNDATA 0x11
 #define NETCODE_MOVE 0x20
-#define NETCODE_CHECKMATE 0x23
-#define NETCODE_STALEMATE 0x28
-#define NETCODE_NOMATERIAL 0x29
-#define NETCODE_THREEFOLD 0x30
+#define NETCODE_ACCEPT_MOVE 0x21
+#define NETCODE_DECLINE_MOVE 0x22
+#define NETCODE_CHECKMATE 0x30
+#define NETCODE_STALEMATE 0x31
+#define NETCODE_NOMATERIAL 0x32
+#define NETCODE_THREEFOLD 0x33
 #define NETCODE_RESIGN 0x41
 #define NETCODE_REMIS 0x42
 #define NETCODE_TAUNT 0x43

mercurial