Codechange: make use of Tile in for all direct map accesses

This commit is contained in:
Rubidium
2023-01-21 16:40:28 +01:00
committed by rubidium42
parent 7a6452d3ef
commit 580d0a6343
30 changed files with 963 additions and 946 deletions

View File

@@ -49,6 +49,12 @@ public:
*/
debug_inline Tile(TileIndex tile) : tile(tile) {}
/**
* Create the tile wrapper for the given tile.
* @param tile The tile to access the map for.
*/
Tile(uint tile) : tile(tile) {}
/**
* Implicit conversion to the TileIndex.
*/
@@ -189,16 +195,16 @@ private:
* Iterator to iterate all Tiles
*/
struct Iterator {
typedef TileIndex value_type;
typedef TileIndex *pointer;
typedef TileIndex &reference;
typedef Tile value_type;
typedef Tile *pointer;
typedef Tile &reference;
typedef size_t difference_type;
typedef std::forward_iterator_tag iterator_category;
explicit Iterator(TileIndex index) : index(index) {}
bool operator==(const Iterator &other) const { return this->index == other.index; }
bool operator!=(const Iterator &other) const { return !(*this == other); }
TileIndex operator*() const { return this->index; }
Tile operator*() const { return this->index; }
Iterator & operator++() { this->index++; return *this; }
private:
TileIndex index;