* Get the object on the given packed tile. * @param packed The packed tile to get the object from. * @return The object. */
| 94 | * @return The object. |
| 95 | */ |
| 96 | Object *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. |
no test coverage detected