shithub: choc

Download patch

ref: b42b5269e0ad5b22acd6043429ec4013a4e76ddd
parent: 88b562df34f7843a5146203962c11ce18c6656ce
author: Simon Howard <fraggle@gmail.com>
date: Fri Oct 24 16:14:47 EDT 2014

strife: Allow inventory items > 255.

The 'inventory' field in ticcmd structures can refer to inventory
values greater than the 8-bit range, so this needs to be transferred
over the network as at least a 16-bit value in order to avoid network
desyncs.

This fixes #454 (thanks Quasar).

--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -192,7 +192,7 @@
     if (diff->diff & NET_TICDIFF_STRIFE)
     {
         NET_WriteInt8(packet, diff->cmd.buttons2);
-        NET_WriteInt8(packet, diff->cmd.inventory);
+        NET_WriteInt16(packet, diff->cmd.inventory);
     }
 }
 
@@ -277,7 +277,7 @@
             return false;
         diff->cmd.buttons2 = val;
 
-        if (!NET_ReadInt8(packet, &val))
+        if (!NET_ReadInt16(packet, &val))
             return false;
         diff->cmd.inventory = val;
     }