MapData.getTileset

Fetch the tileset containing the tile a given GID. Throws if the gid is out of range for all tilesets

  1. auto getTileset(string name)
  2. auto getTileset(TiledGid gid)
    struct MapData
    getTileset

Parameters

gid TiledGid

gid of tile to find tileset for

Return Value

Type: auto

Tileset containing the given gid

Examples

MapData map;
map.tilesets ~= TilesetData();
map.tilesets[0].firstGid = 1;
map.tilesets ~= TilesetData();
map.tilesets[1].firstGid = 5;
map.tilesets ~= TilesetData();
map.tilesets[2].firstGid = 12;

assert(map.getTileset(1) == map.tilesets[0]);
assert(map.getTileset(3) == map.tilesets[0]);
assert(map.getTileset(5) == map.tilesets[1]);
assert(map.getTileset(9) == map.tilesets[1]);
assert(map.getTileset(15) == map.tilesets[2]);

Meta