class_name AdtTileCoordinate
extends RefCounted

## Immutable indices from an ADT filename `Map_tileX_tileY.adt`.
## Both axes use the inclusive range 0..63 for a normal WotLK world map.

const MINIMUM_TILE_INDEX: int = 0
const MAXIMUM_TILE_INDEX: int = 63

var tile_x: int:
	get:
		return _tile_x

var tile_y: int:
	get:
		return _tile_y

var _tile_x: int
var _tile_y: int


## Creates file indices without clamping so out-of-map input remains diagnosable.
func _init(tile_x_value: int, tile_y_value: int) -> void:
	_tile_x = tile_x_value
	_tile_y = tile_y_value


## Returns whether both file indices address the standard 64 by 64 ADT grid.
func is_within_map_grid() -> bool:
	return (
		_tile_x >= MINIMUM_TILE_INDEX
		and _tile_x <= MAXIMUM_TILE_INDEX
		and _tile_y >= MINIMUM_TILE_INDEX
		and _tile_y <= MAXIMUM_TILE_INDEX
	)
