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

Function Tools_Index_GetUnit

src/tools.c:185–193  ·  view source on GitHub ↗

* Gets the Unit corresponding to the given encoded index. * * @param id The encoded index to get the Unit of. * @return The Unit. */

Source from the content-addressed store, hash-verified

183 * @return The Unit.
184 */
185Unit *Tools_Index_GetUnit(uint16 encoded)
186{
187 uint16 index;
188
189 if (Tools_Index_GetType(encoded) != IT_UNIT) return NULL;
190
191 index = Tools_Index_Decode(encoded);
192 return (index < UNIT_INDEX_MAX) ? Unit_Get_ByIndex(index) : NULL;
193}
194
195/**
196 * Gets the Structure corresponding to the given encoded index.

Callers 13

Map_MakeExplosionFunction · 0.85
GameLoop_UnitFunction · 0.85
Unit_CreateBulletFunction · 0.85
Script_General_IsEnemyFunction · 0.85
Script_Unit_PickupFunction · 0.85
Script_Unit_FireFunction · 0.85
Script_Unit_Unknown2552Function · 0.85
Script_Unit_Unknown2BD5Function · 0.85

Calls 3

Tools_Index_GetTypeFunction · 0.85
Tools_Index_DecodeFunction · 0.85
Unit_Get_ByIndexFunction · 0.85

Tested by

no test coverage detected