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

Function Script_General_IsFriendly

src/script/general.c:346–361  ·  view source on GitHub ↗

* Check if a Unit/Structure is a friend. * * Stack: 1 - An encoded index. * * @param script The script engine to operate on. * @return Either 1 (friendly) or -1 (enemy). */

Source from the content-addressed store, hash-verified

344 * @return Either 1 (friendly) or -1 (enemy).
345 */
346uint16 Script_General_IsFriendly(ScriptEngine *script)
347{
348 uint16 index;
349 Object *o;
350 uint16 res;
351
352 index = STACK_PEEK(1);
353
354 o = Tools_Index_GetObject(index);
355
356 if (o == NULL || o->flags.s.isNotOnMap || !o->flags.s.used) return 0;
357
358 res = Script_General_IsEnemy(script);
359
360 return (res == 0) ? 1 : -1;
361}
362
363/**
364 * Check if a Unit/Structure is an enemy.

Callers

nothing calls this directly

Calls 2

Tools_Index_GetObjectFunction · 0.85
Script_General_IsEnemyFunction · 0.85

Tested by

no test coverage detected