2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-01 01:25:38 +03:00

Added some comment.

This commit is contained in:
Lev 2017-02-13 01:34:25 +05:00
parent eb27095f73
commit 9905fc6839

View File

@ -5472,6 +5472,21 @@ void SV_CreateBaseline(void)
* leads to inconsistent behavior (since stack data may contain pointers) across different systems.
*/
/*
* This is true in theory, but in reality things might differs. In Valve's Linux all builds hl.so (and cs.so) expects pointers instead of array elements.
* This looks like a flaw in the compilers or some option, because code specifies to pass a class object which should be passed by a value in that case.
* And this is correctly happen in MSVC, ICC and modern GCC.
* Also, there often will be a metatmod in between that is designed to get and pass pointers.
* So, we have no choice but to pass data but reference so functions that expects references don't crash on dereference
* and append some fake data for the cases when called function will be the one that expects pass by value.
*/
/*
* If you are the mod author, you can correctly receive the data by changing CreateBaseline signature:
* vec3_t player_mins, vec3_t player_maxs
* into
* vec3_t& player_mins, vec3_t& player_maxs
* so after macro expantion it will be the class passed by reference.
*/
/*
* This function call emulates swds.dll behavior, i.e. it sends the same garbage when invoking CreateBaseline as swds.dll does.
* This is required since not emulating this behavior will break rehlds test demos.
*/