summaryrefslogtreecommitdiff
path: root/src/qcommon/msg.c
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2013-02-01 22:07:52 -0600
committerTim Angus <tim@ngus.net>2013-02-16 21:54:27 +0000
commit0f85a38e7506c15eb5255f664b0c7d1703bc419d (patch)
treecac590fcc014d3957b2819c944d7c490c032eaac /src/qcommon/msg.c
parent8087aac13d690c6400c4333f4b9cddb6cdf1cd22 (diff)
Fix MSG_ReadDeltaKey setting bit 1<<bits often
MSG_ReadDeltaKey would often set 1<<bits, it should never be set. It exceeds the size of what was being read. Worked okay for weapons/forward/right/up as they stored as chars (value would wrap around to correct value, lucky). Angles had the wrong value, not sure if it was causing issues.
Diffstat (limited to 'src/qcommon/msg.c')
-rw-r--r--src/qcommon/msg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qcommon/msg.c b/src/qcommon/msg.c
index b2377f1d..9499864f 100644
--- a/src/qcommon/msg.c
+++ b/src/qcommon/msg.c
@@ -620,7 +620,7 @@ void MSG_WriteDeltaKey( msg_t *msg, int key, int oldV, int newV, int bits ) {
int MSG_ReadDeltaKey( msg_t *msg, int key, int oldV, int bits ) {
if ( MSG_ReadBits( msg, 1 ) ) {
- return MSG_ReadBits( msg, bits ) ^ (key & kbitmask[bits]);
+ return MSG_ReadBits( msg, bits ) ^ (key & kbitmask[ bits - 1 ]);
}
return oldV;
}