diff --git a/neo/d3xp/Game_network.cpp b/neo/d3xp/Game_network.cpp index 36d799ee..4964aab3 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 c26d9068..8a213211 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 ) ); } /*