| 234 | } |
| 235 | |
| 236 | const Tileset::Tile* Tileset::getTile(std::uint32_t id) const |
| 237 | { |
| 238 | if (!hasTile(id)) |
| 239 | { |
| 240 | return nullptr; |
| 241 | } |
| 242 | |
| 243 | //corrects the ID. Indices and IDs are different. |
| 244 | id -= m_firstGID; |
| 245 | id = m_tileIndex[id]; |
| 246 | return id ? &m_tiles[id - 1] : nullptr; |
| 247 | } |
| 248 | |
| 249 | //private |
| 250 | void Tileset::reset() |