MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_General_GetDistanceToObject

Function Script_General_GetDistanceToObject

src/script/general.c:162–171  ·  view source on GitHub ↗

* Get the distance from the current unit/structure to the unit/structure. * * Stack: 1 - An encoded unit/structure index. * * @param script The script engine to operate on. * @return Distance to it, where distance is (longest(x,y) + shortest(x,y) / 2). */

Source from the content-addressed store, hash-verified

160 * @return Distance to it, where distance is (longest(x,y) + shortest(x,y) / 2).
161 */
162uint16 Script_General_GetDistanceToObject(ScriptEngine *script)
163{
164 uint16 index;
165
166 index = STACK_PEEK(1);
167
168 if (!Tools_Index_IsValid(index)) return 0xFFFF;
169
170 return Object_GetDistanceToEncoded(g_scriptCurrentObject, index);
171}
172
173/**
174 * Unknown function 0288.

Callers

nothing calls this directly

Calls 2

Tools_Index_IsValidFunction · 0.85

Tested by

no test coverage detected