Before:
SHK_pos library was included in overthrow codebase at functions/geography/SHK_pos. It included many functions, but the only one used was SHK_pos_fnc_pos, sometimes correctly and sometimes not. It was used for two purposes:
Adding to a position a vector with direction and distance. The direction and distance added could sometimes be random.
This could be replaced with getPos and random commands.
Finding an empty position for spawning a vehicle.
This was already replaced with findEmptyPosition command in a previous PR #59.
After:
SHK_pos library is now removed from the codebase and all remaining usages have been refactored to use getPos and random. Mostly the new code is more readable. The SHK_pos_fnc_pos was a slow function, doing all kinds of unnecessary checks, so the code should also be much faster.
Additionally some bugs were fixed, where the SHK_pos arguments were in wrong order, causing things to happen at wrong positions.
Possible drawbacks:
SHK_pos did some checks that the random position was never on water. This didn't matter much because the position was usually randomized even more in following code, but it is possible to see an increase in troops spawning in water.
In some cases the new code is a bit uglier than before.
Before: SHK_pos library was included in overthrow codebase at
functions/geography/SHK_pos
. It included many functions, but the only one used wasSHK_pos_fnc_pos
, sometimes correctly and sometimes not. It was used for two purposes:getPos
andrandom
commands.findEmptyPosition
command in a previous PR #59.After: SHK_pos library is now removed from the codebase and all remaining usages have been refactored to use
getPos
andrandom
. Mostly the new code is more readable. TheSHK_pos_fnc_pos
was a slow function, doing all kinds of unnecessary checks, so the code should also be much faster.Additionally some bugs were fixed, where the SHK_pos arguments were in wrong order, causing things to happen at wrong positions.
Possible drawbacks:
More info in the commit messages.