20.05.2018, 21:20
Need help on optimizing this code which used for pos compensation.
AFAIK, the usage of floatsqroot/floatpower is very inefficient. Would be grateful if anyone could help me on optimizing this code because based on my profiler results, "operator<(Float:,Float" is 28.42% (the highest) which gives a huge impact on my script performance.
Код:
static Float:TP_GetDistanceFromAwaiting(playerid) { new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid, pX, pY, pZ); return (floatsqroot(floatpower(pX - TP_AwaitingPos[playerid][0], 2.0) + floatpower(pY - TP_AwaitingPos[playerid][1], 2.0) + floatpower(pZ - TP_AwaitingPos[playerid][2], 2.0))); }