From 4ab609f3960c1a666057b64efe81eb9fe03a3985 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 13 May 2012 15:06:59 +0200 Subject: [PATCH] (Hopefully) fix call to LittleRevBytes in idGameLocal::ServerWriteSnapshot() Makes more sense than before, but TBH I'm not entirely sure what this is supposed to do. --- neo/d3xp/Game_network.cpp | 10 +++++++++- neo/game/Game_network.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/Game_network.cpp b/neo/d3xp/Game_network.cpp index d65be3d9..ab0dc861 100644 --- a/neo/d3xp/Game_network.cpp +++ b/neo/d3xp/Game_network.cpp @@ -702,8 +702,16 @@ void idGameLocal::ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &ms WriteGameStateToSnapshot( deltaMsg ); // copy the client PVS string + // copies 4 bytes (== one int)?! memcpy( clientInPVS, snapshot->pvs, ( numPVSClients + 7 ) >> 3 ); - LittleRevBytes( clientInPVS, sizeof( int ), sizeof( clientInPVS ) / sizeof ( int ) ); + // FIXME: fishy. + // byte clientInPVS[MAX_ASYNC_CLIENTS >> 3]; + // numPVSClients == MAX_ASYNC_CLIENTS + // I think the orig code only "works" because it's a no-op on little endian architectures (like x86) + // orig code: LittleRevBytes( clientInPVS, sizeof( int ), sizeof( clientInPVS ) / sizeof ( int ) ); + // sizeof( clientInPVS ) ?! (== sizeof(size_t)) + // not sure if the replacement is 100% correct, though + LittleRevBytes( clientInPVS, sizeof( int ), (( numPVSClients + 7 ) >> 3) / sizeof ( int ) ); } /* diff --git a/neo/game/Game_network.cpp b/neo/game/Game_network.cpp index 0a1b07a0..8cbda041 100644 --- a/neo/game/Game_network.cpp +++ b/neo/game/Game_network.cpp @@ -688,8 +688,16 @@ void idGameLocal::ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &ms WriteGameStateToSnapshot( deltaMsg ); // copy the client PVS string + // copies 4 bytes (== one int)?! memcpy( clientInPVS, snapshot->pvs, ( numPVSClients + 7 ) >> 3 ); - LittleRevBytes( clientInPVS, sizeof( int ), sizeof( clientInPVS ) / sizeof ( int ) ); + // FIXME: fishy. + // byte clientInPVS[MAX_ASYNC_CLIENTS >> 3]; + // numPVSClients == MAX_ASYNC_CLIENTS + // I think the orig code only "works" because it's a no-op on little endian architectures (like x86) + // orig code: LittleRevBytes( clientInPVS, sizeof( int ), sizeof( clientInPVS ) / sizeof ( int ) ); + // sizeof( clientInPVS ) ?! (== sizeof(size_t)) + // not sure if the replacement is 100% correct, though + LittleRevBytes( clientInPVS, sizeof( int ), (( numPVSClients + 7 ) >> 3) / sizeof ( int ) ); } /*