Codechange: make strongtype constructor explicit

This commit is contained in:
Rubidium
2024-12-31 18:18:48 +01:00
committed by rubidium42
parent 98e980c478
commit a22e357911
3 changed files with 7 additions and 4 deletions

View File

@@ -442,6 +442,9 @@ inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
return TileDiffXY(tidc.x, tidc.y);
}
/* Helper functions to provide explicit +=/-= operators for TileIndex and TileIndexDiff. */
constexpr TileIndex &operator+=(TileIndex &tile, TileIndexDiff offset) { tile = tile + TileIndex(offset); return tile; }
constexpr TileIndex &operator-=(TileIndex &tile, TileIndexDiff offset) { tile = tile - TileIndex(offset); return tile; }
/**
* Adds a given offset to a tile.