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

Function Script_Unit_GetTargetPriority

src/script/unit.c:96–113  ·  view source on GitHub ↗

* Get the priority a target has for the current unit. * * Stack: 1 - The encoded target. * * @param script The script engine to operate on. * @return The priority of the target. */

Source from the content-addressed store, hash-verified

94 * @return The priority of the target.
95 */
96uint16 Script_Unit_GetTargetPriority(ScriptEngine *script)
97{
98 Unit *u;
99 Unit *target;
100 Structure *s;
101 uint16 encoded;
102
103 u = g_scriptCurrentUnit;
104 encoded = STACK_PEEK(1);
105
106 target = Tools_Index_GetUnit(encoded);
107 if (target != NULL) return Unit_GetTargetUnitPriority(u, target);
108
109 s = Tools_Index_GetStructure(encoded);
110 if (s == NULL) return 0;
111
112 return Unit_GetTargetStructurePriority(u, s);
113}
114
115/**
116 * Delivery of transport, either to structure or to a tile.

Callers

nothing calls this directly

Calls 4

Tools_Index_GetUnitFunction · 0.85
Tools_Index_GetStructureFunction · 0.85

Tested by

no test coverage detected