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

Function Object_GetByPackedTile

src/object.c:96–106  ·  view source on GitHub ↗

* Get the object on the given packed tile. * @param packed The packed tile to get the object from. * @return The object. */

Source from the content-addressed store, hash-verified

94 * @return The object.
95 */
96Object *Object_GetByPackedTile(uint16 packed)
97{
98 Tile* t;
99
100 if (Tile_IsOutOfMap(packed)) return NULL;
101
102 t = &g_map[packed];
103 if (t->hasUnit) return &Unit_Get_ByIndex(t->index - 1)->o;
104 if (t->hasStructure) return &Structure_Get_ByIndex(t->index - 1)->o;
105 return NULL;
106}
107
108/**
109 * Gets the distance from the given object to the given encoded index.

Callers 8

Map_FindLocationTileFunction · 0.85
GameLoop_UnitFunction · 0.85
Unit_UpdateMapFunction · 0.85
Script_Team_Unknown0788Function · 0.85
Script_Unit_FireFunction · 0.85
GUI_Widget_Name_ClickFunction · 0.85

Calls 2

Unit_Get_ByIndexFunction · 0.85
Structure_Get_ByIndexFunction · 0.85

Tested by

no test coverage detected