(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.
This commit is contained in:
Daniel Gibson 2012-05-13 15:06:59 +02:00
parent 9d5ac74a28
commit 4ab609f396
2 changed files with 18 additions and 2 deletions

View file

@ -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 ) );
}
/*

View file

@ -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 ) );
}
/*