Prevent tile_index and tile_id to overflow on large maps

Fixes incorrect passable checks (e.g. Forest in Hero's Realm)