* Checks if the given position is inside the map. * * @param position The tile (packed) to check. * @return True if the position is valid. */
| 318 | * @return True if the position is valid. |
| 319 | */ |
| 320 | bool 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). |
no outgoing calls
no test coverage detected