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

Function Map_IsValidPosition

src/map.c:320–333  ·  view source on GitHub ↗

* Checks if the given position is inside the map. * * @param position The tile (packed) to check. * @return True if the position is valid. */

Source from the content-addressed store, hash-verified

318 * @return True if the position is valid.
319 */
320bool Map_IsValidPosition(uint16 position)
321{
322 uint16 x, y;
323 const MapInfo *mapInfo;
324
325 if ((position & 0xC000) != 0) return false;
326
327 x = Tile_GetPackedX(position);
328 y = Tile_GetPackedY(position);
329
330 mapInfo = &g_mapInfos[g_scenario.mapScale];
331
332 return (mapInfo->minX <= x && x < (mapInfo->minX + mapInfo->sizeX) && mapInfo->minY <= y && y < (mapInfo->minY + mapInfo->sizeY));
333}
334
335/**
336 * Check if a position is unveiled (the fog is removed).

Callers 12

Scenario_Load_UnitFunction · 0.85
Map_FindLocationTileFunction · 0.85
Map_SearchSpiceFunction · 0.85
Unit_GetTileEnterScoreFunction · 0.85
Tile_RemoveFogInRadiusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected