Merge branch 'master' into jgrpp-beta

# Conflicts:
#	.github/workflows/ci-build.yml
#	src/lang/german.txt
#	src/lang/romanian.txt
#	src/lang/slovak.txt
#	src/lang/turkish.txt
#	src/network/core/address.cpp
#	src/network/core/tcp.h
#	src/network/core/udp.cpp
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/saveload/newgrf_sl.cpp
#	src/tree_cmd.cpp
#	src/video/video_driver.hpp
#	src/window.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2021-09-22 21:49:32 +01:00
76 changed files with 1226 additions and 617 deletions

View File

@@ -15,6 +15,9 @@
#include "map_func.h"
#include <tuple>
template<uint N> class OrthogonalTileIteratorStep;
using OrthogonalTileIterator = class OrthogonalTileIteratorStep<1>;
/** Represents the covered area of e.g. a rail station */
struct OrthogonalTileArea {
TileIndex tile; ///< The base tile of the area
@@ -66,6 +69,10 @@ struct OrthogonalTileArea {
{
return std::tie(tile, w, h) == std::tie(other.tile, other.w, other.h);
}
OrthogonalTileIterator begin() const;
OrthogonalTileIterator end() const;
};
/** Represents a diagonal tile area. */
@@ -131,6 +138,15 @@ public:
return this->tile;
}
/**
* Get the tile we are currently at.
* @return The tile we are at, or INVALID_TILE when we're done.
*/
inline TileIndex operator *() const
{
return this->tile;
}
/**
* Move ourselves to the next tile in the rectangle on the map.
*/
@@ -193,8 +209,6 @@ public:
}
};
using OrthogonalTileIterator = OrthogonalTileIteratorStep<1>;
/** Iterator to iterate over a tile area (rectangle) of the map.
* It prefetches tiles once per row.
*/
@@ -293,14 +307,4 @@ public:
}
};
/**
* A loop which iterates over the tiles of a TileArea.
* @param var The name of the variable which contains the current tile.
* This variable will be allocated in this \c for of this loop.
* @param ta The tile area to search over.
*/
#define TILE_AREA_LOOP(var, ta) for (OrthogonalTileIterator var(ta); var != INVALID_TILE; ++var)
#define TILE_AREA_LOOP_STEP(var, ta, N) for (OrthogonalTileIteratorStep<N> var(ta); var != INVALID_TILE; ++var)
#define TILE_AREA_LOOP_WITH_PREFETCH(var, ta) for (OrthogonalPrefetchTileIterator var(ta); var != INVALID_TILE; ++var)
#endif /* TILEAREA_TYPE_H */