Update to 14.0-beta1

This commit is contained in:
dP
2024-02-04 02:18:17 +05:30
parent 79037e2c65
commit 33ef333b57
1325 changed files with 138461 additions and 70983 deletions
+34 -34
View File
@@ -21,7 +21,7 @@
* @param corner A #Corner.
* @return true iff corner is in a valid range.
*/
static inline bool IsValidCorner(Corner corner)
static constexpr inline bool IsValidCorner(Corner corner)
{
return IsInsideMM(corner, 0, CORNER_END);
}
@@ -33,7 +33,7 @@ static inline bool IsValidCorner(Corner corner)
* @param s The given #Slope.
* @return True if the slope is steep, else false.
*/
static inline bool IsSteepSlope(Slope s)
static constexpr inline bool IsSteepSlope(Slope s)
{
return (s & SLOPE_STEEP) != 0;
}
@@ -44,7 +44,7 @@ static inline bool IsSteepSlope(Slope s)
* @param s The given #Slope.
* @return True if the slope is non-continuous, else false.
*/
static inline bool IsHalftileSlope(Slope s)
static constexpr inline bool IsHalftileSlope(Slope s)
{
return (s & SLOPE_HALFTILE) != 0;
}
@@ -57,7 +57,7 @@ static inline bool IsHalftileSlope(Slope s)
* @param s A #Slope.
* @return The slope s without its halftile slope.
*/
static inline Slope RemoveHalftileSlope(Slope s)
static constexpr inline Slope RemoveHalftileSlope(Slope s)
{
return s & ~SLOPE_HALFTILE_MASK;
}
@@ -73,7 +73,7 @@ static inline Slope RemoveHalftileSlope(Slope s)
* @param s The #Slope to get the complement.
* @return a complement Slope of the given slope.
*/
static inline Slope ComplementSlope(Slope s)
inline Slope ComplementSlope(Slope s)
{
assert(!IsSteepSlope(s) && !IsHalftileSlope(s));
return s ^ SLOPE_ELEVATED;
@@ -85,7 +85,7 @@ static inline Slope ComplementSlope(Slope s)
* @param s The #Slope
* @return true iff exactly one corner is raised
*/
static inline bool IsSlopeWithOneCornerRaised(Slope s)
inline bool IsSlopeWithOneCornerRaised(Slope s)
{
return (s == SLOPE_W) || (s == SLOPE_S) || (s == SLOPE_E) || (s == SLOPE_N);
}
@@ -96,7 +96,7 @@ static inline bool IsSlopeWithOneCornerRaised(Slope s)
* @param corner The #Corner.
* @return The #Slope with corner "corner" raised.
*/
static inline Slope SlopeWithOneCornerRaised(Corner corner)
inline Slope SlopeWithOneCornerRaised(Corner corner)
{
assert(IsValidCorner(corner));
return (Slope)(1 << corner);
@@ -110,7 +110,7 @@ static inline Slope SlopeWithOneCornerRaised(Corner corner)
* @param s The #Slope.
* @return true iff the slope has a highest corner.
*/
static inline bool HasSlopeHighestCorner(Slope s)
inline bool HasSlopeHighestCorner(Slope s)
{
s = RemoveHalftileSlope(s);
return IsSteepSlope(s) || IsSlopeWithOneCornerRaised(s);
@@ -123,7 +123,7 @@ static inline bool HasSlopeHighestCorner(Slope s)
* @param s The #Slope.
* @return Highest corner.
*/
static inline Corner GetHighestSlopeCorner(Slope s)
inline Corner GetHighestSlopeCorner(Slope s)
{
switch (RemoveHalftileSlope(s)) {
case SLOPE_W:
@@ -145,7 +145,7 @@ static inline Corner GetHighestSlopeCorner(Slope s)
* @param s The #Slope.
* @return The corner of the leveled halftile.
*/
static inline Corner GetHalftileSlopeCorner(Slope s)
static constexpr inline Corner GetHalftileSlopeCorner(Slope s)
{
assert(IsHalftileSlope(s));
return (Corner)((s >> 6) & 3);
@@ -157,7 +157,7 @@ static inline Corner GetHalftileSlopeCorner(Slope s)
* @param s The #Slope.
* @return Relative height of highest corner.
*/
static inline int GetSlopeMaxZ(Slope s)
static constexpr inline int GetSlopeMaxZ(Slope s)
{
if (s == SLOPE_FLAT) return 0;
if (IsSteepSlope(s)) return 2;
@@ -170,7 +170,7 @@ static inline int GetSlopeMaxZ(Slope s)
* @param s The #Slope.
* @return Relative height of highest corner.
*/
static inline int GetSlopeMaxPixelZ(Slope s)
static constexpr inline int GetSlopeMaxPixelZ(Slope s)
{
return GetSlopeMaxZ(s) * TILE_HEIGHT;
}
@@ -181,7 +181,7 @@ static inline int GetSlopeMaxPixelZ(Slope s)
* @param corner A #Corner.
* @return The opposite corner to "corner".
*/
static inline Corner OppositeCorner(Corner corner)
inline Corner OppositeCorner(Corner corner)
{
return (Corner)(corner ^ 2);
}
@@ -192,7 +192,7 @@ static inline Corner OppositeCorner(Corner corner)
* @param s The #Slope
* @return true iff exactly three corners are raised
*/
static inline bool IsSlopeWithThreeCornersRaised(Slope s)
inline bool IsSlopeWithThreeCornersRaised(Slope s)
{
return !IsHalftileSlope(s) && !IsSteepSlope(s) && IsSlopeWithOneCornerRaised(ComplementSlope(s));
}
@@ -203,7 +203,7 @@ static inline bool IsSlopeWithThreeCornersRaised(Slope s)
* @param corner The #Corner.
* @return The #Slope with all corners but "corner" raised.
*/
static inline Slope SlopeWithThreeCornersRaised(Corner corner)
inline Slope SlopeWithThreeCornersRaised(Corner corner)
{
return ComplementSlope(SlopeWithOneCornerRaised(corner));
}
@@ -214,7 +214,7 @@ static inline Slope SlopeWithThreeCornersRaised(Corner corner)
* @param corner A #Corner.
* @return The steep #Slope with "corner" as highest corner.
*/
static inline Slope SteepSlope(Corner corner)
inline Slope SteepSlope(Corner corner)
{
return SLOPE_STEEP | SlopeWithThreeCornersRaised(OppositeCorner(corner));
}
@@ -225,7 +225,7 @@ static inline Slope SteepSlope(Corner corner)
* @param s The #Slope
* @return true iff the slope is inclined.
*/
static inline bool IsInclinedSlope(Slope s)
inline bool IsInclinedSlope(Slope s)
{
return (s == SLOPE_NW) || (s == SLOPE_SW) || (s == SLOPE_SE) || (s == SLOPE_NE);
}
@@ -236,7 +236,7 @@ static inline bool IsInclinedSlope(Slope s)
* @param s A #Slope
* @return The direction the slope goes up in. Or INVALID_DIAGDIR if the slope is not an inclined slope.
*/
static inline DiagDirection GetInclinedSlopeDirection(Slope s)
inline DiagDirection GetInclinedSlopeDirection(Slope s)
{
switch (s) {
case SLOPE_NE: return DIAGDIR_NE;
@@ -253,7 +253,7 @@ static inline DiagDirection GetInclinedSlopeDirection(Slope s)
* @param dir A #DiagDirection
* @return The #Slope that goes up in direction dir.
*/
static inline Slope InclinedSlope(DiagDirection dir)
inline Slope InclinedSlope(DiagDirection dir)
{
switch (dir) {
case DIAGDIR_NE: return SLOPE_NE;
@@ -271,7 +271,7 @@ static inline Slope InclinedSlope(DiagDirection dir)
* @param corner The #Corner of the halftile.
* @return The #Slope s with the halftile slope added.
*/
static inline Slope HalftileSlope(Slope s, Corner corner)
static constexpr inline Slope HalftileSlope(Slope s, Corner corner)
{
assert(IsValidCorner(corner));
return (Slope)(s | SLOPE_HALFTILE | (corner << 6));
@@ -284,7 +284,7 @@ static inline Slope HalftileSlope(Slope s, Corner corner)
* @param f Maybe a #Foundation.
* @return true iff f is a foundation.
*/
static inline bool IsFoundation(Foundation f)
inline bool IsFoundation(Foundation f)
{
return f != FOUNDATION_NONE;
}
@@ -295,7 +295,7 @@ static inline bool IsFoundation(Foundation f)
* @param f The #Foundation.
* @return true iff f is a leveled foundation.
*/
static inline bool IsLeveledFoundation(Foundation f)
inline bool IsLeveledFoundation(Foundation f)
{
return f == FOUNDATION_LEVELED;
}
@@ -306,7 +306,7 @@ static inline bool IsLeveledFoundation(Foundation f)
* @param f The #Foundation.
* @return true iff f is an inclined foundation.
*/
static inline bool IsInclinedFoundation(Foundation f)
inline bool IsInclinedFoundation(Foundation f)
{
return (f == FOUNDATION_INCLINED_X) || (f == FOUNDATION_INCLINED_Y);
}
@@ -317,7 +317,7 @@ static inline bool IsInclinedFoundation(Foundation f)
* @param f The #Foundation.
* @return true iff f is a non-continuous foundation
*/
static inline bool IsNonContinuousFoundation(Foundation f)
inline bool IsNonContinuousFoundation(Foundation f)
{
return IsInsideMM(f, FOUNDATION_STEEP_BOTH, FOUNDATION_HALFTILE_N + 1);
}
@@ -330,7 +330,7 @@ static inline bool IsNonContinuousFoundation(Foundation f)
* @param f The #Foundation.
* @return The #Corner with track.
*/
static inline Corner GetHalftileFoundationCorner(Foundation f)
inline Corner GetHalftileFoundationCorner(Foundation f)
{
assert(IsInsideMM(f, FOUNDATION_HALFTILE_W, FOUNDATION_HALFTILE_N + 1));
return (Corner)(f - FOUNDATION_HALFTILE_W);
@@ -342,7 +342,7 @@ static inline Corner GetHalftileFoundationCorner(Foundation f)
* @param f The #Foundation.
* @return true iff f is a special rail foundation for single horizontal/vertical track.
*/
static inline bool IsSpecialRailFoundation(Foundation f)
inline bool IsSpecialRailFoundation(Foundation f)
{
return IsInsideMM(f, FOUNDATION_RAIL_W, FOUNDATION_RAIL_N + 1);
}
@@ -353,7 +353,7 @@ static inline bool IsSpecialRailFoundation(Foundation f)
* @param f The #Foundation.
* @return The #Corner with track.
*/
static inline Corner GetRailFoundationCorner(Foundation f)
inline Corner GetRailFoundationCorner(Foundation f)
{
assert(IsSpecialRailFoundation(f));
return (Corner)(f - FOUNDATION_RAIL_W);
@@ -366,7 +366,7 @@ static inline Corner GetRailFoundationCorner(Foundation f)
* @param s The current #Slope.
* @return The needed #Foundation.
*/
static inline Foundation FlatteningFoundation(Slope s)
inline Foundation FlatteningFoundation(Slope s)
{
return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED);
}
@@ -377,7 +377,7 @@ static inline Foundation FlatteningFoundation(Slope s)
* @param axis The #Axis.
* @return The needed #Foundation.
*/
static inline Foundation InclinedFoundation(Axis axis)
inline Foundation InclinedFoundation(Axis axis)
{
return (axis == AXIS_X ? FOUNDATION_INCLINED_X : FOUNDATION_INCLINED_Y);
}
@@ -388,10 +388,10 @@ static inline Foundation InclinedFoundation(Axis axis)
* @param corner The #Corner with the track.
* @return The wanted #Foundation.
*/
static inline Foundation HalftileFoundation(Corner corner)
inline Foundation HalftileFoundation(Corner corner)
{
assert(IsValidCorner(corner));
return (Foundation)(FOUNDATION_HALFTILE_W + corner);
return static_cast<Foundation>(static_cast<uint>(FOUNDATION_HALFTILE_W) + static_cast<uint>(corner));
}
/**
@@ -400,10 +400,10 @@ static inline Foundation HalftileFoundation(Corner corner)
* @param corner The #Corner with the track.
* @return The wanted #Foundation.
*/
static inline Foundation SpecialRailFoundation(Corner corner)
inline Foundation SpecialRailFoundation(Corner corner)
{
assert(IsValidCorner(corner));
return (Foundation)(FOUNDATION_RAIL_W + corner);
return static_cast<Foundation>(static_cast<uint>(FOUNDATION_RAIL_W) + static_cast<uint>(corner));
}
/**
@@ -412,7 +412,7 @@ static inline Foundation SpecialRailFoundation(Corner corner)
* @param s The #Slope to get the offset for.
* @return The sprite offset for this #Slope.
*/
static inline uint SlopeToSpriteOffset(Slope s)
inline uint SlopeToSpriteOffset(Slope s)
{
extern const byte _slope_to_sprite_offset[32];
return _slope_to_sprite_offset[s];