Merge branch 'master' into jgrpp
# Conflicts: # src/3rdparty/squirrel/include/squirrel.h # src/blitter/32bpp_sse_func.hpp # src/bridge_map.h # src/clear_map.h # src/company_manager_face.h # src/console_func.h # src/core/bitmath_func.hpp # src/core/endian_func.hpp # src/core/random_func.hpp # src/depot_map.h # src/elrail_func.h # src/fontcache.h # src/industry_map.h # src/map_func.h # src/newgrf_spritegroup.h # src/object_map.h # src/rail.h # src/rail_map.h # src/road_func.h # src/road_map.h # src/saveload/saveload.h # src/saveload/saveload_error.hpp # src/settings_gui.cpp # src/sl/oldloader.h # src/sprite.h # src/spritecache.h # src/station_func.h # src/station_map.h # src/story_base.h # src/strings_func.h # src/tile_cmd.h # src/tile_map.h # src/tile_type.h # src/town.h # src/town_map.h # src/tree_map.h # src/tunnel_map.h # src/tunnelbridge_map.h # src/vehicle_func.h # src/viewport_func.h # src/void_map.h # src/water.h # src/water_map.h # src/widget_type.h
This commit is contained in:
4
src/3rdparty/squirrel/include/squirrel.h
vendored
4
src/3rdparty/squirrel/include/squirrel.h
vendored
@@ -238,7 +238,7 @@ void sq_newclosure(HSQUIRRELVM v,SQFUNCTION func,SQUnsignedInteger nfreevars);
|
|||||||
SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask);
|
SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask);
|
||||||
SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx);
|
SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx);
|
||||||
void sq_pushstring(HSQUIRRELVM v,const SQChar *s,SQInteger len);
|
void sq_pushstring(HSQUIRRELVM v,const SQChar *s,SQInteger len);
|
||||||
static inline void sq_pushstring(HSQUIRRELVM v, const std::string &str, SQInteger len = -1) { sq_pushstring(v, str.c_str(), len == -1 ? str.size() : len); }
|
inline void sq_pushstring(HSQUIRRELVM v, const std::string &str, SQInteger len = -1) { sq_pushstring(v, str.c_str(), len == -1 ? str.size() : len); }
|
||||||
void sq_pushfloat(HSQUIRRELVM v,SQFloat f);
|
void sq_pushfloat(HSQUIRRELVM v,SQFloat f);
|
||||||
void sq_pushinteger(HSQUIRRELVM v,SQInteger n);
|
void sq_pushinteger(HSQUIRRELVM v,SQInteger n);
|
||||||
void sq_pushbool(HSQUIRRELVM v,SQBool b);
|
void sq_pushbool(HSQUIRRELVM v,SQBool b);
|
||||||
@@ -308,7 +308,7 @@ SQRESULT sq_resume(HSQUIRRELVM v,SQBool retval,SQBool raiseerror);
|
|||||||
const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedInteger idx);
|
const SQChar *sq_getlocal(HSQUIRRELVM v,SQUnsignedInteger level,SQUnsignedInteger idx);
|
||||||
const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval);
|
const SQChar *sq_getfreevariable(HSQUIRRELVM v,SQInteger idx,SQUnsignedInteger nval);
|
||||||
SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err, SQInteger len = -1);
|
SQRESULT sq_throwerror(HSQUIRRELVM v,const SQChar *err, SQInteger len = -1);
|
||||||
static inline SQRESULT sq_throwerror(HSQUIRRELVM v, const std::string_view err) { return sq_throwerror(v, err.data(), err.size()); }
|
inline SQRESULT sq_throwerror(HSQUIRRELVM v, const std::string_view err) { return sq_throwerror(v, err.data(), err.size()); }
|
||||||
void sq_reseterror(HSQUIRRELVM v);
|
void sq_reseterror(HSQUIRRELVM v);
|
||||||
void sq_getlasterror(HSQUIRRELVM v);
|
void sq_getlasterror(HSQUIRRELVM v);
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, Group
|
|||||||
* Remove all engine replacement settings for the given company.
|
* Remove all engine replacement settings for the given company.
|
||||||
* @param c the company.
|
* @param c the company.
|
||||||
*/
|
*/
|
||||||
static inline void RemoveAllEngineReplacementForCompany(Company *c)
|
inline void RemoveAllEngineReplacementForCompany(Company *c)
|
||||||
{
|
{
|
||||||
RemoveAllEngineReplacement(&c->engine_renew_list);
|
RemoveAllEngineReplacement(&c->engine_renew_list);
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ static inline void RemoveAllEngineReplacementForCompany(Company *c)
|
|||||||
* @return The engine type to replace with, or INVALID_ENGINE if no
|
* @return The engine type to replace with, or INVALID_ENGINE if no
|
||||||
* replacement is in the list.
|
* replacement is in the list.
|
||||||
*/
|
*/
|
||||||
static inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group, bool *replace_when_old = nullptr)
|
inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group, bool *replace_when_old = nullptr)
|
||||||
{
|
{
|
||||||
return EngineReplacement(c->engine_renew_list, engine, group, replace_when_old);
|
return EngineReplacement(c->engine_renew_list, engine, group, replace_when_old);
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ static inline EngineID EngineReplacementForCompany(const Company *c, EngineID en
|
|||||||
* @param group The group related to this replacement.
|
* @param group The group related to this replacement.
|
||||||
* @return true if a replacement was set up, false otherwise.
|
* @return true if a replacement was set up, false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool EngineHasReplacementForCompany(const Company *c, EngineID engine, GroupID group)
|
inline bool EngineHasReplacementForCompany(const Company *c, EngineID engine, GroupID group)
|
||||||
{
|
{
|
||||||
return EngineReplacementForCompany(c, engine, group) != INVALID_ENGINE;
|
return EngineReplacementForCompany(c, engine, group) != INVALID_ENGINE;
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ static inline bool EngineHasReplacementForCompany(const Company *c, EngineID eng
|
|||||||
* @param group The group related to this replacement.
|
* @param group The group related to this replacement.
|
||||||
* @return True if a replacement when old was set up, false otherwise.
|
* @return True if a replacement when old was set up, false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool EngineHasReplacementWhenOldForCompany(const Company *c, EngineID engine, GroupID group)
|
inline bool EngineHasReplacementWhenOldForCompany(const Company *c, EngineID engine, GroupID group)
|
||||||
{
|
{
|
||||||
bool replace_when_old;
|
bool replace_when_old;
|
||||||
EngineReplacement(c->engine_renew_list, engine, group, &replace_when_old);
|
EngineReplacement(c->engine_renew_list, engine, group, &replace_when_old);
|
||||||
@@ -77,7 +77,7 @@ static inline bool EngineHasReplacementWhenOldForCompany(const Company *c, Engin
|
|||||||
* @param flags The calling command flags.
|
* @param flags The calling command flags.
|
||||||
* @return 0 on success, CMD_ERROR on failure.
|
* @return 0 on success, CMD_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, bool replace_when_old, DoCommandFlag flags)
|
inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, bool replace_when_old, DoCommandFlag flags)
|
||||||
{
|
{
|
||||||
return AddEngineReplacement(&c->engine_renew_list, old_engine, new_engine, group, replace_when_old, flags);
|
return AddEngineReplacement(&c->engine_renew_list, old_engine, new_engine, group, replace_when_old, flags);
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID ol
|
|||||||
* @param flags The calling command flags.
|
* @param flags The calling command flags.
|
||||||
* @return 0 on success, CMD_ERROR on failure.
|
* @return 0 on success, CMD_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
static inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, DoCommandFlag flags)
|
inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, DoCommandFlag flags)
|
||||||
{
|
{
|
||||||
return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags);
|
return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags);
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
* @param entrance Entrance edge.
|
* @param entrance Entrance edge.
|
||||||
* @return true iff terraforming is allowed.
|
* @return true iff terraforming is allowed.
|
||||||
*/
|
*/
|
||||||
static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
|
inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
|
||||||
{
|
{
|
||||||
if (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new)) return false;
|
if (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new)) return false;
|
||||||
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new));
|
return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new));
|
||||||
@@ -41,7 +41,7 @@ static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slop
|
|||||||
*
|
*
|
||||||
* @return true iff autoslope is enabled.
|
* @return true iff autoslope is enabled.
|
||||||
*/
|
*/
|
||||||
static inline bool AutoslopeEnabled()
|
inline bool AutoslopeEnabled()
|
||||||
{
|
{
|
||||||
return (_settings_game.construction.autoslope &&
|
return (_settings_game.construction.autoslope &&
|
||||||
(_current_company < MAX_COMPANIES ||
|
(_current_company < MAX_COMPANIES ||
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#ifdef WITH_SSE
|
#ifdef WITH_SSE
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline void InsertFirstUint32(const uint32 value, __m128i &into)
|
inline void InsertFirstUint32(const uint32_t value, __m128i &into)
|
||||||
{
|
{
|
||||||
#if (SSE_VERSION >= 4)
|
#if (SSE_VERSION >= 4)
|
||||||
into = _mm_insert_epi32(into, value, 0);
|
into = _mm_insert_epi32(into, value, 0);
|
||||||
@@ -24,7 +24,7 @@ static inline void InsertFirstUint32(const uint32 value, __m128i &into)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline void InsertSecondUint32(const uint32 value, __m128i &into)
|
inline void InsertSecondUint32(const uint32_t value, __m128i &into)
|
||||||
{
|
{
|
||||||
#if (SSE_VERSION >= 4)
|
#if (SSE_VERSION >= 4)
|
||||||
into = _mm_insert_epi32(into, value, 1);
|
into = _mm_insert_epi32(into, value, 1);
|
||||||
@@ -35,7 +35,7 @@ static inline void InsertSecondUint32(const uint32 value, __m128i &into)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline void LoadUint64(const uint64 value, __m128i &into)
|
inline void LoadUint64(const uint64_t value, __m128i &into)
|
||||||
{
|
{
|
||||||
#ifdef POINTER_IS_64BIT
|
#ifdef POINTER_IS_64BIT
|
||||||
into = _mm_cvtsi64_si128(value);
|
into = _mm_cvtsi64_si128(value);
|
||||||
@@ -50,7 +50,7 @@ static inline void LoadUint64(const uint64 value, __m128i &into)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
|
inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
|
||||||
{
|
{
|
||||||
#if (SSE_VERSION == 2)
|
#if (SSE_VERSION == 2)
|
||||||
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
|
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
|
||||||
@@ -61,7 +61,7 @@ static inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
|
inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
|
||||||
{
|
{
|
||||||
#if (SSE_VERSION == 2)
|
#if (SSE_VERSION == 2)
|
||||||
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
|
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
|
||||||
@@ -73,7 +73,7 @@ static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask)
|
inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask)
|
||||||
{
|
{
|
||||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
|
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
|
||||||
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
||||||
@@ -97,7 +97,7 @@ static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128
|
|||||||
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
|
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
|
||||||
*/
|
*/
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
|
inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
|
||||||
{
|
{
|
||||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
|
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
|
||||||
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
||||||
@@ -145,7 +145,7 @@ IGNORE_UNINITIALIZED_WARNING_STOP
|
|||||||
/** ReallyAdjustBrightness() is not called that often.
|
/** ReallyAdjustBrightness() is not called that often.
|
||||||
* Inlining this function implies a far jump, which has a huge latency.
|
* Inlining this function implies a far jump, which has a huge latency.
|
||||||
*/
|
*/
|
||||||
static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
|
inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
|
||||||
{
|
{
|
||||||
/* Shortcut for normal brightness. */
|
/* Shortcut for normal brightness. */
|
||||||
if (likely(brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS)) return colour;
|
if (likely(brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS)) return colour;
|
||||||
@@ -154,7 +154,7 @@ static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNU_TARGET(SSE_TARGET)
|
GNU_TARGET(SSE_TARGET)
|
||||||
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32 brightness)
|
inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness)
|
||||||
{
|
{
|
||||||
#if (SSE_VERSION < 3)
|
#if (SSE_VERSION < 3)
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
|
@@ -87,7 +87,7 @@ bool HasBridgeFlatRamp(Slope tileh, Axis axis);
|
|||||||
* @param i The type of bridge to get the specification for.
|
* @param i The type of bridge to get the specification for.
|
||||||
* @return The specification.
|
* @return The specification.
|
||||||
*/
|
*/
|
||||||
static inline const BridgeSpec *GetBridgeSpec(BridgeType i)
|
inline const BridgeSpec *GetBridgeSpec(BridgeType i)
|
||||||
{
|
{
|
||||||
dbg_assert(i < lengthof(_bridge));
|
dbg_assert(i < lengthof(_bridge));
|
||||||
return &_bridge[i];
|
return &_bridge[i];
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if the structure is a bridge one
|
* @return true if the structure is a bridge one
|
||||||
*/
|
*/
|
||||||
static inline bool IsBridge(TileIndex t)
|
inline bool IsBridge(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 7);
|
return HasBit(_m[t].m5, 7);
|
||||||
@@ -31,7 +31,7 @@ static inline bool IsBridge(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if a bridge is present
|
* @return true if a bridge is present
|
||||||
*/
|
*/
|
||||||
static inline bool IsBridgeTile(TileIndex t)
|
inline bool IsBridgeTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
|
return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ static inline bool IsBridgeTile(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if a bridge is detected above
|
* @return true if a bridge is detected above
|
||||||
*/
|
*/
|
||||||
static inline bool IsBridgeAbove(TileIndex t)
|
inline bool IsBridgeAbove(TileIndex t)
|
||||||
{
|
{
|
||||||
return GB(_m[t].type, 2, 2) != 0;
|
return GB(_m[t].type, 2, 2) != 0;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ static inline bool IsBridgeAbove(TileIndex t)
|
|||||||
* @pre IsBridgeTile(t)
|
* @pre IsBridgeTile(t)
|
||||||
* @return The bridge type
|
* @return The bridge type
|
||||||
*/
|
*/
|
||||||
static inline BridgeType GetBridgeType(TileIndex t)
|
inline BridgeType GetBridgeType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsBridgeTile(t), t);
|
assert_tile(IsBridgeTile(t), t);
|
||||||
return GB(_me[t].m6, 2, 4);
|
return GB(_me[t].m6, 2, 4);
|
||||||
@@ -64,7 +64,7 @@ static inline BridgeType GetBridgeType(TileIndex t)
|
|||||||
* @pre IsBridgeAbove(t)
|
* @pre IsBridgeAbove(t)
|
||||||
* @return the above mentioned axis
|
* @return the above mentioned axis
|
||||||
*/
|
*/
|
||||||
static inline Axis GetBridgeAxis(TileIndex t)
|
inline Axis GetBridgeAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsBridgeAbove(t), t);
|
assert_tile(IsBridgeAbove(t), t);
|
||||||
return (Axis)(GB(_m[t].type, 2, 2) - 1);
|
return (Axis)(GB(_m[t].type, 2, 2) - 1);
|
||||||
@@ -80,7 +80,7 @@ int GetBridgeHeight(TileIndex tile);
|
|||||||
* @param tile the bridge ramp tile to get the bridge height from
|
* @param tile the bridge ramp tile to get the bridge height from
|
||||||
* @return the height of the bridge in pixels
|
* @return the height of the bridge in pixels
|
||||||
*/
|
*/
|
||||||
static inline int GetBridgePixelHeight(TileIndex tile)
|
inline int GetBridgePixelHeight(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetBridgeHeight(tile) * TILE_HEIGHT;
|
return GetBridgeHeight(tile) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ static inline int GetBridgePixelHeight(TileIndex tile)
|
|||||||
* @param t the tile to remove the bridge from
|
* @param t the tile to remove the bridge from
|
||||||
* @param a the axis of the bridge to remove
|
* @param a the axis of the bridge to remove
|
||||||
*/
|
*/
|
||||||
static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
|
inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
|
||||||
{
|
{
|
||||||
ClrBit(_m[t].type, 2 + a);
|
ClrBit(_m[t].type, 2 + a);
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
|
|||||||
* Removes bridges from the given, that is bridges along the X and Y axis.
|
* Removes bridges from the given, that is bridges along the X and Y axis.
|
||||||
* @param t the tile to remove the bridge from
|
* @param t the tile to remove the bridge from
|
||||||
*/
|
*/
|
||||||
static inline void ClearBridgeMiddle(TileIndex t)
|
inline void ClearBridgeMiddle(TileIndex t)
|
||||||
{
|
{
|
||||||
ClearSingleBridgeMiddle(t, AXIS_X);
|
ClearSingleBridgeMiddle(t, AXIS_X);
|
||||||
ClearSingleBridgeMiddle(t, AXIS_Y);
|
ClearSingleBridgeMiddle(t, AXIS_Y);
|
||||||
@@ -110,7 +110,7 @@ static inline void ClearBridgeMiddle(TileIndex t)
|
|||||||
* @param t the tile to add the bridge to
|
* @param t the tile to add the bridge to
|
||||||
* @param a the axis of the bridge to add
|
* @param a the axis of the bridge to add
|
||||||
*/
|
*/
|
||||||
static inline void SetBridgeMiddle(TileIndex t, Axis a)
|
inline void SetBridgeMiddle(TileIndex t, Axis a)
|
||||||
{
|
{
|
||||||
SetBit(_m[t].type, 2 + a);
|
SetBit(_m[t].type, 2 + a);
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ static inline void SetBridgeMiddle(TileIndex t, Axis a)
|
|||||||
* @param tt the transport type of the bridge
|
* @param tt the transport type of the bridge
|
||||||
* @note this function should not be called directly.
|
* @note this function should not be called directly.
|
||||||
*/
|
*/
|
||||||
static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt)
|
inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_TUNNELBRIDGE);
|
SetTileType(t, MP_TUNNELBRIDGE);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
@@ -149,7 +149,7 @@ static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, D
|
|||||||
* @param road_rt the road type of the bridge
|
* @param road_rt the road type of the bridge
|
||||||
* @param tram_rt the tram type of the bridge
|
* @param tram_rt the tram type of the bridge
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, Owner owner_road, Owner owner_tram, BridgeType bridgetype, DiagDirection d, RoadType road_rt, RoadType tram_rt)
|
inline void MakeRoadBridgeRamp(TileIndex t, Owner o, Owner owner_road, Owner owner_tram, BridgeType bridgetype, DiagDirection d, RoadType road_rt, RoadType tram_rt)
|
||||||
{
|
{
|
||||||
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
|
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
|
||||||
SetRoadOwner(t, RTT_ROAD, owner_road);
|
SetRoadOwner(t, RTT_ROAD, owner_road);
|
||||||
@@ -166,7 +166,7 @@ static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, Owner owner_road, Ow
|
|||||||
* @param rt the rail type of the bridge
|
* @param rt the rail type of the bridge
|
||||||
* @param upgrade whether the bridge is an upgrade instead of a totally new bridge
|
* @param upgrade whether the bridge is an upgrade instead of a totally new bridge
|
||||||
*/
|
*/
|
||||||
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType rt, bool upgrade)
|
inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType rt, bool upgrade)
|
||||||
{
|
{
|
||||||
/* Backup bridge signal and custom bridgehead data. */
|
/* Backup bridge signal and custom bridgehead data. */
|
||||||
auto m2_backup = _m[t].m2;
|
auto m2_backup = _m[t].m2;
|
||||||
@@ -202,7 +202,7 @@ static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetyp
|
|||||||
* @param o the new owner of the bridge ramp
|
* @param o the new owner of the bridge ramp
|
||||||
* @param d the direction this ramp must be facing
|
* @param d the direction this ramp must be facing
|
||||||
*/
|
*/
|
||||||
static inline void MakeAqueductBridgeRamp(TileIndex t, Owner o, DiagDirection d)
|
inline void MakeAqueductBridgeRamp(TileIndex t, Owner o, DiagDirection d)
|
||||||
{
|
{
|
||||||
MakeBridgeRamp(t, o, 0, d, TRANSPORT_WATER);
|
MakeBridgeRamp(t, o, 0, d, TRANSPORT_WATER);
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ static inline void MakeAqueductBridgeRamp(TileIndex t, Owner o, DiagDirection d)
|
|||||||
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
||||||
* @return true if it is a custom bridge head
|
* @return true if it is a custom bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadCustomBridgeHead(TileIndex t)
|
inline bool IsRoadCustomBridgeHead(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD, t);
|
assert_tile(IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD, t);
|
||||||
return GB(_m[t].m2, 0, 8) != 0;
|
return GB(_m[t].m2, 0, 8) != 0;
|
||||||
@@ -224,7 +224,7 @@ static inline bool IsRoadCustomBridgeHead(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if it is a road bridge head with a custom bridge head
|
* @return true if it is a road bridge head with a custom bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadCustomBridgeHeadTile(TileIndex t)
|
inline bool IsRoadCustomBridgeHeadTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD && IsRoadCustomBridgeHead(t);
|
return IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD && IsRoadCustomBridgeHead(t);
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ static inline bool IsRoadCustomBridgeHeadTile(TileIndex t)
|
|||||||
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
||||||
* @return road bits for the bridge head
|
* @return road bits for the bridge head
|
||||||
*/
|
*/
|
||||||
static inline RoadBits GetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt)
|
inline RoadBits GetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
assert_tile(IsBridgeTile(t), t);
|
assert_tile(IsBridgeTile(t), t);
|
||||||
if (!HasTileRoadType(t, rtt)) return (RoadBits) 0;
|
if (!HasTileRoadType(t, rtt)) return (RoadBits) 0;
|
||||||
@@ -250,7 +250,7 @@ static inline RoadBits GetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt
|
|||||||
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
||||||
* @return road bits for the bridge head
|
* @return road bits for the bridge head
|
||||||
*/
|
*/
|
||||||
static inline RoadBits GetCustomBridgeHeadAllRoadBits(TileIndex t)
|
inline RoadBits GetCustomBridgeHeadAllRoadBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetCustomBridgeHeadRoadBits(t, RTT_ROAD) | GetCustomBridgeHeadRoadBits(t, RTT_TRAM);
|
return GetCustomBridgeHeadRoadBits(t, RTT_ROAD) | GetCustomBridgeHeadRoadBits(t, RTT_TRAM);
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ static inline RoadBits GetCustomBridgeHeadAllRoadBits(TileIndex t)
|
|||||||
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
* @pre IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_ROAD
|
||||||
* @pre HasTileRoadType() must be set correctly before calling this
|
* @pre HasTileRoadType() must be set correctly before calling this
|
||||||
*/
|
*/
|
||||||
static inline void SetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt, RoadBits bits)
|
inline void SetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt, RoadBits bits)
|
||||||
{
|
{
|
||||||
assert_tile(IsBridgeTile(t), t);
|
assert_tile(IsBridgeTile(t), t);
|
||||||
if (HasTileRoadType(t, rtt)) {
|
if (HasTileRoadType(t, rtt)) {
|
||||||
@@ -280,7 +280,7 @@ static inline void SetCustomBridgeHeadRoadBits(TileIndex t, RoadTramType rtt, Ro
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if it is a rail bridge head
|
* @return true if it is a rail bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailBridgeHeadTile(TileIndex t)
|
inline bool IsRailBridgeHeadTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_RAIL;
|
return IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_RAIL;
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ static inline bool IsRailBridgeHeadTile(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if it is a flat rail bridge head
|
* @return true if it is a flat rail bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsFlatRailBridgeHeadTile(TileIndex t)
|
inline bool IsFlatRailBridgeHeadTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsRailBridgeHeadTile(t) && HasBridgeFlatRamp(GetTileSlope(t), DiagDirToAxis((DiagDirection)GB(_m[t].m5, 0, 2)));
|
return IsRailBridgeHeadTile(t) && HasBridgeFlatRamp(GetTileSlope(t), DiagDirToAxis((DiagDirection)GB(_m[t].m5, 0, 2)));
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ static inline bool IsFlatRailBridgeHeadTile(TileIndex t)
|
|||||||
* @pre IsRailBridgeHeadTile(t)
|
* @pre IsRailBridgeHeadTile(t)
|
||||||
* @return road bits for the bridge head
|
* @return road bits for the bridge head
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return (TrackBits)GB(_m[t].m4, 0, 6);
|
return (TrackBits)GB(_m[t].m4, 0, 6);
|
||||||
@@ -313,7 +313,7 @@ static inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
|||||||
* @param b the new track bits for the tile
|
* @param b the new track bits for the tile
|
||||||
* @pre IsRailBridgeHeadTile(t)
|
* @pre IsRailBridgeHeadTile(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
SB(_m[t].m4, 0, 6, b);
|
SB(_m[t].m4, 0, 6, b);
|
||||||
@@ -325,7 +325,7 @@ static inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
|||||||
* @pre IsRailBridgeHeadTile(t)
|
* @pre IsRailBridgeHeadTile(t)
|
||||||
* @return true if it is a custom bridge head
|
* @return true if it is a custom bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailCustomBridgeHead(TileIndex t)
|
inline bool IsRailCustomBridgeHead(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return GetCustomBridgeHeadTrackBits(t) != DiagDirToDiagTrackBits((DiagDirection)GB(_m[t].m5, 0, 2));
|
return GetCustomBridgeHeadTrackBits(t) != DiagDirToDiagTrackBits((DiagDirection)GB(_m[t].m5, 0, 2));
|
||||||
@@ -336,7 +336,7 @@ static inline bool IsRailCustomBridgeHead(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if it is a rail bridge head with a custom bridge head
|
* @return true if it is a rail bridge head with a custom bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailCustomBridgeHeadTile(TileIndex t)
|
inline bool IsRailCustomBridgeHeadTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsRailBridgeHeadTile(t) && IsRailCustomBridgeHead(t);
|
return IsRailBridgeHeadTile(t) && IsRailCustomBridgeHead(t);
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ static inline bool IsRailCustomBridgeHeadTile(TileIndex t)
|
|||||||
* @param t The tile to analyze
|
* @param t The tile to analyze
|
||||||
* @return true if it is a bridge head with a custom bridge head
|
* @return true if it is a bridge head with a custom bridge head
|
||||||
*/
|
*/
|
||||||
static inline bool IsCustomBridgeHeadTile(TileIndex t)
|
inline bool IsCustomBridgeHeadTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsRailCustomBridgeHeadTile(t) || IsRoadCustomBridgeHeadTile(t);
|
return IsRailCustomBridgeHeadTile(t) || IsRoadCustomBridgeHeadTile(t);
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ static inline bool IsCustomBridgeHeadTile(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
byte track_b = GB(_m[t].m2, 0, 3);
|
byte track_b = GB(_m[t].m2, 0, 3);
|
||||||
@@ -372,7 +372,7 @@ static inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
|||||||
* @param t the tile to change
|
* @param t the tile to change
|
||||||
* @param b the track bits
|
* @param b the track bits
|
||||||
*/
|
*/
|
||||||
static inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
assert(!TracksOverlap(b));
|
assert(!TracksOverlap(b));
|
||||||
@@ -389,7 +389,7 @@ static inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
|||||||
* @param t the rack to reserve
|
* @param t the rack to reserve
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
static inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
assert_tile(HasBit(GetCustomBridgeHeadTrackBits(tile), t), tile);
|
assert_tile(HasBit(GetCustomBridgeHeadTrackBits(tile), t), tile);
|
||||||
@@ -409,7 +409,7 @@ static inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
|||||||
* @param tile the tile
|
* @param tile the tile
|
||||||
* @param t the track to free
|
* @param t the track to free
|
||||||
*/
|
*/
|
||||||
static inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
assert(HasBit(GetCustomBridgeHeadTrackBits(tile), t));
|
assert(HasBit(GetCustomBridgeHeadTrackBits(tile), t));
|
||||||
@@ -424,7 +424,7 @@ static inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetAcrossBridgePossibleTrackBits(TileIndex t)
|
inline TrackBits GetAcrossBridgePossibleTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(t), t);
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return DiagdirReachesTracks(ReverseDiagDir((DiagDirection)GB(_m[t].m5, 0, 2)));
|
return DiagdirReachesTracks(ReverseDiagDir((DiagDirection)GB(_m[t].m5, 0, 2)));
|
||||||
@@ -436,7 +436,7 @@ static inline TrackBits GetAcrossBridgePossibleTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetAcrossBridgeReservationTrackBits(TileIndex t)
|
inline TrackBits GetAcrossBridgeReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetBridgeReservationTrackBits(t) & GetAcrossBridgePossibleTrackBits(t);
|
return GetBridgeReservationTrackBits(t) & GetAcrossBridgePossibleTrackBits(t);
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ static inline TrackBits GetAcrossBridgeReservationTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool HasAcrossBridgeReservation(TileIndex t)
|
inline bool HasAcrossBridgeReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetAcrossBridgeReservationTrackBits(t) != TRACK_BIT_NONE;
|
return GetAcrossBridgeReservationTrackBits(t) != TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ static inline bool HasAcrossBridgeReservation(TileIndex t)
|
|||||||
* @pre IsRailBridgeHeadTile(t)
|
* @pre IsRailBridgeHeadTile(t)
|
||||||
* @param tile the tile
|
* @param tile the tile
|
||||||
*/
|
*/
|
||||||
static inline void UnreserveAcrossRailBridgeHead(TileIndex tile)
|
inline void UnreserveAcrossRailBridgeHead(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
TrackBits res = GetAcrossBridgeReservationTrackBits(tile);
|
TrackBits res = GetAcrossBridgeReservationTrackBits(tile);
|
||||||
|
@@ -36,7 +36,7 @@ enum {
|
|||||||
BRIDGE_M2_SIGNAL_STATE_EXT_FLAG = 0x8000,
|
BRIDGE_M2_SIGNAL_STATE_EXT_FLAG = 0x8000,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline SignalState GetBridgeEntranceSimulatedSignalState(TileIndex t, uint16 signal)
|
inline SignalState GetBridgeEntranceSimulatedSignalState(TileIndex t, uint16 signal)
|
||||||
{
|
{
|
||||||
if (signal < BRIDGE_M2_SIGNAL_STATE_COUNT) {
|
if (signal < BRIDGE_M2_SIGNAL_STATE_COUNT) {
|
||||||
return GB(_m[t].m2, signal + BRIDGE_M2_SIGNAL_STATE_OFFSET, 1) ? SIGNAL_STATE_RED : SIGNAL_STATE_GREEN;
|
return GB(_m[t].m2, signal + BRIDGE_M2_SIGNAL_STATE_OFFSET, 1) ? SIGNAL_STATE_RED : SIGNAL_STATE_GREEN;
|
||||||
@@ -47,7 +47,7 @@ static inline SignalState GetBridgeEntranceSimulatedSignalState(TileIndex t, uin
|
|||||||
|
|
||||||
void SetBridgeEntranceSimulatedSignalStateExtended(TileIndex t, uint16 signal, SignalState state);
|
void SetBridgeEntranceSimulatedSignalStateExtended(TileIndex t, uint16 signal, SignalState state);
|
||||||
|
|
||||||
static inline void SetBridgeEntranceSimulatedSignalState(TileIndex t, uint16 signal, SignalState state)
|
inline void SetBridgeEntranceSimulatedSignalState(TileIndex t, uint16 signal, SignalState state)
|
||||||
{
|
{
|
||||||
if (signal < BRIDGE_M2_SIGNAL_STATE_COUNT) {
|
if (signal < BRIDGE_M2_SIGNAL_STATE_COUNT) {
|
||||||
SB(_m[t].m2, signal + BRIDGE_M2_SIGNAL_STATE_OFFSET, 1, (state == SIGNAL_STATE_RED) ? 1 : 0);
|
SB(_m[t].m2, signal + BRIDGE_M2_SIGNAL_STATE_OFFSET, 1, (state == SIGNAL_STATE_RED) ? 1 : 0);
|
||||||
@@ -58,7 +58,7 @@ static inline void SetBridgeEntranceSimulatedSignalState(TileIndex t, uint16 sig
|
|||||||
|
|
||||||
bool SetAllBridgeEntranceSimulatedSignalsGreenExtended(TileIndex t);
|
bool SetAllBridgeEntranceSimulatedSignalsGreenExtended(TileIndex t);
|
||||||
|
|
||||||
static inline bool SetAllBridgeEntranceSimulatedSignalsGreen(TileIndex t)
|
inline bool SetAllBridgeEntranceSimulatedSignalsGreen(TileIndex t)
|
||||||
{
|
{
|
||||||
if (_m[t].m2 & BRIDGE_M2_SIGNAL_STATE_EXT_FLAG) {
|
if (_m[t].m2 & BRIDGE_M2_SIGNAL_STATE_EXT_FLAG) {
|
||||||
return SetAllBridgeEntranceSimulatedSignalsGreenExtended(t);
|
return SetAllBridgeEntranceSimulatedSignalsGreenExtended(t);
|
||||||
@@ -71,7 +71,7 @@ static inline bool SetAllBridgeEntranceSimulatedSignalsGreen(TileIndex t)
|
|||||||
|
|
||||||
void ClearBridgeEntranceSimulatedSignalsExtended(TileIndex t);
|
void ClearBridgeEntranceSimulatedSignalsExtended(TileIndex t);
|
||||||
|
|
||||||
static inline void ClearBridgeEntranceSimulatedSignals(TileIndex t)
|
inline void ClearBridgeEntranceSimulatedSignals(TileIndex t)
|
||||||
{
|
{
|
||||||
if (_m[t].m2 & BRIDGE_M2_SIGNAL_STATE_EXT_FLAG) {
|
if (_m[t].m2 & BRIDGE_M2_SIGNAL_STATE_EXT_FLAG) {
|
||||||
ClearBridgeEntranceSimulatedSignalsExtended(t);
|
ClearBridgeEntranceSimulatedSignalsExtended(t);
|
||||||
@@ -84,7 +84,7 @@ void ClearBridgeSimulatedSignalMapping();
|
|||||||
|
|
||||||
void SetBridgeSignalStyle(TileIndex t, uint8 style);
|
void SetBridgeSignalStyle(TileIndex t, uint8 style);
|
||||||
|
|
||||||
static inline uint8 GetBridgeSignalStyle(TileIndex t)
|
inline uint8 GetBridgeSignalStyle(TileIndex t)
|
||||||
{
|
{
|
||||||
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ static_assert(MAX_COMPANIES <= (1 << CCB_COMPANY_LENGTH));
|
|||||||
* @param ind %Industry providing or accepting the cargo.
|
* @param ind %Industry providing or accepting the cargo.
|
||||||
* @return The encoded cargo/company/industry number.
|
* @return The encoded cargo/company/industry number.
|
||||||
*/
|
*/
|
||||||
static inline CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
|
inline CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, CargoID ctype, IndustryID ind)
|
||||||
{
|
{
|
||||||
assert(ctype < (1 << CCB_CARGO_TYPE_LENGTH));
|
assert(ctype < (1 << CCB_CARGO_TYPE_LENGTH));
|
||||||
assert(company < (1 << CCB_COMPANY_LENGTH));
|
assert(company < (1 << CCB_COMPANY_LENGTH));
|
||||||
@@ -78,7 +78,7 @@ static inline CargoMonitorID EncodeCargoIndustryMonitor(CompanyID company, Cargo
|
|||||||
* @param town %Town providing or accepting the cargo.
|
* @param town %Town providing or accepting the cargo.
|
||||||
* @return The encoded cargo/company/town number.
|
* @return The encoded cargo/company/town number.
|
||||||
*/
|
*/
|
||||||
static inline CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
|
inline CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID ctype, TownID town)
|
||||||
{
|
{
|
||||||
assert(ctype < (1 << CCB_CARGO_TYPE_LENGTH));
|
assert(ctype < (1 << CCB_CARGO_TYPE_LENGTH));
|
||||||
assert(company < (1 << CCB_COMPANY_LENGTH));
|
assert(company < (1 << CCB_COMPANY_LENGTH));
|
||||||
@@ -95,7 +95,7 @@ static inline CargoMonitorID EncodeCargoTownMonitor(CompanyID company, CargoID c
|
|||||||
* @param num Cargo monitoring number to decode.
|
* @param num Cargo monitoring number to decode.
|
||||||
* @return The extracted company id.
|
* @return The extracted company id.
|
||||||
*/
|
*/
|
||||||
static inline CompanyID DecodeMonitorCompany(CargoMonitorID num)
|
inline CompanyID DecodeMonitorCompany(CargoMonitorID num)
|
||||||
{
|
{
|
||||||
return static_cast<CompanyID>(GB(num, CCB_COMPANY_START, CCB_COMPANY_LENGTH));
|
return static_cast<CompanyID>(GB(num, CCB_COMPANY_START, CCB_COMPANY_LENGTH));
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ static inline CompanyID DecodeMonitorCompany(CargoMonitorID num)
|
|||||||
* @param num Cargo monitoring number to decode.
|
* @param num Cargo monitoring number to decode.
|
||||||
* @return The extracted cargo type.
|
* @return The extracted cargo type.
|
||||||
*/
|
*/
|
||||||
static inline CargoID DecodeMonitorCargoType(CargoMonitorID num)
|
inline CargoID DecodeMonitorCargoType(CargoMonitorID num)
|
||||||
{
|
{
|
||||||
return GB(num, CCB_CARGO_TYPE_START, CCB_CARGO_TYPE_LENGTH);
|
return GB(num, CCB_CARGO_TYPE_START, CCB_CARGO_TYPE_LENGTH);
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ static inline CargoID DecodeMonitorCargoType(CargoMonitorID num)
|
|||||||
* @param num Cargo monitoring number to decode.
|
* @param num Cargo monitoring number to decode.
|
||||||
* @return true if monitoring an industry, false if monitoring a town.
|
* @return true if monitoring an industry, false if monitoring a town.
|
||||||
*/
|
*/
|
||||||
static inline bool MonitorMonitorsIndustry(CargoMonitorID num)
|
inline bool MonitorMonitorsIndustry(CargoMonitorID num)
|
||||||
{
|
{
|
||||||
return HasBit(num, CCB_IS_INDUSTRY_BIT);
|
return HasBit(num, CCB_IS_INDUSTRY_BIT);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ static inline bool MonitorMonitorsIndustry(CargoMonitorID num)
|
|||||||
* @param num Cargo monitoring number to decode.
|
* @param num Cargo monitoring number to decode.
|
||||||
* @return The extracted industry id, or #INVALID_INDUSTRY if the number does not monitor an industry.
|
* @return The extracted industry id, or #INVALID_INDUSTRY if the number does not monitor an industry.
|
||||||
*/
|
*/
|
||||||
static inline IndustryID DecodeMonitorIndustry(CargoMonitorID num)
|
inline IndustryID DecodeMonitorIndustry(CargoMonitorID num)
|
||||||
{
|
{
|
||||||
if (!MonitorMonitorsIndustry(num)) return INVALID_INDUSTRY;
|
if (!MonitorMonitorsIndustry(num)) return INVALID_INDUSTRY;
|
||||||
return GB(num, CCB_TOWN_IND_NUMBER_START, CCB_TOWN_IND_NUMBER_LENGTH);
|
return GB(num, CCB_TOWN_IND_NUMBER_START, CCB_TOWN_IND_NUMBER_LENGTH);
|
||||||
@@ -136,7 +136,7 @@ static inline IndustryID DecodeMonitorIndustry(CargoMonitorID num)
|
|||||||
* @param num Cargo monitoring number to decode.
|
* @param num Cargo monitoring number to decode.
|
||||||
* @return The extracted town id, or #INVALID_TOWN if the number does not monitor a town.
|
* @return The extracted town id, or #INVALID_TOWN if the number does not monitor a town.
|
||||||
*/
|
*/
|
||||||
static inline TownID DecodeMonitorTown(CargoMonitorID num)
|
inline TownID DecodeMonitorTown(CargoMonitorID num)
|
||||||
{
|
{
|
||||||
if (MonitorMonitorsIndustry(num)) return INVALID_TOWN;
|
if (MonitorMonitorsIndustry(num)) return INVALID_TOWN;
|
||||||
return GB(num, CCB_TOWN_IND_NUMBER_START, CCB_TOWN_IND_NUMBER_LENGTH);
|
return GB(num, CCB_TOWN_IND_NUMBER_START, CCB_TOWN_IND_NUMBER_LENGTH);
|
||||||
|
@@ -211,7 +211,7 @@ uint ConvertDisplayQuantityToCargoQuantity(CargoID cargo, uint quantity);
|
|||||||
* @param cc Cargo class.
|
* @param cc Cargo class.
|
||||||
* @return The type fits in the class.
|
* @return The type fits in the class.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCargoInClass(CargoID c, CargoClass cc)
|
inline bool IsCargoInClass(CargoID c, CargoClass cc)
|
||||||
{
|
{
|
||||||
return (CargoSpec::Get(c)->classes & cc) != 0;
|
return (CargoSpec::Get(c)->classes & cc) != 0;
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ enum ClearGround {
|
|||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
* @return whether the tile is covered with snow.
|
* @return whether the tile is covered with snow.
|
||||||
*/
|
*/
|
||||||
static inline bool IsSnowTile(TileIndex t)
|
inline bool IsSnowTile(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return HasBit(_m[t].m3, 4);
|
return HasBit(_m[t].m3, 4);
|
||||||
@@ -44,7 +44,7 @@ static inline bool IsSnowTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
* @return the ground type
|
* @return the ground type
|
||||||
*/
|
*/
|
||||||
static inline ClearGround GetRawClearGround(TileIndex t)
|
inline ClearGround GetRawClearGround(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return (ClearGround)GB(_m[t].m5, 2, 3);
|
return (ClearGround)GB(_m[t].m5, 2, 3);
|
||||||
@@ -56,7 +56,7 @@ static inline ClearGround GetRawClearGround(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
* @return the ground type
|
* @return the ground type
|
||||||
*/
|
*/
|
||||||
static inline ClearGround GetClearGround(TileIndex t)
|
inline ClearGround GetClearGround(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsSnowTile(t)) return CLEAR_SNOW;
|
if (IsSnowTile(t)) return CLEAR_SNOW;
|
||||||
return GetRawClearGround(t);
|
return GetRawClearGround(t);
|
||||||
@@ -68,7 +68,7 @@ static inline ClearGround GetClearGround(TileIndex t)
|
|||||||
* @param ct the ground type
|
* @param ct the ground type
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline bool IsClearGround(TileIndex t, ClearGround ct)
|
inline bool IsClearGround(TileIndex t, ClearGround ct)
|
||||||
{
|
{
|
||||||
return GetClearGround(t) == ct;
|
return GetClearGround(t) == ct;
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ static inline bool IsClearGround(TileIndex t, ClearGround ct)
|
|||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
* @return the density
|
* @return the density
|
||||||
*/
|
*/
|
||||||
static inline uint GetClearDensity(TileIndex t)
|
inline uint GetClearDensity(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return GB(_m[t].m5, 0, 2);
|
return GB(_m[t].m5, 0, 2);
|
||||||
@@ -92,7 +92,7 @@ static inline uint GetClearDensity(TileIndex t)
|
|||||||
* @param d the amount to increment the density with
|
* @param d the amount to increment the density with
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void AddClearDensity(TileIndex t, int d)
|
inline void AddClearDensity(TileIndex t, int d)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 += d;
|
_m[t].m5 += d;
|
||||||
@@ -104,7 +104,7 @@ static inline void AddClearDensity(TileIndex t, int d)
|
|||||||
* @param d the new density
|
* @param d the new density
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void SetClearDensity(TileIndex t, uint d)
|
inline void SetClearDensity(TileIndex t, uint d)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
SB(_m[t].m5, 0, 2, d);
|
SB(_m[t].m5, 0, 2, d);
|
||||||
@@ -117,7 +117,7 @@ static inline void SetClearDensity(TileIndex t, uint d)
|
|||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
* @return the value of the counter
|
* @return the value of the counter
|
||||||
*/
|
*/
|
||||||
static inline uint GetClearCounter(TileIndex t)
|
inline uint GetClearCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return GB(_m[t].m5, 5, 3);
|
return GB(_m[t].m5, 5, 3);
|
||||||
@@ -129,7 +129,7 @@ static inline uint GetClearCounter(TileIndex t)
|
|||||||
* @param c the amount to increment the counter with
|
* @param c the amount to increment the counter with
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void AddClearCounter(TileIndex t, int c)
|
inline void AddClearCounter(TileIndex t, int c)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 += c << 5;
|
_m[t].m5 += c << 5;
|
||||||
@@ -141,7 +141,7 @@ static inline void AddClearCounter(TileIndex t, int c)
|
|||||||
* @param c the amount to set the counter to
|
* @param c the amount to set the counter to
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void SetClearCounter(TileIndex t, uint c)
|
inline void SetClearCounter(TileIndex t, uint c)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
SB(_m[t].m5, 5, 3, c);
|
SB(_m[t].m5, 5, 3, c);
|
||||||
@@ -155,7 +155,7 @@ static inline void SetClearCounter(TileIndex t, uint c)
|
|||||||
* @param density the density of the ground tile
|
* @param density the density of the ground tile
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
|
inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 = 0 << 5 | type << 2 | density;
|
_m[t].m5 = 0 << 5 | type << 2 | density;
|
||||||
@@ -168,7 +168,7 @@ static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint den
|
|||||||
* @pre GetClearGround(t) == CLEAR_FIELDS
|
* @pre GetClearGround(t) == CLEAR_FIELDS
|
||||||
* @return the field type
|
* @return the field type
|
||||||
*/
|
*/
|
||||||
static inline uint GetFieldType(TileIndex t)
|
inline uint GetFieldType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
return GB(_m[t].m3, 0, 4);
|
return GB(_m[t].m3, 0, 4);
|
||||||
@@ -180,7 +180,7 @@ static inline uint GetFieldType(TileIndex t)
|
|||||||
* @param f the field type
|
* @param f the field type
|
||||||
* @pre GetClearGround(t) == CLEAR_FIELDS
|
* @pre GetClearGround(t) == CLEAR_FIELDS
|
||||||
*/
|
*/
|
||||||
static inline void SetFieldType(TileIndex t, uint f)
|
inline void SetFieldType(TileIndex t, uint f)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t); // XXX incomplete
|
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t); // XXX incomplete
|
||||||
SB(_m[t].m3, 0, 4, f);
|
SB(_m[t].m3, 0, 4, f);
|
||||||
@@ -192,7 +192,7 @@ static inline void SetFieldType(TileIndex t, uint f)
|
|||||||
* @pre GetClearGround(t) == CLEAR_FIELDS
|
* @pre GetClearGround(t) == CLEAR_FIELDS
|
||||||
* @return the industry that made the field
|
* @return the industry that made the field
|
||||||
*/
|
*/
|
||||||
static inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
return(IndustryID) _m[t].m2;
|
return(IndustryID) _m[t].m2;
|
||||||
@@ -204,7 +204,7 @@ static inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
|||||||
* @param i the industry that made the field
|
* @param i the industry that made the field
|
||||||
* @pre GetClearGround(t) == CLEAR_FIELDS
|
* @pre GetClearGround(t) == CLEAR_FIELDS
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
_m[t].m2 = i;
|
_m[t].m2 = i;
|
||||||
@@ -218,7 +218,7 @@ static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
|||||||
* @pre IsClearGround(t, CLEAR_FIELDS)
|
* @pre IsClearGround(t, CLEAR_FIELDS)
|
||||||
* @return 0 if there is no fence, otherwise the fence type
|
* @return 0 if there is no fence, otherwise the fence type
|
||||||
*/
|
*/
|
||||||
static inline uint GetFence(TileIndex t, DiagDirection side)
|
inline uint GetFence(TileIndex t, DiagDirection side)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
||||||
switch (side) {
|
switch (side) {
|
||||||
@@ -237,7 +237,7 @@ static inline uint GetFence(TileIndex t, DiagDirection side)
|
|||||||
* @param h 0 if there is no fence, otherwise the fence type
|
* @param h 0 if there is no fence, otherwise the fence type
|
||||||
* @pre IsClearGround(t, CLEAR_FIELDS)
|
* @pre IsClearGround(t, CLEAR_FIELDS)
|
||||||
*/
|
*/
|
||||||
static inline void SetFence(TileIndex t, DiagDirection side, uint h)
|
inline void SetFence(TileIndex t, DiagDirection side, uint h)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
||||||
switch (side) {
|
switch (side) {
|
||||||
@@ -256,7 +256,7 @@ static inline void SetFence(TileIndex t, DiagDirection side, uint h)
|
|||||||
* @param g the type of ground
|
* @param g the type of ground
|
||||||
* @param density the density of the grass/snow/desert etc
|
* @param density the density of the grass/snow/desert etc
|
||||||
*/
|
*/
|
||||||
static inline void MakeClear(TileIndex t, ClearGround g, uint density)
|
inline void MakeClear(TileIndex t, ClearGround g, uint density)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_CLEAR);
|
SetTileType(t, MP_CLEAR);
|
||||||
_m[t].m1 = 0;
|
_m[t].m1 = 0;
|
||||||
@@ -277,7 +277,7 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density)
|
|||||||
* @param field_type the 'growth' level of the field
|
* @param field_type the 'growth' level of the field
|
||||||
* @param industry the industry this tile belongs to
|
* @param industry the industry this tile belongs to
|
||||||
*/
|
*/
|
||||||
static inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
|
inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_CLEAR);
|
SetTileType(t, MP_CLEAR);
|
||||||
_m[t].m1 = 0;
|
_m[t].m1 = 0;
|
||||||
@@ -297,7 +297,7 @@ static inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
|
|||||||
* @param density The density of snowiness.
|
* @param density The density of snowiness.
|
||||||
* @pre GetClearGround(t) != CLEAR_SNOW
|
* @pre GetClearGround(t) != CLEAR_SNOW
|
||||||
*/
|
*/
|
||||||
static inline void MakeSnow(TileIndex t, uint density = 0)
|
inline void MakeSnow(TileIndex t, uint density = 0)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) != CLEAR_SNOW, t);
|
dbg_assert_tile(GetClearGround(t) != CLEAR_SNOW, t);
|
||||||
SetBit(_m[t].m3, 4);
|
SetBit(_m[t].m3, 4);
|
||||||
@@ -313,7 +313,7 @@ static inline void MakeSnow(TileIndex t, uint density = 0)
|
|||||||
* @param t the tile to clear of snow
|
* @param t the tile to clear of snow
|
||||||
* @pre GetClearGround(t) == CLEAR_SNOW
|
* @pre GetClearGround(t) == CLEAR_SNOW
|
||||||
*/
|
*/
|
||||||
static inline void ClearSnow(TileIndex t)
|
inline void ClearSnow(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetClearGround(t) == CLEAR_SNOW, t);
|
dbg_assert_tile(GetClearGround(t) == CLEAR_SNOW, t);
|
||||||
ClrBit(_m[t].m3, 4);
|
ClrBit(_m[t].m3, 4);
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
* @tparam U The type of data passed to us.
|
* @tparam U The type of data passed to us.
|
||||||
* @param v The data to extract the value from.
|
* @param v The data to extract the value from.
|
||||||
*/
|
*/
|
||||||
template<typename T, uint S, uint N, typename U> static inline T Extract(U v)
|
template<typename T, uint S, uint N, typename U> inline T Extract(U v)
|
||||||
{
|
{
|
||||||
/* Check if there are enough bits in v */
|
/* Check if there are enough bits in v */
|
||||||
static_assert(N == EnumPropsT<T>::num_bits);
|
static_assert(N == EnumPropsT<T>::num_bits);
|
||||||
|
@@ -73,7 +73,7 @@ bool IsCommandAllowedWhilePaused(uint32 cmd);
|
|||||||
* @param cmd_flags Flags from GetCommandFlags
|
* @param cmd_flags Flags from GetCommandFlags
|
||||||
* @return flags for DoCommand
|
* @return flags for DoCommand
|
||||||
*/
|
*/
|
||||||
static inline DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
|
inline DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
|
||||||
{
|
{
|
||||||
DoCommandFlag flags = DC_NONE;
|
DoCommandFlag flags = DC_NONE;
|
||||||
if (cmd_flags & CMD_NO_WATER) flags |= DC_NO_WATER;
|
if (cmd_flags & CMD_NO_WATER) flags |= DC_NO_WATER;
|
||||||
|
@@ -43,7 +43,7 @@ extern CompanyManagerFace _company_manager_face;
|
|||||||
* Is the current company the local company?
|
* Is the current company the local company?
|
||||||
* @return \c true of the current company is the local company, \c false otherwise.
|
* @return \c true of the current company is the local company, \c false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool IsLocalCompany()
|
inline bool IsLocalCompany()
|
||||||
{
|
{
|
||||||
return _local_company == _current_company;
|
return _local_company == _current_company;
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ static inline bool IsLocalCompany()
|
|||||||
* @param company Company where interaction is needed with.
|
* @param company Company where interaction is needed with.
|
||||||
* @return Gives \c true if the user can answer questions interactively as representative of \a company, else \c false
|
* @return Gives \c true if the user can answer questions interactively as representative of \a company, else \c false
|
||||||
*/
|
*/
|
||||||
static inline bool IsInteractiveCompany(CompanyID company)
|
inline bool IsInteractiveCompany(CompanyID company)
|
||||||
{
|
{
|
||||||
return company == _local_company;
|
return company == _local_company;
|
||||||
}
|
}
|
||||||
|
@@ -93,7 +93,7 @@ static_assert(lengthof(_cmf_info) == CMFV_END);
|
|||||||
* @pre _cmf_info[cmfv].valid_values[ge] != 0
|
* @pre _cmf_info[cmfv].valid_values[ge] != 0
|
||||||
* @return the requested bits
|
* @return the requested bits
|
||||||
*/
|
*/
|
||||||
static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge)
|
inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge)
|
||||||
{
|
{
|
||||||
assert(_cmf_info[cmfv].valid_values[ge] != 0);
|
assert(_cmf_info[cmfv].valid_values[ge] != 0);
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyMana
|
|||||||
* @param val the new value
|
* @param val the new value
|
||||||
* @pre val < _cmf_info[cmfv].valid_values[ge]
|
* @pre val < _cmf_info[cmfv].valid_values[ge]
|
||||||
*/
|
*/
|
||||||
static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge, uint val)
|
inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge, uint val)
|
||||||
{
|
{
|
||||||
assert(val < _cmf_info[cmfv].valid_values[ge]);
|
assert(val < _cmf_info[cmfv].valid_values[ge]);
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyMan
|
|||||||
*
|
*
|
||||||
* @pre 0 <= val < _cmf_info[cmfv].valid_values[ge]
|
* @pre 0 <= val < _cmf_info[cmfv].valid_values[ge]
|
||||||
*/
|
*/
|
||||||
static inline void IncreaseCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge, int8 amount)
|
inline void IncreaseCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge, int8_t amount)
|
||||||
{
|
{
|
||||||
int8 val = GetCompanyManagerFaceBits(cmf, cmfv, ge) + amount; // the new value for the cmfv
|
int8 val = GetCompanyManagerFaceBits(cmf, cmfv, ge) + amount; // the new value for the cmfv
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ static inline void IncreaseCompanyManagerFaceBits(CompanyManagerFace &cmf, Compa
|
|||||||
* @param ge the gender and ethnicity of the face
|
* @param ge the gender and ethnicity of the face
|
||||||
* @return true if and only if the bits are valid
|
* @return true if and only if the bits are valid
|
||||||
*/
|
*/
|
||||||
static inline bool AreCompanyManagerFaceBitsValid(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
|
inline bool AreCompanyManagerFaceBitsValid(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
|
||||||
{
|
{
|
||||||
return GB(cmf, _cmf_info[cmfv].offset, _cmf_info[cmfv].length) < _cmf_info[cmfv].valid_values[ge];
|
return GB(cmf, _cmf_info[cmfv].offset, _cmf_info[cmfv].length) < _cmf_info[cmfv].valid_values[ge];
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ static inline bool AreCompanyManagerFaceBitsValid(CompanyManagerFace cmf, Compan
|
|||||||
* @pre val < (1U << _cmf_info[cmfv].length), i.e. val has a value of 0..2^(bits used for this variable)-1
|
* @pre val < (1U << _cmf_info[cmfv].length), i.e. val has a value of 0..2^(bits used for this variable)-1
|
||||||
* @return the scaled value
|
* @return the scaled value
|
||||||
*/
|
*/
|
||||||
static inline uint ScaleCompanyManagerFaceValue(CompanyManagerFaceVariable cmfv, GenderEthnicity ge, uint val)
|
inline uint ScaleCompanyManagerFaceValue(CompanyManagerFaceVariable cmfv, GenderEthnicity ge, uint val)
|
||||||
{
|
{
|
||||||
assert(val < (1U << _cmf_info[cmfv].length));
|
assert(val < (1U << _cmf_info[cmfv].length));
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ static inline uint ScaleCompanyManagerFaceValue(CompanyManagerFaceVariable cmfv,
|
|||||||
*
|
*
|
||||||
* @param cmf the company manager's face to write the bits to
|
* @param cmf the company manager's face to write the bits to
|
||||||
*/
|
*/
|
||||||
static inline void ScaleAllCompanyManagerFaceBits(CompanyManagerFace &cmf)
|
inline void ScaleAllCompanyManagerFaceBits(CompanyManagerFace &cmf)
|
||||||
{
|
{
|
||||||
IncreaseCompanyManagerFaceBits(cmf, CMFV_ETHNICITY, GE_WM, 0); // scales the ethnicity
|
IncreaseCompanyManagerFaceBits(cmf, CMFV_ETHNICITY, GE_WM, 0); // scales the ethnicity
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ static inline void ScaleAllCompanyManagerFaceBits(CompanyManagerFace &cmf)
|
|||||||
*
|
*
|
||||||
* @pre scale 'ge' to a valid gender/ethnicity combination
|
* @pre scale 'ge' to a valid gender/ethnicity combination
|
||||||
*/
|
*/
|
||||||
static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, Randomizer &randomizer)
|
inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, Randomizer &randomizer)
|
||||||
{
|
{
|
||||||
cmf = randomizer.Next(); // random all company manager's face bits
|
cmf = randomizer.Next(); // random all company manager's face bits
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderE
|
|||||||
* @pre _cmf_info[cmfv].valid_values[ge] != 0
|
* @pre _cmf_info[cmfv].valid_values[ge] != 0
|
||||||
* @return sprite to draw
|
* @return sprite to draw
|
||||||
*/
|
*/
|
||||||
static inline SpriteID GetCompanyManagerFaceSprite(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
|
inline SpriteID GetCompanyManagerFaceSprite(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
|
||||||
{
|
{
|
||||||
assert(_cmf_info[cmfv].valid_values[ge] != 0);
|
assert(_cmf_info[cmfv].valid_values[ge] != 0);
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ void NORETURN ReallocError(size_t size);
|
|||||||
* @param element_size Size of the structure to allocate.
|
* @param element_size Size of the structure to allocate.
|
||||||
* @param num_elements Number of elements to allocate.
|
* @param num_elements Number of elements to allocate.
|
||||||
*/
|
*/
|
||||||
static inline void CheckAllocationConstraints(size_t element_size, size_t num_elements)
|
inline void CheckAllocationConstraints(size_t element_size, size_t num_elements)
|
||||||
{
|
{
|
||||||
if (num_elements > SIZE_MAX / element_size) MallocError(SIZE_MAX);
|
if (num_elements > SIZE_MAX / element_size) MallocError(SIZE_MAX);
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ static inline void CheckAllocationConstraints(size_t element_size, size_t num_el
|
|||||||
* @param num_elements Number of elements to allocate.
|
* @param num_elements Number of elements to allocate.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void CheckAllocationConstraints(size_t num_elements)
|
inline void CheckAllocationConstraints(size_t num_elements)
|
||||||
{
|
{
|
||||||
CheckAllocationConstraints(sizeof(T), num_elements);
|
CheckAllocationConstraints(sizeof(T), num_elements);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ static inline void CheckAllocationConstraints(size_t num_elements)
|
|||||||
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T *MallocT(size_t num_elements)
|
inline T *MallocT(size_t num_elements)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* MorphOS cannot handle 0 elements allocations, or rather that always
|
* MorphOS cannot handle 0 elements allocations, or rather that always
|
||||||
@@ -82,7 +82,7 @@ static inline T *MallocT(size_t num_elements)
|
|||||||
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T *CallocT(size_t num_elements)
|
inline T *CallocT(size_t num_elements)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* MorphOS cannot handle 0 elements allocations, or rather that always
|
* MorphOS cannot handle 0 elements allocations, or rather that always
|
||||||
@@ -108,7 +108,7 @@ static inline T *CallocT(size_t num_elements)
|
|||||||
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
* @return nullptr when num_elements == 0, non-nullptr otherwise.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T *ReallocT(T *t_ptr, size_t num_elements)
|
inline T *ReallocT(T *t_ptr, size_t num_elements)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* MorphOS cannot handle 0 elements allocations, or rather that always
|
* MorphOS cannot handle 0 elements allocations, or rather that always
|
||||||
|
@@ -57,7 +57,7 @@ debug_inline constexpr static uint GB(const T x, const uint8 s, const uint8 n)
|
|||||||
* @return The new value of \a x
|
* @return The new value of \a x
|
||||||
*/
|
*/
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
static inline T SB(T &x, const uint8 s, const uint8 n, const U d)
|
inline T SB(T &x, const uint8_t s, const uint8_t n, const U d)
|
||||||
{
|
{
|
||||||
x &= (T)(~((((T)1U << n) - 1) << s));
|
x &= (T)(~((((T)1U << n) - 1) << s));
|
||||||
typename std::make_unsigned<T>::type td = d;
|
typename std::make_unsigned<T>::type td = d;
|
||||||
@@ -83,7 +83,7 @@ static inline T SB(T &x, const uint8 s, const uint8 n, const U d)
|
|||||||
* @return The new value of \a x
|
* @return The new value of \a x
|
||||||
*/
|
*/
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
static inline T AB(T &x, const uint8 s, const uint8 n, const U i)
|
inline T AB(T &x, const uint8_t s, const uint8_t n, const U i)
|
||||||
{
|
{
|
||||||
const T mask = ((((T)1U << n) - 1) << s);
|
const T mask = ((((T)1U << n) - 1) << s);
|
||||||
x = (T)((x & ~mask) | ((x + (i << s)) & mask));
|
x = (T)((x & ~mask) | ((x + (i << s)) & mask));
|
||||||
@@ -121,7 +121,7 @@ debug_inline static bool HasBit(const T x, const uint8 y)
|
|||||||
* @return The new value of the old value with the bit set
|
* @return The new value of the old value with the bit set
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T SetBit(T &x, const uint8 y)
|
inline T SetBit(T &x, const uint8_t y)
|
||||||
{
|
{
|
||||||
return x = (T)(x | ((T)1U << y));
|
return x = (T)(x | ((T)1U << y));
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ static inline T SetBit(T &x, const uint8 y)
|
|||||||
* @return The new value of the old value with the bit cleared
|
* @return The new value of the old value with the bit cleared
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T ClrBit(T &x, const uint8 y)
|
inline T ClrBit(T &x, const uint8_t y)
|
||||||
{
|
{
|
||||||
return x = (T)(x & ~((T)1U << y));
|
return x = (T)(x & ~((T)1U << y));
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ static inline T ClrBit(T &x, const uint8 y)
|
|||||||
* @return The new value of the old value with the bit toggled
|
* @return The new value of the old value with the bit toggled
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T ToggleBit(T &x, const uint8 y)
|
inline T ToggleBit(T &x, const uint8_t y)
|
||||||
{
|
{
|
||||||
return x = (T)(x ^ ((T)1U << y));
|
return x = (T)(x ^ ((T)1U << y));
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ extern const uint8 _ffb_64[64];
|
|||||||
* @return The position of the first bit set, or 0 when value is 0
|
* @return The position of the first bit set, or 0 when value is 0
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline uint8 FindFirstBit(T value)
|
inline uint8 FindFirstBit(T value)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
||||||
#ifdef WITH_BITMATH_BUILTINS
|
#ifdef WITH_BITMATH_BUILTINS
|
||||||
@@ -247,7 +247,7 @@ static inline uint8 FindFirstBit(T value)
|
|||||||
* @return The position of the last bit set, or 0 when value is 0
|
* @return The position of the last bit set, or 0 when value is 0
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline uint8 FindLastBit(T value)
|
inline uint8 FindLastBit(T value)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
||||||
#ifdef WITH_BITMATH_BUILTINS
|
#ifdef WITH_BITMATH_BUILTINS
|
||||||
@@ -278,7 +278,7 @@ static inline uint8 FindLastBit(T value)
|
|||||||
* @return The position of the first bit which is set
|
* @return The position of the first bit which is set
|
||||||
* @see FIND_FIRST_BIT
|
* @see FIND_FIRST_BIT
|
||||||
*/
|
*/
|
||||||
static inline uint8 FindFirstBit2x64(const int value)
|
inline uint8_t FindFirstBit2x64(const int value)
|
||||||
{
|
{
|
||||||
#ifdef WITH_BITMATH_BUILTINS
|
#ifdef WITH_BITMATH_BUILTINS
|
||||||
return FindFirstBit(value & 0x3F3F);
|
return FindFirstBit(value & 0x3F3F);
|
||||||
@@ -303,7 +303,7 @@ static inline uint8 FindFirstBit2x64(const int value)
|
|||||||
* @return The new value with the first bit cleared
|
* @return The new value with the first bit cleared
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T KillFirstBit(T value)
|
inline T KillFirstBit(T value)
|
||||||
{
|
{
|
||||||
return value &= (T)(value - 1);
|
return value &= (T)(value - 1);
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ static inline T KillFirstBit(T value)
|
|||||||
* @return the number of bits.
|
* @return the number of bits.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline uint CountBits(T value)
|
inline uint CountBits(T value)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
||||||
#ifdef WITH_BITMATH_BUILTINS
|
#ifdef WITH_BITMATH_BUILTINS
|
||||||
@@ -350,7 +350,7 @@ static inline uint CountBits(T value)
|
|||||||
* @return true if the parity is odd.
|
* @return true if the parity is odd.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline bool IsOddParity(T value)
|
inline bool IsOddParity(T value)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
static_assert(sizeof(T) <= sizeof(unsigned long long));
|
||||||
#ifdef WITH_BITMATH_BUILTINS
|
#ifdef WITH_BITMATH_BUILTINS
|
||||||
@@ -374,7 +374,7 @@ static inline bool IsOddParity(T value)
|
|||||||
* @return does \a value have exactly 1 bit set?
|
* @return does \a value have exactly 1 bit set?
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline bool HasExactlyOneBit(T value)
|
inline bool HasExactlyOneBit(T value)
|
||||||
{
|
{
|
||||||
return value != 0 && (value & (value - 1)) == 0;
|
return value != 0 && (value & (value - 1)) == 0;
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ static inline bool HasExactlyOneBit(T value)
|
|||||||
* @return does \a value have at most 1 bit set?
|
* @return does \a value have at most 1 bit set?
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline bool HasAtMostOneBit(T value)
|
inline bool HasAtMostOneBit(T value)
|
||||||
{
|
{
|
||||||
return (value & (value - 1)) == 0;
|
return (value & (value - 1)) == 0;
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ static inline bool HasAtMostOneBit(T value)
|
|||||||
* @return A bit rotated number
|
* @return A bit rotated number
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T ROL(const T x, const uint8 n)
|
inline T ROL(const T x, const uint8_t n)
|
||||||
{
|
{
|
||||||
if (n == 0) return x;
|
if (n == 0) return x;
|
||||||
return (T)(x << n | x >> (sizeof(x) * 8 - n));
|
return (T)(x << n | x >> (sizeof(x) * 8 - n));
|
||||||
@@ -417,7 +417,7 @@ static inline T ROL(const T x, const uint8 n)
|
|||||||
* @return A bit rotated number
|
* @return A bit rotated number
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T ROR(const T x, const uint8 n)
|
inline T ROR(const T x, const uint8_t n)
|
||||||
{
|
{
|
||||||
if (n == 0) return x;
|
if (n == 0) return x;
|
||||||
return (T)(x >> n | x << (sizeof(x) * 8 - n));
|
return (T)(x >> n | x << (sizeof(x) * 8 - n));
|
||||||
|
@@ -46,12 +46,12 @@
|
|||||||
#define TO_LE64(x) (x)
|
#define TO_LE64(x) (x)
|
||||||
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
|
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
|
||||||
|
|
||||||
static inline uint16 ReadLE16Aligned(const void *x)
|
inline uint16_t ReadLE16Aligned(const void *x)
|
||||||
{
|
{
|
||||||
return FROM_LE16(*(const uint16*)x);
|
return FROM_LE16(*(const uint16*)x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16 ReadLE16Unaligned(const void *x)
|
inline uint16_t ReadLE16Unaligned(const void *x)
|
||||||
{
|
{
|
||||||
#if OTTD_ALIGNMENT == 1
|
#if OTTD_ALIGNMENT == 1
|
||||||
return ((const byte*)x)[0] | ((const byte*)x)[1] << 8;
|
return ((const byte*)x)[0] | ((const byte*)x)[1] << 8;
|
||||||
|
@@ -20,7 +20,7 @@ Dimension adddim(const Dimension &d1, const Dimension &d2);
|
|||||||
* @param r Rectangle to check.
|
* @param r Rectangle to check.
|
||||||
* @return True if and only if the rectangle doesn't define space.
|
* @return True if and only if the rectangle doesn't define space.
|
||||||
*/
|
*/
|
||||||
static inline bool IsEmptyRect(const Rect &r)
|
inline bool IsEmptyRect(const Rect &r)
|
||||||
{
|
{
|
||||||
return (r.left | r.top | r.right | r.bottom) == 0;
|
return (r.left | r.top | r.right | r.bottom) == 0;
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
* @return The unsigned value
|
* @return The unsigned value
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T abs(const T a)
|
inline T abs(const T a)
|
||||||
{
|
{
|
||||||
return (a < (T)0) ? -a : a;
|
return (a < (T)0) ? -a : a;
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ static inline T abs(const T a)
|
|||||||
* @return The smallest multiple of n equal or greater than x
|
* @return The smallest multiple of n equal or greater than x
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T Align(const T x, uint n)
|
inline T Align(const T x, uint n)
|
||||||
{
|
{
|
||||||
assert((n & (n - 1)) == 0 && n != 0);
|
assert((n & (n - 1)) == 0 && n != 0);
|
||||||
n--;
|
n--;
|
||||||
@@ -55,7 +55,7 @@ static inline T Align(const T x, uint n)
|
|||||||
* @see Align()
|
* @see Align()
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T *AlignPtr(T *x, uint n)
|
inline T *AlignPtr(T *x, uint n)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(size_t) == sizeof(void *));
|
static_assert(sizeof(size_t) == sizeof(void *));
|
||||||
return reinterpret_cast<T *>(Align((size_t)x, n));
|
return reinterpret_cast<T *>(Align((size_t)x, n));
|
||||||
@@ -79,7 +79,7 @@ static inline T *AlignPtr(T *x, uint n)
|
|||||||
* @see Clamp(int, int, int)
|
* @see Clamp(int, int, int)
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T Clamp(const T a, const T min, const T max)
|
inline T Clamp(const T a, const T min, const T max)
|
||||||
{
|
{
|
||||||
assert(min <= max);
|
assert(min <= max);
|
||||||
if (a <= min) return min;
|
if (a <= min) return min;
|
||||||
@@ -102,7 +102,7 @@ static inline T Clamp(const T a, const T min, const T max)
|
|||||||
* @returns A value between min and max which is closest to a.
|
* @returns A value between min and max which is closest to a.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T SoftClamp(const T a, const T min, const T max)
|
inline T SoftClamp(const T a, const T min, const T max)
|
||||||
{
|
{
|
||||||
if (min > max) {
|
if (min > max) {
|
||||||
using U = std::make_unsigned_t<T>;
|
using U = std::make_unsigned_t<T>;
|
||||||
@@ -129,7 +129,7 @@ static inline T SoftClamp(const T a, const T min, const T max)
|
|||||||
* @returns A value between min and max which is closest to a.
|
* @returns A value between min and max which is closest to a.
|
||||||
* @see ClampU(uint, uint, uint)
|
* @see ClampU(uint, uint, uint)
|
||||||
*/
|
*/
|
||||||
static inline int Clamp(const int a, const int min, const int max)
|
inline int Clamp(const int a, const int min, const int max)
|
||||||
{
|
{
|
||||||
return Clamp<int>(a, min, max);
|
return Clamp<int>(a, min, max);
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ static inline int Clamp(const int a, const int min, const int max)
|
|||||||
* @returns A value between min and max which is closest to a.
|
* @returns A value between min and max which is closest to a.
|
||||||
* @see Clamp(int, int, int)
|
* @see Clamp(int, int, int)
|
||||||
*/
|
*/
|
||||||
static inline uint ClampU(const uint a, const uint min, const uint max)
|
inline uint ClampU(const uint a, const uint min, const uint max)
|
||||||
{
|
{
|
||||||
return Clamp<uint>(a, min, max);
|
return Clamp<uint>(a, min, max);
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ constexpr To ClampTo(From value)
|
|||||||
* @return The absolute difference between the given scalars
|
* @return The absolute difference between the given scalars
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T Delta(const T a, const T b)
|
inline T Delta(const T a, const T b)
|
||||||
{
|
{
|
||||||
return (a < b) ? b - a : a - b;
|
return (a < b) ? b - a : a - b;
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ static inline T Delta(const T a, const T b)
|
|||||||
* @return True if the value is in the interval, false else.
|
* @return True if the value is in the interval, false else.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline bool IsInsideBS(const T x, const size_t base, const size_t size)
|
inline bool IsInsideBS(const T x, const size_t base, const size_t size)
|
||||||
{
|
{
|
||||||
return (size_t)(x - base) < size;
|
return (size_t)(x - base) < size;
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ static constexpr inline bool IsInsideMM(const T x, const size_t min, const size_
|
|||||||
* @param b variable to swap with a
|
* @param b variable to swap with a
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void Swap(T &a, T &b)
|
inline void Swap(T &a, T &b)
|
||||||
{
|
{
|
||||||
T t = a;
|
T t = a;
|
||||||
a = b;
|
a = b;
|
||||||
@@ -295,7 +295,7 @@ static inline void Swap(T &a, T &b)
|
|||||||
* @param i value to convert, range 0..255
|
* @param i value to convert, range 0..255
|
||||||
* @return value in range 0..100
|
* @return value in range 0..100
|
||||||
*/
|
*/
|
||||||
static inline uint ToPercent8(uint i)
|
inline uint ToPercent8(uint i)
|
||||||
{
|
{
|
||||||
assert(i < 256);
|
assert(i < 256);
|
||||||
return i * 101 >> 8;
|
return i * 101 >> 8;
|
||||||
@@ -306,7 +306,7 @@ static inline uint ToPercent8(uint i)
|
|||||||
* @param i value to convert, range 0..65535
|
* @param i value to convert, range 0..65535
|
||||||
* @return value in range 0..100
|
* @return value in range 0..100
|
||||||
*/
|
*/
|
||||||
static inline uint ToPercent16(uint i)
|
inline uint ToPercent16(uint i)
|
||||||
{
|
{
|
||||||
assert(i < 65536);
|
assert(i < 65536);
|
||||||
return i * 101 >> 16;
|
return i * 101 >> 16;
|
||||||
@@ -322,7 +322,7 @@ int DivideApprox(int a, int b);
|
|||||||
* @param b Denominator
|
* @param b Denominator
|
||||||
* @return Quotient, rounded up
|
* @return Quotient, rounded up
|
||||||
*/
|
*/
|
||||||
static inline uint CeilDiv(uint a, uint b)
|
inline uint CeilDiv(uint a, uint b)
|
||||||
{
|
{
|
||||||
return (a + b - 1) / b;
|
return (a + b - 1) / b;
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ static inline uint CeilDiv(uint a, uint b)
|
|||||||
* @return Quotient, rounded up
|
* @return Quotient, rounded up
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T CeilDivT(T a, T b)
|
inline T CeilDivT(T a, T b)
|
||||||
{
|
{
|
||||||
return (a + b - 1) / b;
|
return (a + b - 1) / b;
|
||||||
}
|
}
|
||||||
@@ -345,7 +345,7 @@ static inline T CeilDivT(T a, T b)
|
|||||||
* @param b Denominator
|
* @param b Denominator
|
||||||
* @return a rounded up to the nearest multiple of b.
|
* @return a rounded up to the nearest multiple of b.
|
||||||
*/
|
*/
|
||||||
static inline uint Ceil(uint a, uint b)
|
inline uint Ceil(uint a, uint b)
|
||||||
{
|
{
|
||||||
return CeilDiv(a, b) * b;
|
return CeilDiv(a, b) * b;
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ static inline uint Ceil(uint a, uint b)
|
|||||||
* @return a rounded up to the nearest multiple of b.
|
* @return a rounded up to the nearest multiple of b.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T CeilT(T a, T b)
|
inline T CeilT(T a, T b)
|
||||||
{
|
{
|
||||||
return CeilDivT<T>(a, b) * b;
|
return CeilDivT<T>(a, b) * b;
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ static inline T CeilT(T a, T b)
|
|||||||
* @param b Denominator
|
* @param b Denominator
|
||||||
* @return Quotient, rounded to nearest
|
* @return Quotient, rounded to nearest
|
||||||
*/
|
*/
|
||||||
static inline int RoundDivSU(int a, uint b)
|
inline int RoundDivSU(int a, uint b)
|
||||||
{
|
{
|
||||||
if (a > 0) {
|
if (a > 0) {
|
||||||
/* 0.5 is rounded to 1 */
|
/* 0.5 is rounded to 1 */
|
||||||
@@ -385,7 +385,7 @@ static inline int RoundDivSU(int a, uint b)
|
|||||||
* @param b Denominator
|
* @param b Denominator
|
||||||
* @return Quotient, rounded away from zero
|
* @return Quotient, rounded away from zero
|
||||||
*/
|
*/
|
||||||
static inline int DivAwayFromZero(int a, uint b)
|
inline int DivAwayFromZero(int a, uint b)
|
||||||
{
|
{
|
||||||
const int _b = static_cast<int>(b);
|
const int _b = static_cast<int>(b);
|
||||||
if (a > 0) {
|
if (a > 0) {
|
||||||
@@ -403,7 +403,7 @@ static inline int DivAwayFromZero(int a, uint b)
|
|||||||
* @return Quotient, rounded towards negative infinity
|
* @return Quotient, rounded towards negative infinity
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T DivTowardsNegativeInf(T a, T b)
|
inline T DivTowardsNegativeInf(T a, T b)
|
||||||
{
|
{
|
||||||
return (a / b) - (a % b < 0 ? 1 : 0);
|
return (a / b) - (a % b < 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
@@ -415,7 +415,7 @@ static inline T DivTowardsNegativeInf(T a, T b)
|
|||||||
* @return Quotient, rounded towards positive infinity
|
* @return Quotient, rounded towards positive infinity
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T DivTowardsPositiveInf(T a, T b)
|
inline T DivTowardsPositiveInf(T a, T b)
|
||||||
{
|
{
|
||||||
return (a / b) + (a % b > 0 ? 1 : 0);
|
return (a / b) + (a % b > 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
* @param num number of items to be copied. (!not number of bytes!)
|
* @param num number of items to be copied. (!not number of bytes!)
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void MemCpyT(T *destination, const T *source, size_t num = 1)
|
inline void MemCpyT(T *destination, const T *source, size_t num = 1)
|
||||||
{
|
{
|
||||||
memcpy(destination, source, num * sizeof(T));
|
memcpy(destination, source, num * sizeof(T));
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ static inline void MemCpyT(T *destination, const T *source, size_t num = 1)
|
|||||||
* @param num number of items to be copied. (!not number of bytes!)
|
* @param num number of items to be copied. (!not number of bytes!)
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void MemMoveT(T *destination, const T *source, size_t num = 1)
|
inline void MemMoveT(T *destination, const T *source, size_t num = 1)
|
||||||
{
|
{
|
||||||
memmove(destination, source, num * sizeof(T));
|
memmove(destination, source, num * sizeof(T));
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ static inline void MemMoveT(T *destination, const T *source, size_t num = 1)
|
|||||||
* @param num number of items to be set (!not number of bytes!)
|
* @param num number of items to be set (!not number of bytes!)
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void MemSetT(T *ptr, byte value, size_t num = 1)
|
inline void MemSetT(T *ptr, byte value, size_t num = 1)
|
||||||
{
|
{
|
||||||
memset(ptr, value, num * sizeof(T));
|
memset(ptr, value, num * sizeof(T));
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ static inline void MemSetT(T *ptr, byte value, size_t num = 1)
|
|||||||
* @return an int value indicating the relationship between the content of the two buffers
|
* @return an int value indicating the relationship between the content of the two buffers
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline int MemCmpT(const T *ptr1, const T *ptr2, size_t num = 1)
|
inline int MemCmpT(const T *ptr1, const T *ptr2, size_t num = 1)
|
||||||
{
|
{
|
||||||
return memcmp(ptr1, ptr2, num * sizeof(T));
|
return memcmp(ptr1, ptr2, num * sizeof(T));
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ struct SavedRandomSeeds {
|
|||||||
* Saves the current seeds
|
* Saves the current seeds
|
||||||
* @param storage Storage for saving
|
* @param storage Storage for saving
|
||||||
*/
|
*/
|
||||||
static inline void SaveRandomSeeds(SavedRandomSeeds *storage)
|
inline void SaveRandomSeeds(SavedRandomSeeds *storage)
|
||||||
{
|
{
|
||||||
storage->random = _random;
|
storage->random = _random;
|
||||||
storage->interactive_random = _interactive_random;
|
storage->interactive_random = _interactive_random;
|
||||||
@@ -51,7 +51,7 @@ static inline void SaveRandomSeeds(SavedRandomSeeds *storage)
|
|||||||
* Restores previously saved seeds
|
* Restores previously saved seeds
|
||||||
* @param storage Storage where SaveRandomSeeds() stored the seeds
|
* @param storage Storage where SaveRandomSeeds() stored the seeds
|
||||||
*/
|
*/
|
||||||
static inline void RestoreRandomSeeds(const SavedRandomSeeds &storage)
|
inline void RestoreRandomSeeds(const SavedRandomSeeds &storage)
|
||||||
{
|
{
|
||||||
_random = storage.random;
|
_random = storage.random;
|
||||||
_interactive_random = storage.interactive_random;
|
_interactive_random = storage.interactive_random;
|
||||||
@@ -102,12 +102,12 @@ void SetRandomSeed(uint32 seed);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline uint32 InteractiveRandom()
|
inline uint32_t InteractiveRandom()
|
||||||
{
|
{
|
||||||
return _interactive_random.Next();
|
return _interactive_random.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 InteractiveRandomRange(uint32 limit)
|
inline uint32_t InteractiveRandomRange(uint32_t limit)
|
||||||
{
|
{
|
||||||
return _interactive_random.Next(limit);
|
return _interactive_random.Next(limit);
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ static inline uint32 InteractiveRandomRange(uint32 limit)
|
|||||||
* @param r The given randomize-number
|
* @param r The given randomize-number
|
||||||
* @return True if the probability given by r is less or equal to (a/b)
|
* @return True if the probability given by r is less or equal to (a/b)
|
||||||
*/
|
*/
|
||||||
static inline bool Chance16I(const uint a, const uint b, const uint32 r)
|
inline bool Chance16I(const uint a, const uint b, const uint32_t r)
|
||||||
{
|
{
|
||||||
assert(b != 0);
|
assert(b != 0);
|
||||||
return (((uint16)r * b + b / 2) >> 16) < a;
|
return (((uint16)r * b + b / 2) >> 16) < a;
|
||||||
@@ -146,7 +146,7 @@ static inline bool Chance16I(const uint a, const uint b, const uint32 r)
|
|||||||
#ifdef RANDOM_DEBUG
|
#ifdef RANDOM_DEBUG
|
||||||
# define Chance16(a, b) Chance16I(a, b, DoRandom(__LINE__, __FILE__))
|
# define Chance16(a, b) Chance16I(a, b, DoRandom(__LINE__, __FILE__))
|
||||||
#else
|
#else
|
||||||
static inline bool Chance16(const uint a, const uint b)
|
inline bool Chance16(const uint a, const uint b)
|
||||||
{
|
{
|
||||||
return Chance16I(a, b, Random());
|
return Chance16I(a, b, Random());
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ static inline bool Chance16(const uint a, const uint b)
|
|||||||
#ifdef RANDOM_DEBUG
|
#ifdef RANDOM_DEBUG
|
||||||
# define Chance16R(a, b, r) (r = DoRandom(__LINE__, __FILE__), Chance16I(a, b, r))
|
# define Chance16R(a, b, r) (r = DoRandom(__LINE__, __FILE__), Chance16I(a, b, r))
|
||||||
#else
|
#else
|
||||||
static inline bool Chance16R(const uint a, const uint b, uint32 &r)
|
inline bool Chance16R(const uint a, const uint b, uint32_t &r)
|
||||||
{
|
{
|
||||||
r = Random();
|
r = Random();
|
||||||
return Chance16I(a, b, r);
|
return Chance16I(a, b, r);
|
||||||
|
@@ -45,27 +45,27 @@ inline Date ConvertYMDToDate(const YearMonthDay &ymd)
|
|||||||
* @param yr The year to check.
|
* @param yr The year to check.
|
||||||
* @return True if \c yr is a leap year, otherwise false.
|
* @return True if \c yr is a leap year, otherwise false.
|
||||||
*/
|
*/
|
||||||
static inline bool IsLeapYear(Year yr)
|
inline bool IsLeapYear(Year yr)
|
||||||
{
|
{
|
||||||
return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0);
|
return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Date ScaledDateTicksToDate(DateTicksScaled ticks)
|
inline Date ScaledDateTicksToDate(DateTicksScaled ticks)
|
||||||
{
|
{
|
||||||
return (ticks.base() - _scaled_date_ticks_offset.base()) / (DAY_TICKS * _settings_game.economy.day_length_factor);
|
return (ticks.base() - _scaled_date_ticks_offset.base()) / (DAY_TICKS * _settings_game.economy.day_length_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DateTicksScaled DateToScaledDateTicks(Date date)
|
inline DateTicksScaled DateToScaledDateTicks(Date date)
|
||||||
{
|
{
|
||||||
return ((int64)date.base() * DAY_TICKS * _settings_game.economy.day_length_factor) + _scaled_date_ticks_offset.base();
|
return ((int64)date.base() * DAY_TICKS * _settings_game.economy.day_length_factor) + _scaled_date_ticks_offset.base();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DateTicks ScaledDateTicksToDateTicks(DateTicksScaled ticks)
|
inline DateTicks ScaledDateTicksToDateTicks(DateTicksScaled ticks)
|
||||||
{
|
{
|
||||||
return (ticks.base() - _scaled_date_ticks_offset.base()) / _settings_game.economy.day_length_factor;
|
return (ticks.base() - _scaled_date_ticks_offset.base()) / _settings_game.economy.day_length_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DateTicksScaled DateTicksToScaledDateTicks(DateTicks date_ticks)
|
inline DateTicksScaled DateTicksToScaledDateTicks(DateTicks date_ticks)
|
||||||
{
|
{
|
||||||
return ((int64)date_ticks.base() * _settings_game.economy.day_length_factor) + _scaled_date_ticks_offset.base();
|
return ((int64)date_ticks.base() * _settings_game.economy.day_length_factor) + _scaled_date_ticks_offset.base();
|
||||||
}
|
}
|
||||||
@@ -75,27 +75,27 @@ static inline DateTicksScaled DateTicksToScaledDateTicks(DateTicks date_ticks)
|
|||||||
* @param date The date to consider.
|
* @param date The date to consider.
|
||||||
* @return the year.
|
* @return the year.
|
||||||
*/
|
*/
|
||||||
static constexpr Year DateToYear(Date date)
|
inline constexpr Year DateToYear(Date date)
|
||||||
{
|
{
|
||||||
return date.base() / DAYS_IN_LEAP_YEAR;
|
return date.base() / DAYS_IN_LEAP_YEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Year DateDeltaToYears(DateDelta date)
|
inline constexpr Year DateDeltaToYears(DateDelta date)
|
||||||
{
|
{
|
||||||
return date.base() / DAYS_IN_LEAP_YEAR;
|
return date.base() / DAYS_IN_LEAP_YEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr DateTicks DateToDateTicks(Date date, DateFract fract = 0)
|
inline constexpr DateTicks DateToDateTicks(Date date, DateFract fract = 0)
|
||||||
{
|
{
|
||||||
return (date.base() * DAY_TICKS) + fract;
|
return (date.base() * DAY_TICKS) + fract;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr DateTicksDelta DateDeltaToDateTicksDelta(DateDelta date, DateFract fract = 0)
|
inline constexpr DateTicksDelta DateDeltaToDateTicksDelta(DateDelta date, DateFract fract = 0)
|
||||||
{
|
{
|
||||||
return (date.base() * DAY_TICKS) + fract;
|
return (date.base() * DAY_TICKS) + fract;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DateTicks NowDateTicks()
|
inline DateTicks NowDateTicks()
|
||||||
{
|
{
|
||||||
return DateToDateTicks(_date, _date_fract);
|
return DateToDateTicks(_date, _date_fract);
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v);
|
|||||||
* @param tileh The slope of the tile in question
|
* @param tileh The slope of the tile in question
|
||||||
* @return true if the construction is possible
|
* @return true if the construction is possible
|
||||||
*/
|
*/
|
||||||
static inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
|
inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
|
||||||
{
|
{
|
||||||
assert(tileh != SLOPE_FLAT);
|
assert(tileh != SLOPE_FLAT);
|
||||||
Slope entrance_corners = InclinedSlope(direction);
|
Slope entrance_corners = InclinedSlope(direction);
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
/**
|
/**
|
||||||
* Check if a tile is a depot and it is a depot of the given type.
|
* Check if a tile is a depot and it is a depot of the given type.
|
||||||
*/
|
*/
|
||||||
static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
|
inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
@@ -38,7 +38,7 @@ static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
|
|||||||
* @param tile the tile to check
|
* @param tile the tile to check
|
||||||
* @return true if and only if there is a depot on the tile.
|
* @return true if and only if there is a depot on the tile.
|
||||||
*/
|
*/
|
||||||
static inline bool IsDepotTile(TileIndex tile)
|
inline bool IsDepotTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
|
return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ static inline bool IsDepotTile(TileIndex tile)
|
|||||||
* @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)
|
* @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)
|
||||||
* @return DepotID
|
* @return DepotID
|
||||||
*/
|
*/
|
||||||
static inline DepotID GetDepotIndex(TileIndex t)
|
inline DepotID GetDepotIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
/* Hangars don't have a Depot class, thus store no DepotID. */
|
/* Hangars don't have a Depot class, thus store no DepotID. */
|
||||||
dbg_assert_tile(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t), t);
|
dbg_assert_tile(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t), t);
|
||||||
@@ -62,7 +62,7 @@ static inline DepotID GetDepotIndex(TileIndex t)
|
|||||||
* @pre IsDepotTile(t)
|
* @pre IsDepotTile(t)
|
||||||
* @return the type of vehicles that can use the depot
|
* @return the type of vehicles that can use the depot
|
||||||
*/
|
*/
|
||||||
static inline VehicleType GetDepotVehicleType(TileIndex t)
|
inline VehicleType GetDepotVehicleType(TileIndex t)
|
||||||
{
|
{
|
||||||
switch (GetTileType(t)) {
|
switch (GetTileType(t)) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
* @param d The value to check
|
* @param d The value to check
|
||||||
* @return True if the value belongs to a DiagDirection, else false
|
* @return True if the value belongs to a DiagDirection, else false
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidDiagDirection(DiagDirection d)
|
inline bool IsValidDiagDirection(DiagDirection d)
|
||||||
{
|
{
|
||||||
return d < DIAGDIR_END;
|
return d < DIAGDIR_END;
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ static inline bool IsValidDiagDirection(DiagDirection d)
|
|||||||
* @param d The value to check
|
* @param d The value to check
|
||||||
* @return True if the value belongs to a Direction, else false
|
* @return True if the value belongs to a Direction, else false
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidDirection(Direction d)
|
inline bool IsValidDirection(Direction d)
|
||||||
{
|
{
|
||||||
return d < DIR_END;
|
return d < DIR_END;
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ static inline bool IsValidDirection(Direction d)
|
|||||||
* @param d The value to check
|
* @param d The value to check
|
||||||
* @return True if the value belongs to an Axis, else false
|
* @return True if the value belongs to an Axis, else false
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidAxis(Axis d)
|
inline bool IsValidAxis(Axis d)
|
||||||
{
|
{
|
||||||
return d < AXIS_END;
|
return d < AXIS_END;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ static inline bool IsValidAxis(Axis d)
|
|||||||
* @param d The direction to get the reverse from
|
* @param d The direction to get the reverse from
|
||||||
* @return The reverse Direction
|
* @return The reverse Direction
|
||||||
*/
|
*/
|
||||||
static inline Direction ReverseDir(Direction d)
|
inline Direction ReverseDir(Direction d)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(d));
|
dbg_assert(IsValidDirection(d));
|
||||||
return (Direction)(4 ^ d);
|
return (Direction)(4 ^ d);
|
||||||
@@ -65,7 +65,7 @@ static inline Direction ReverseDir(Direction d)
|
|||||||
* @param d1 The second direction as the offset from the base
|
* @param d1 The second direction as the offset from the base
|
||||||
* @return The difference how the second direction drifts of the first one.
|
* @return The difference how the second direction drifts of the first one.
|
||||||
*/
|
*/
|
||||||
static inline DirDiff DirDifference(Direction d0, Direction d1)
|
inline DirDiff DirDifference(Direction d0, Direction d1)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(d0));
|
dbg_assert(IsValidDirection(d0));
|
||||||
dbg_assert(IsValidDirection(d1));
|
dbg_assert(IsValidDirection(d1));
|
||||||
@@ -85,7 +85,7 @@ static inline DirDiff DirDifference(Direction d0, Direction d1)
|
|||||||
* @param delta The second difference to add on
|
* @param delta The second difference to add on
|
||||||
* @return The resulting difference
|
* @return The resulting difference
|
||||||
*/
|
*/
|
||||||
static inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
|
inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
|
||||||
{
|
{
|
||||||
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
||||||
return (DirDiff)((uint)(d + delta) % 8);
|
return (DirDiff)((uint)(d + delta) % 8);
|
||||||
@@ -101,7 +101,7 @@ static inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
|
|||||||
* @param delta The offset/drift applied to the direction
|
* @param delta The offset/drift applied to the direction
|
||||||
* @return The new direction
|
* @return The new direction
|
||||||
*/
|
*/
|
||||||
static inline Direction ChangeDir(Direction d, DirDiff delta)
|
inline Direction ChangeDir(Direction d, DirDiff delta)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(d));
|
dbg_assert(IsValidDirection(d));
|
||||||
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
||||||
@@ -115,7 +115,7 @@ static inline Direction ChangeDir(Direction d, DirDiff delta)
|
|||||||
* @param d The DiagDirection to get the reverse from
|
* @param d The DiagDirection to get the reverse from
|
||||||
* @return The reverse direction
|
* @return The reverse direction
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection ReverseDiagDir(DiagDirection d)
|
inline DiagDirection ReverseDiagDir(DiagDirection d)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(d));
|
dbg_assert(IsValidDiagDirection(d));
|
||||||
return (DiagDirection)(2 ^ d);
|
return (DiagDirection)(2 ^ d);
|
||||||
@@ -128,7 +128,7 @@ static inline DiagDirection ReverseDiagDir(DiagDirection d)
|
|||||||
* @param d1 The second direction as the offset from the base
|
* @param d1 The second direction as the offset from the base
|
||||||
* @return The difference how the second direction drifts of the first one.
|
* @return The difference how the second direction drifts of the first one.
|
||||||
*/
|
*/
|
||||||
static inline DiagDirDiff DiagDirDifference(DiagDirection d0, DiagDirection d1)
|
inline DiagDirDiff DiagDirDifference(DiagDirection d0, DiagDirection d1)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(d0));
|
dbg_assert(IsValidDiagDirection(d0));
|
||||||
dbg_assert(IsValidDiagDirection(d1));
|
dbg_assert(IsValidDiagDirection(d1));
|
||||||
@@ -146,7 +146,7 @@ static inline DiagDirDiff DiagDirDifference(DiagDirection d0, DiagDirection d1)
|
|||||||
* @param delta The difference to apply on
|
* @param delta The difference to apply on
|
||||||
* @return The new direction which was calculated
|
* @return The new direction which was calculated
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
|
inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(d));
|
dbg_assert(IsValidDiagDirection(d));
|
||||||
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
/* Cast to uint so compiler can use bitmask. Result can never be negative. */
|
||||||
@@ -163,7 +163,7 @@ static inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
|
|||||||
* @param dir The direction to convert
|
* @param dir The direction to convert
|
||||||
* @return The resulting DiagDirection, maybe "rounded clockwise".
|
* @return The resulting DiagDirection, maybe "rounded clockwise".
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection DirToDiagDir(Direction dir)
|
inline DiagDirection DirToDiagDir(Direction dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(dir));
|
dbg_assert(IsValidDirection(dir));
|
||||||
return (DiagDirection)(dir >> 1);
|
return (DiagDirection)(dir >> 1);
|
||||||
@@ -179,7 +179,7 @@ static inline DiagDirection DirToDiagDir(Direction dir)
|
|||||||
* @param dir The direction to convert
|
* @param dir The direction to convert
|
||||||
* @return The resulting Direction
|
* @return The resulting Direction
|
||||||
*/
|
*/
|
||||||
static inline Direction DiagDirToDir(DiagDirection dir)
|
inline Direction DiagDirToDir(DiagDirection dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(dir));
|
dbg_assert(IsValidDiagDirection(dir));
|
||||||
return (Direction)(dir * 2 + 1);
|
return (Direction)(dir * 2 + 1);
|
||||||
@@ -194,7 +194,7 @@ static inline Direction DiagDirToDir(DiagDirection dir)
|
|||||||
* @param a The given axis
|
* @param a The given axis
|
||||||
* @return The other axis
|
* @return The other axis
|
||||||
*/
|
*/
|
||||||
static inline Axis OtherAxis(Axis a)
|
inline Axis OtherAxis(Axis a)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(a));
|
dbg_assert(IsValidAxis(a));
|
||||||
return (Axis)(a ^ 1);
|
return (Axis)(a ^ 1);
|
||||||
@@ -211,7 +211,7 @@ static inline Axis OtherAxis(Axis a)
|
|||||||
* @param d The DiagDirection
|
* @param d The DiagDirection
|
||||||
* @return The axis which belongs to the direction
|
* @return The axis which belongs to the direction
|
||||||
*/
|
*/
|
||||||
static inline Axis DiagDirToAxis(DiagDirection d)
|
inline Axis DiagDirToAxis(DiagDirection d)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(d));
|
dbg_assert(IsValidDiagDirection(d));
|
||||||
return (Axis)(d & 1);
|
return (Axis)(d & 1);
|
||||||
@@ -229,7 +229,7 @@ static inline Axis DiagDirToAxis(DiagDirection d)
|
|||||||
* @param a The axis
|
* @param a The axis
|
||||||
* @return The direction pointed to south
|
* @return The direction pointed to south
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection AxisToDiagDir(Axis a)
|
inline DiagDirection AxisToDiagDir(Axis a)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(a));
|
dbg_assert(IsValidAxis(a));
|
||||||
return (DiagDirection)(2 - a);
|
return (DiagDirection)(2 - a);
|
||||||
@@ -246,7 +246,7 @@ static inline DiagDirection AxisToDiagDir(Axis a)
|
|||||||
* @param a The axis
|
* @param a The axis
|
||||||
* @return The direction pointed to south
|
* @return The direction pointed to south
|
||||||
*/
|
*/
|
||||||
static inline Direction AxisToDirection(Axis a)
|
inline Direction AxisToDirection(Axis a)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(a));
|
dbg_assert(IsValidAxis(a));
|
||||||
return (Direction)(5 - 2 * a);
|
return (Direction)(5 - 2 * a);
|
||||||
@@ -258,7 +258,7 @@ static inline Direction AxisToDirection(Axis a)
|
|||||||
* @param ns north -> 0, south -> 1
|
* @param ns north -> 0, south -> 1
|
||||||
* @return the desired DiagDirection
|
* @return the desired DiagDirection
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection XYNSToDiagDir(Axis xy, uint ns)
|
inline DiagDirection XYNSToDiagDir(Axis xy, uint ns)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(xy));
|
dbg_assert(IsValidAxis(xy));
|
||||||
return (DiagDirection)(xy * 3 ^ ns * 2);
|
return (DiagDirection)(xy * 3 ^ ns * 2);
|
||||||
@@ -270,7 +270,7 @@ static inline DiagDirection XYNSToDiagDir(Axis xy, uint ns)
|
|||||||
* @param dir The given direction.
|
* @param dir The given direction.
|
||||||
* @return True if the direction is diagonal.
|
* @return True if the direction is diagonal.
|
||||||
*/
|
*/
|
||||||
static inline bool IsDiagonalDirection(Direction dir)
|
inline bool IsDiagonalDirection(Direction dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(dir));
|
dbg_assert(IsValidDirection(dir));
|
||||||
return (dir & 1) != 0;
|
return (dir & 1) != 0;
|
||||||
@@ -287,7 +287,7 @@ static inline bool IsDiagonalDirection(Direction dir)
|
|||||||
* @param axis axis to convert
|
* @param axis axis to convert
|
||||||
* @return The resulting DiagDirection, may be INVALID_DIAGDIR
|
* @return The resulting DiagDirection, may be INVALID_DIAGDIR
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection DirToDiagDirAlongAxis(Direction dir, Axis axis)
|
inline DiagDirection DirToDiagDirAlongAxis(Direction dir, Axis axis)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDirection(dir));
|
dbg_assert(IsValidDirection(dir));
|
||||||
dbg_assert(IsValidAxis(axis));
|
dbg_assert(IsValidAxis(axis));
|
||||||
|
@@ -44,7 +44,7 @@ bool AddInflation(bool check_year = true);
|
|||||||
* Is the economy in recession?
|
* Is the economy in recession?
|
||||||
* @return \c True if economy is in recession, \c false otherwise.
|
* @return \c True if economy is in recession, \c false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool EconomyIsInRecession()
|
inline bool EconomyIsInRecession()
|
||||||
{
|
{
|
||||||
return _economy.fluct <= 0;
|
return _economy.fluct <= 0;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
* Test if a rail type has catenary
|
* Test if a rail type has catenary
|
||||||
* @param rt Rail type to test
|
* @param rt Rail type to test
|
||||||
*/
|
*/
|
||||||
static inline bool HasRailCatenary(RailType rt)
|
inline bool HasRailCatenary(RailType rt)
|
||||||
{
|
{
|
||||||
return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
|
return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ static inline bool HasRailCatenary(RailType rt)
|
|||||||
* Test if we should draw rail catenary
|
* Test if we should draw rail catenary
|
||||||
* @param rt Rail type to test
|
* @param rt Rail type to test
|
||||||
*/
|
*/
|
||||||
static inline bool HasRailCatenaryDrawn(RailType rt, RailType secondary = INVALID_RAILTYPE)
|
inline bool HasRailCatenaryDrawn(RailType rt, RailType secondary = INVALID_RAILTYPE)
|
||||||
{
|
{
|
||||||
return !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails && (HasRailCatenary(rt) || (secondary != INVALID_RAILTYPE && HasRailCatenary(secondary)));
|
return !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails && (HasRailCatenary(rt) || (secondary != INVALID_RAILTYPE && HasRailCatenary(secondary)));
|
||||||
}
|
}
|
||||||
|
@@ -236,27 +236,27 @@ struct EngineOverrideManager : std::vector<EngineIDMapping> {
|
|||||||
|
|
||||||
extern EngineOverrideManager _engine_mngr;
|
extern EngineOverrideManager _engine_mngr;
|
||||||
|
|
||||||
static inline const EngineInfo *EngInfo(EngineID e)
|
inline const EngineInfo *EngInfo(EngineID e)
|
||||||
{
|
{
|
||||||
return &Engine::Get(e)->info;
|
return &Engine::Get(e)->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const RailVehicleInfo *RailVehInfo(EngineID e)
|
inline const RailVehicleInfo *RailVehInfo(EngineID e)
|
||||||
{
|
{
|
||||||
return &Engine::Get(e)->u.rail;
|
return &Engine::Get(e)->u.rail;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const RoadVehicleInfo *RoadVehInfo(EngineID e)
|
inline const RoadVehicleInfo *RoadVehInfo(EngineID e)
|
||||||
{
|
{
|
||||||
return &Engine::Get(e)->u.road;
|
return &Engine::Get(e)->u.road;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const ShipVehicleInfo *ShipVehInfo(EngineID e)
|
inline const ShipVehicleInfo *ShipVehInfo(EngineID e)
|
||||||
{
|
{
|
||||||
return &Engine::Get(e)->u.ship;
|
return &Engine::Get(e)->u.ship;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const AircraftVehicleInfo *AircraftVehInfo(EngineID e)
|
inline const AircraftVehicleInfo *AircraftVehInfo(EngineID e)
|
||||||
{
|
{
|
||||||
return &Engine::Get(e)->u.air;
|
return &Engine::Get(e)->u.air;
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ int closedir(DIR *d);
|
|||||||
* @param path string to open directory of
|
* @param path string to open directory of
|
||||||
* @return DIR pointer
|
* @return DIR pointer
|
||||||
*/
|
*/
|
||||||
static inline DIR *ttd_opendir(const char *path)
|
inline DIR *ttd_opendir(const char *path)
|
||||||
{
|
{
|
||||||
return opendir(OTTD2FS(path).c_str());
|
return opendir(OTTD2FS(path).c_str());
|
||||||
}
|
}
|
||||||
|
@@ -167,20 +167,20 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Map a SpriteID to the font size and key */
|
/** Map a SpriteID to the font size and key */
|
||||||
static inline void SetUnicodeGlyph(FontSize size, WChar key, SpriteID sprite)
|
inline void SetUnicodeGlyph(FontSize size, char32_t key, SpriteID sprite)
|
||||||
{
|
{
|
||||||
FontCache::Get(size)->SetUnicodeGlyph(key, sprite);
|
FontCache::Get(size)->SetUnicodeGlyph(key, sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the glyph map */
|
/** Initialize the glyph map */
|
||||||
static inline void InitializeUnicodeGlyphMap()
|
inline void InitializeUnicodeGlyphMap()
|
||||||
{
|
{
|
||||||
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
|
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
|
||||||
FontCache::Get(fs)->InitializeUnicodeGlyphMap();
|
FontCache::Get(fs)->InitializeUnicodeGlyphMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ClearFontCache()
|
inline void ClearFontCache()
|
||||||
{
|
{
|
||||||
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
|
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
|
||||||
FontCache::Get(fs)->ClearFontCache();
|
FontCache::Get(fs)->ClearFontCache();
|
||||||
@@ -188,20 +188,20 @@ static inline void ClearFontCache()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get the Sprite for a glyph */
|
/** Get the Sprite for a glyph */
|
||||||
static inline const Sprite *GetGlyph(FontSize size, WChar key)
|
inline const Sprite *GetGlyph(FontSize size, char32_t key)
|
||||||
{
|
{
|
||||||
FontCache *fc = FontCache::Get(size);
|
FontCache *fc = FontCache::Get(size);
|
||||||
return fc->GetGlyph(fc->MapCharToGlyph(key));
|
return fc->GetGlyph(fc->MapCharToGlyph(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the width of a glyph */
|
/** Get the width of a glyph */
|
||||||
static inline uint GetGlyphWidth(FontSize size, WChar key)
|
inline uint GetGlyphWidth(FontSize size, char32_t key)
|
||||||
{
|
{
|
||||||
FontCache *fc = FontCache::Get(size);
|
FontCache *fc = FontCache::Get(size);
|
||||||
return fc->GetGlyphWidth(fc->MapCharToGlyph(key));
|
return fc->GetGlyphWidth(fc->MapCharToGlyph(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool GetDrawGlyphShadow(FontSize size)
|
inline bool GetDrawGlyphShadow(FontSize size)
|
||||||
{
|
{
|
||||||
return FontCache::Get(size)->GetDrawGlyphShadow();
|
return FontCache::Get(size)->GetDrawGlyphShadow();
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ extern FontCacheSettings _fcsettings;
|
|||||||
* @param fs The font size to look up.
|
* @param fs The font size to look up.
|
||||||
* @return The settings.
|
* @return The settings.
|
||||||
*/
|
*/
|
||||||
static inline FontCacheSubSetting *GetFontCacheSubSetting(FontSize fs)
|
inline FontCacheSubSetting *GetFontCacheSubSetting(FontSize fs)
|
||||||
{
|
{
|
||||||
switch (fs) {
|
switch (fs) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@@ -124,27 +124,27 @@ void DrawBox(const DrawPixelInfo *dpi, int x, int y, int dx1, int dy1, int dx2,
|
|||||||
void DrawRectOutline(const Rect &r, int colour, int width = 1, int dash = 0);
|
void DrawRectOutline(const Rect &r, int colour, int width = 1, int dash = 0);
|
||||||
|
|
||||||
/* Versions of DrawString/DrawStringMultiLine that accept a Rect instead of separate left, right, top and bottom parameters. */
|
/* Versions of DrawString/DrawStringMultiLine that accept a Rect instead of separate left, right, top and bottom parameters. */
|
||||||
static inline int DrawString(const Rect &r, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL)
|
inline int DrawString(const Rect &r, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL)
|
||||||
{
|
{
|
||||||
return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
|
return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int DrawString(const Rect &r, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL)
|
inline int DrawString(const Rect &r, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL)
|
||||||
{
|
{
|
||||||
return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
|
return DrawString(r.left, r.right, r.top, str, colour, align, underline, fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int DrawStringMultiLine(const Rect &r, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL)
|
inline int DrawStringMultiLine(const Rect &r, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL)
|
||||||
{
|
{
|
||||||
return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
|
return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int DrawStringMultiLine(const Rect &r, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL)
|
inline int DrawStringMultiLine(const Rect &r, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL)
|
||||||
{
|
{
|
||||||
return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
|
return DrawStringMultiLine(r.left, r.right, r.top, r.bottom, str, colour, align, underline, fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void GfxFillRect(const Rect &r, int colour, FillRectMode mode = FILLRECT_OPAQUE)
|
inline void GfxFillRect(const Rect &r, int colour, FillRectMode mode = FILLRECT_OPAQUE)
|
||||||
{
|
{
|
||||||
GfxFillRect(r.left, r.top, r.right, r.bottom, colour, mode);
|
GfxFillRect(r.left, r.top, r.right, r.bottom, colour, mode);
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ void CheckBlitter();
|
|||||||
|
|
||||||
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height);
|
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height);
|
||||||
|
|
||||||
static inline bool FillDrawPixelInfo(DrawPixelInfo *n, const Rect &r)
|
inline bool FillDrawPixelInfo(DrawPixelInfo *n, const Rect &r)
|
||||||
{
|
{
|
||||||
return FillDrawPixelInfo(n, r.left, r.top, r.Width(), r.Height());
|
return FillDrawPixelInfo(n, r.left, r.top, r.Width(), r.Height());
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ static inline bool FillDrawPixelInfo(DrawPixelInfo *n, const Rect &r)
|
|||||||
* @param size The height or width of the object to draw.
|
* @param size The height or width of the object to draw.
|
||||||
* @return Offset of where to start drawing the object.
|
* @return Offset of where to start drawing the object.
|
||||||
*/
|
*/
|
||||||
static inline int CenterBounds(int min, int max, int size)
|
inline int CenterBounds(int min, int max, int size)
|
||||||
{
|
{
|
||||||
return (min + max - size + 1) / 2;
|
return (min + max - size + 1) / 2;
|
||||||
}
|
}
|
||||||
|
@@ -211,7 +211,7 @@ enum FontSize {
|
|||||||
};
|
};
|
||||||
DECLARE_POSTFIX_INCREMENT(FontSize)
|
DECLARE_POSTFIX_INCREMENT(FontSize)
|
||||||
|
|
||||||
static inline const char *FontSizeToName(FontSize fs)
|
inline const char *FontSizeToName(FontSize fs)
|
||||||
{
|
{
|
||||||
static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" };
|
static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" };
|
||||||
assert(fs < FS_END);
|
assert(fs < FS_END);
|
||||||
|
@@ -88,7 +88,7 @@ struct Group : GroupPool::PoolItem<&_group_pool> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline bool IsDefaultGroupID(GroupID index)
|
inline bool IsDefaultGroupID(GroupID index)
|
||||||
{
|
{
|
||||||
return index == DEFAULT_GROUP;
|
return index == DEFAULT_GROUP;
|
||||||
}
|
}
|
||||||
@@ -98,12 +98,12 @@ static inline bool IsDefaultGroupID(GroupID index)
|
|||||||
* @param id_g The GroupID to check
|
* @param id_g The GroupID to check
|
||||||
* @return true is id_g is identical to ALL_GROUP
|
* @return true is id_g is identical to ALL_GROUP
|
||||||
*/
|
*/
|
||||||
static inline bool IsAllGroupID(GroupID id_g)
|
inline bool IsAllGroupID(GroupID id_g)
|
||||||
{
|
{
|
||||||
return id_g == ALL_GROUP;
|
return id_g == ALL_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTopLevelGroupID(GroupID index)
|
inline bool IsTopLevelGroupID(GroupID index)
|
||||||
{
|
{
|
||||||
return index == DEFAULT_GROUP || index == ALL_GROUP;
|
return index == DEFAULT_GROUP || index == ALL_GROUP;
|
||||||
}
|
}
|
||||||
|
@@ -145,7 +145,7 @@ struct HouseSpec {
|
|||||||
* @param hid the HouseID to get the override for.
|
* @param hid the HouseID to get the override for.
|
||||||
* @return the HouseID to actually work with.
|
* @return the HouseID to actually work with.
|
||||||
*/
|
*/
|
||||||
static inline HouseID GetTranslatedHouseID(HouseID hid)
|
inline HouseID GetTranslatedHouseID(HouseID hid)
|
||||||
{
|
{
|
||||||
const HouseSpec *hs = HouseSpec::Get(hid);
|
const HouseSpec *hs = HouseSpec::Get(hid);
|
||||||
return hs->grf_prop.override == INVALID_HOUSE_ID ? hid : hs->grf_prop.override;
|
return hs->grf_prop.override == INVALID_HOUSE_ID ? hid : hs->grf_prop.override;
|
||||||
|
@@ -60,7 +60,7 @@ enum IndustryGraphics {
|
|||||||
* @pre IsTileType(t, MP_INDUSTRY)
|
* @pre IsTileType(t, MP_INDUSTRY)
|
||||||
* @return the industry ID
|
* @return the industry ID
|
||||||
*/
|
*/
|
||||||
static inline IndustryID GetIndustryIndex(TileIndex t)
|
inline IndustryID GetIndustryIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
@@ -72,7 +72,7 @@ static inline IndustryID GetIndustryIndex(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_INDUSTRY)
|
* @pre IsTileType(t, MP_INDUSTRY)
|
||||||
* @return true if and only if the industry tile is fully built
|
* @return true if and only if the industry tile is fully built
|
||||||
*/
|
*/
|
||||||
static inline bool IsIndustryCompleted(TileIndex t)
|
inline bool IsIndustryCompleted(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return HasBit(_m[t].m1, 7);
|
return HasBit(_m[t].m1, 7);
|
||||||
@@ -85,7 +85,7 @@ IndustryType GetIndustryType(TileIndex tile);
|
|||||||
* @param tile the tile to query
|
* @param tile the tile to query
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryCompleted(TileIndex tile)
|
inline void SetIndustryCompleted(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 7, 1, 1);
|
SB(_m[tile].m1, 7, 1, 1);
|
||||||
@@ -97,7 +97,7 @@ static inline void SetIndustryCompleted(TileIndex tile)
|
|||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
* @return the construction stage
|
* @return the construction stage
|
||||||
*/
|
*/
|
||||||
static inline byte GetIndustryConstructionStage(TileIndex tile)
|
inline byte GetIndustryConstructionStage(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
|
return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
|
||||||
@@ -109,7 +109,7 @@ static inline byte GetIndustryConstructionStage(TileIndex tile)
|
|||||||
* @param value the new construction stage
|
* @param value the new construction stage
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 0, 2, value);
|
SB(_m[tile].m1, 0, 2, value);
|
||||||
@@ -122,7 +122,7 @@ static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
|||||||
* @pre IsTileType(t, MP_INDUSTRY)
|
* @pre IsTileType(t, MP_INDUSTRY)
|
||||||
* @return the gfx ID
|
* @return the gfx ID
|
||||||
*/
|
*/
|
||||||
static inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return _m[t].m5 | (GB(_me[t].m6, 2, 1) << 8);
|
return _m[t].m5 | (GB(_me[t].m6, 2, 1) << 8);
|
||||||
@@ -134,7 +134,7 @@ static inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_INDUSTRY)
|
* @pre IsTileType(t, MP_INDUSTRY)
|
||||||
* @return the gfx ID
|
* @return the gfx ID
|
||||||
*/
|
*/
|
||||||
static inline IndustryGfx GetIndustryGfx(TileIndex t)
|
inline IndustryGfx GetIndustryGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return GetTranslatedIndustryTileID(GetCleanIndustryGfx(t));
|
return GetTranslatedIndustryTileID(GetCleanIndustryGfx(t));
|
||||||
@@ -146,7 +146,7 @@ static inline IndustryGfx GetIndustryGfx(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_INDUSTRY)
|
* @pre IsTileType(t, MP_INDUSTRY)
|
||||||
* @param gfx the graphics ID
|
* @param gfx the graphics ID
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
dbg_assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
_m[t].m5 = GB(gfx, 0, 8);
|
_m[t].m5 = GB(gfx, 0, 8);
|
||||||
@@ -159,7 +159,7 @@ static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
|||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
* @return the construction counter
|
* @return the construction counter
|
||||||
*/
|
*/
|
||||||
static inline byte GetIndustryConstructionCounter(TileIndex tile)
|
inline byte GetIndustryConstructionCounter(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return GB(_m[tile].m1, 2, 2);
|
return GB(_m[tile].m1, 2, 2);
|
||||||
@@ -171,7 +171,7 @@ static inline byte GetIndustryConstructionCounter(TileIndex tile)
|
|||||||
* @param value the new value for the construction counter
|
* @param value the new value for the construction counter
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 2, 2, value);
|
SB(_m[tile].m1, 2, 2, value);
|
||||||
@@ -184,7 +184,7 @@ static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
|||||||
* @param tile the tile to query
|
* @param tile the tile to query
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void ResetIndustryConstructionStage(TileIndex tile)
|
inline void ResetIndustryConstructionStage(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 0, 4, 0);
|
SB(_m[tile].m1, 0, 4, 0);
|
||||||
@@ -196,7 +196,7 @@ static inline void ResetIndustryConstructionStage(TileIndex tile)
|
|||||||
* @param tile the tile to get the animation loop number of
|
* @param tile the tile to get the animation loop number of
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline byte GetIndustryAnimationLoop(TileIndex tile)
|
inline byte GetIndustryAnimationLoop(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return _m[tile].m4;
|
return _m[tile].m4;
|
||||||
@@ -208,7 +208,7 @@ static inline byte GetIndustryAnimationLoop(TileIndex tile)
|
|||||||
* @param count the new animation frame number
|
* @param count the new animation frame number
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
_m[tile].m4 = count;
|
_m[tile].m4 = count;
|
||||||
@@ -221,7 +221,7 @@ static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
|||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
* @return requested bits
|
* @return requested bits
|
||||||
*/
|
*/
|
||||||
static inline byte GetIndustryRandomBits(TileIndex tile)
|
inline byte GetIndustryRandomBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return _m[tile].m3;
|
return _m[tile].m3;
|
||||||
@@ -234,7 +234,7 @@ static inline byte GetIndustryRandomBits(TileIndex tile)
|
|||||||
* @param bits the random bits
|
* @param bits the random bits
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
_m[tile].m3 = bits;
|
_m[tile].m3 = bits;
|
||||||
@@ -247,7 +247,7 @@ static inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
|||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
* @return requested triggers
|
* @return requested triggers
|
||||||
*/
|
*/
|
||||||
static inline byte GetIndustryTriggers(TileIndex tile)
|
inline byte GetIndustryTriggers(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return GB(_me[tile].m6, 3, 3);
|
return GB(_me[tile].m6, 3, 3);
|
||||||
@@ -261,7 +261,7 @@ static inline byte GetIndustryTriggers(TileIndex tile)
|
|||||||
* @param triggers the triggers to set
|
* @param triggers the triggers to set
|
||||||
* @pre IsTileType(tile, MP_INDUSTRY)
|
* @pre IsTileType(tile, MP_INDUSTRY)
|
||||||
*/
|
*/
|
||||||
static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
dbg_assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_me[tile].m6, 3, 3, triggers);
|
SB(_me[tile].m6, 3, 3, triggers);
|
||||||
@@ -275,7 +275,7 @@ static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
|||||||
* @param random the random value
|
* @param random the random value
|
||||||
* @param wc the water class for this industry; only useful when build on water
|
* @param wc the water class for this industry; only useful when build on water
|
||||||
*/
|
*/
|
||||||
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
|
inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_INDUSTRY);
|
SetTileType(t, MP_INDUSTRY);
|
||||||
_m[t].m1 = 0;
|
_m[t].m1 = 0;
|
||||||
|
@@ -192,7 +192,7 @@ extern std::array<IndustryType, NUM_INDUSTRYTYPES> _sorted_industry_types;
|
|||||||
* @param gfx the type to get the override for.
|
* @param gfx the type to get the override for.
|
||||||
* @return the gfx to actually work with.
|
* @return the gfx to actually work with.
|
||||||
*/
|
*/
|
||||||
static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
|
inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
|
||||||
{
|
{
|
||||||
/* the 0xFF should be GFX_WATERTILE_SPECIALCHECK but for reasons of include mess,
|
/* the 0xFF should be GFX_WATERTILE_SPECIALCHECK but for reasons of include mess,
|
||||||
* we'll simplify the writing.
|
* we'll simplify the writing.
|
||||||
|
@@ -30,7 +30,7 @@ void UpdateAllBlockSignals(Owner owner = INVALID_OWNER);
|
|||||||
* @param infra_owner The owner of the infrastructure.
|
* @param infra_owner The owner of the infrastructure.
|
||||||
* @return True if infrastructure usage is allowed, false otherwise.
|
* @return True if infrastructure usage is allowed, false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool IsInfraUsageAllowed(VehicleType type, Owner veh_owner, Owner infra_owner)
|
inline bool IsInfraUsageAllowed(VehicleType type, Owner veh_owner, Owner infra_owner)
|
||||||
{
|
{
|
||||||
return infra_owner == veh_owner || infra_owner == OWNER_NONE || _settings_game.economy.infrastructure_sharing[type];
|
return infra_owner == veh_owner || infra_owner == OWNER_NONE || _settings_game.economy.infrastructure_sharing[type];
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ static inline bool IsInfraUsageAllowed(VehicleType type, Owner veh_owner, Owner
|
|||||||
* @param tile The tile that may or may not be used.
|
* @param tile The tile that may or may not be used.
|
||||||
* @return True if infrastructure usage is allowed, false otherwise.
|
* @return True if infrastructure usage is allowed, false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool IsInfraTileUsageAllowed(VehicleType type, Owner veh_owner, TileIndex tile)
|
inline bool IsInfraTileUsageAllowed(VehicleType type, Owner veh_owner, TileIndex tile)
|
||||||
{
|
{
|
||||||
return IsInfraUsageAllowed(type, veh_owner, GetTileOwner(tile));
|
return IsInfraUsageAllowed(type, veh_owner, GetTileOwner(tile));
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ static inline bool IsInfraTileUsageAllowed(VehicleType type, Owner veh_owner, Ti
|
|||||||
* @param tile Tile of the infrastructure.
|
* @param tile Tile of the infrastructure.
|
||||||
* @return CommandCost indicating success or failure.
|
* @return CommandCost indicating success or failure.
|
||||||
*/
|
*/
|
||||||
static inline CommandCost CheckInfraUsageAllowed(VehicleType type, Owner infra_owner, TileIndex tile = 0)
|
inline CommandCost CheckInfraUsageAllowed(VehicleType type, Owner infra_owner, TileIndex tile = 0)
|
||||||
{
|
{
|
||||||
if (infra_owner == OWNER_NONE || _settings_game.economy.infrastructure_sharing[type]) return CommandCost();
|
if (infra_owner == OWNER_NONE || _settings_game.economy.infrastructure_sharing[type]) return CommandCost();
|
||||||
return CheckOwnership(infra_owner, tile);
|
return CheckOwnership(infra_owner, tile);
|
||||||
@@ -70,7 +70,7 @@ static inline CommandCost CheckInfraUsageAllowed(VehicleType type, Owner infra_o
|
|||||||
* @param o The company which may or may not control this vehicle.
|
* @param o The company which may or may not control this vehicle.
|
||||||
* @return True if the given company is allowed to control this vehicle.
|
* @return True if the given company is allowed to control this vehicle.
|
||||||
*/
|
*/
|
||||||
static inline bool IsVehicleControlAllowed(const Vehicle *v, Owner o)
|
inline bool IsVehicleControlAllowed(const Vehicle *v, Owner o)
|
||||||
{
|
{
|
||||||
return v->owner == o || (v->type == VEH_TRAIN && IsTileOwner(v->tile, o) && !v->IsChainInDepot());
|
return v->owner == o || (v->type == VEH_TRAIN && IsTileOwner(v->tile, o) && !v->IsChainInDepot());
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ static inline bool IsVehicleControlAllowed(const Vehicle *v, Owner o)
|
|||||||
* @param v The vehicle which may or may not be controlled.
|
* @param v The vehicle which may or may not be controlled.
|
||||||
* @return CommandCost indicating success or failure.
|
* @return CommandCost indicating success or failure.
|
||||||
*/
|
*/
|
||||||
static inline CommandCost CheckVehicleControlAllowed(const Vehicle *v)
|
inline CommandCost CheckVehicleControlAllowed(const Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->type == VEH_TRAIN && IsTileOwner(v->tile, _current_company) && !v->IsChainInDepot()) return CommandCost();
|
if (v->type == VEH_TRAIN && IsTileOwner(v->tile, _current_company) && !v->IsChainInDepot()) return CommandCost();
|
||||||
return CheckOwnership(v->owner);
|
return CheckOwnership(v->owner);
|
||||||
@@ -96,7 +96,7 @@ static inline CommandCost CheckVehicleControlAllowed(const Vehicle *v)
|
|||||||
* @param o2 Second track owner.
|
* @param o2 Second track owner.
|
||||||
* @return True if tracks of the two owners are part of the same signal block.
|
* @return True if tracks of the two owners are part of the same signal block.
|
||||||
*/
|
*/
|
||||||
static inline bool IsOneSignalBlock(Owner o1, Owner o2)
|
inline bool IsOneSignalBlock(Owner o1, Owner o2)
|
||||||
{
|
{
|
||||||
return o1 == o2 || _settings_game.economy.infrastructure_sharing[VEH_TRAIN];
|
return o1 == o2 || _settings_game.economy.infrastructure_sharing[VEH_TRAIN];
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
|
|||||||
* @param corner The corner.
|
* @param corner The corner.
|
||||||
* @return Z position of corner relative to TileZ.
|
* @return Z position of corner relative to TileZ.
|
||||||
*/
|
*/
|
||||||
static inline int GetSlopePixelZInCorner(Slope tileh, Corner corner)
|
inline int GetSlopePixelZInCorner(Slope tileh, Corner corner)
|
||||||
{
|
{
|
||||||
return GetSlopeZInCorner(tileh, corner) * TILE_HEIGHT;
|
return GetSlopeZInCorner(tileh, corner) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ static inline int GetSlopePixelZInCorner(Slope tileh, Corner corner)
|
|||||||
* @param z returns the z of the foundation slope. (Can be nullptr, if not needed)
|
* @param z returns the z of the foundation slope. (Can be nullptr, if not needed)
|
||||||
* @return The slope on top of the foundation.
|
* @return The slope on top of the foundation.
|
||||||
*/
|
*/
|
||||||
static inline Slope GetFoundationPixelSlope(TileIndex tile, int *z)
|
inline Slope GetFoundationPixelSlope(TileIndex tile, int *z)
|
||||||
{
|
{
|
||||||
dbg_assert(z != nullptr);
|
dbg_assert(z != nullptr);
|
||||||
Slope s = GetFoundationSlope(tile, z);
|
Slope s = GetFoundationSlope(tile, z);
|
||||||
@@ -110,7 +110,7 @@ static inline Slope GetFoundationPixelSlope(TileIndex tile, int *z)
|
|||||||
* @return Equivalent coordinate in the 2D view.
|
* @return Equivalent coordinate in the 2D view.
|
||||||
* @see RemapCoords2
|
* @see RemapCoords2
|
||||||
*/
|
*/
|
||||||
static inline Point RemapCoords(int x, int y, int z)
|
inline Point RemapCoords(int x, int y, int z)
|
||||||
{
|
{
|
||||||
Point pt;
|
Point pt;
|
||||||
pt.x = (y - x) * 2 * ZOOM_LVL_BASE;
|
pt.x = (y - x) * 2 * ZOOM_LVL_BASE;
|
||||||
@@ -126,7 +126,7 @@ static inline Point RemapCoords(int x, int y, int z)
|
|||||||
* @return Equivalent coordinate in the 2D view.
|
* @return Equivalent coordinate in the 2D view.
|
||||||
* @see RemapCoords
|
* @see RemapCoords
|
||||||
*/
|
*/
|
||||||
static inline Point RemapCoords2(int x, int y)
|
inline Point RemapCoords2(int x, int y)
|
||||||
{
|
{
|
||||||
return RemapCoords(x, y, GetSlopePixelZ(x, y, false));
|
return RemapCoords(x, y, GetSlopePixelZ(x, y, false));
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ static inline Point RemapCoords2(int x, int y)
|
|||||||
* @note Inverse of #RemapCoords function. Smaller values may get rounded.
|
* @note Inverse of #RemapCoords function. Smaller values may get rounded.
|
||||||
* @see InverseRemapCoords2
|
* @see InverseRemapCoords2
|
||||||
*/
|
*/
|
||||||
static inline Point InverseRemapCoords(int x, int y)
|
inline Point InverseRemapCoords(int x, int y)
|
||||||
{
|
{
|
||||||
Point pt = {(y * 2 - x) >> (2 + ZOOM_LVL_SHIFT), (y * 2 + x) >> (2 + ZOOM_LVL_SHIFT)};
|
Point pt = {(y * 2 - x) >> (2 + ZOOM_LVL_SHIFT), (y * 2 + x) >> (2 + ZOOM_LVL_SHIFT)};
|
||||||
return pt;
|
return pt;
|
||||||
@@ -157,7 +157,7 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s);
|
|||||||
* @param s The #Slope to modify.
|
* @param s The #Slope to modify.
|
||||||
* @return Increment to the tile Z coordinate.
|
* @return Increment to the tile Z coordinate.
|
||||||
*/
|
*/
|
||||||
static inline uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
|
inline uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
|
||||||
{
|
{
|
||||||
return ApplyFoundationToSlope(f, s) * TILE_HEIGHT;
|
return ApplyFoundationToSlope(f, s) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
@@ -2055,14 +2055,17 @@ STR_CONFIG_SETTING_ACCOUNTING :Accounting
|
|||||||
STR_CONFIG_SETTING_VEHICLES :Vehicles
|
STR_CONFIG_SETTING_VEHICLES :Vehicles
|
||||||
STR_CONFIG_SETTING_VEHICLES_PHYSICS :Physics
|
STR_CONFIG_SETTING_VEHICLES_PHYSICS :Physics
|
||||||
STR_CONFIG_SETTING_VEHICLES_ROUTING :Routing
|
STR_CONFIG_SETTING_VEHICLES_ROUTING :Routing
|
||||||
|
STR_CONFIG_SETTING_VEHICLES_ORDERS :Orders
|
||||||
STR_CONFIG_SETTING_LIMITATIONS :Limitations
|
STR_CONFIG_SETTING_LIMITATIONS :Limitations
|
||||||
STR_CONFIG_SETTING_ACCIDENTS :Disasters / Accidents
|
STR_CONFIG_SETTING_ACCIDENTS :Disasters / Accidents
|
||||||
STR_CONFIG_SETTING_GENWORLD :World generation
|
STR_CONFIG_SETTING_GENWORLD :World generation
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT :Environment
|
STR_CONFIG_SETTING_ENVIRONMENT :Environment
|
||||||
|
STR_CONFIG_SETTING_ENVIRONMENT_TIME :Time
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES :Authorities
|
STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES :Authorities
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TOWNS :Towns
|
STR_CONFIG_SETTING_ENVIRONMENT_TOWNS :Towns
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES :Industries
|
STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES :Industries
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST :Cargo distribution
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST :Cargo distribution
|
||||||
|
STR_CONFIG_SETTING_ENVIRONMENT_TREES :Trees
|
||||||
STR_CONFIG_SETTING_AI :Competitors
|
STR_CONFIG_SETTING_AI :Competitors
|
||||||
STR_CONFIG_SETTING_AI_NPC :Computer players
|
STR_CONFIG_SETTING_AI_NPC :Computer players
|
||||||
STR_CONFIG_SETTING_NETWORK :Network
|
STR_CONFIG_SETTING_NETWORK :Network
|
||||||
|
@@ -580,14 +580,12 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Nástě
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Nastavení klienta
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Nastavení klienta
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Nastavení této mapy
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Nastavení této mapy
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Jízdní řády
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Jízdní řády
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Návěstidla (pokročilé)
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}Návěstidla
|
||||||
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Ukládání & automatické ukládání
|
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Ukládání & automatické ukládání
|
||||||
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Okna vozidel
|
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Okna vozidel
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Řeky a jezera
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Řeky a jezera
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Distribuce nákladu - prolomit u jednotlivých druhů
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Distribuce nákladu - prolomit u jednotlivých druhů
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}Stromy
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Režim mapy
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Režim mapy
|
||||||
STR_CONFIG_SETTING_VIEWPORT_SIGNALS :{ORANGE}Návěstidla
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Vykreslování trasy vozidla
|
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Vykreslování trasy vozidla
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}Sdílení infrastruktury
|
STR_CONFIG_SETTING_SHARING :{ORANGE}Sdílení infrastruktury
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Editor scénáře
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Editor scénáře
|
||||||
|
@@ -667,14 +667,12 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Wall cl
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Client settings
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Client settings
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Savegame settings
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Savegame settings
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Timetables
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Timetables
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Signals (advanced)
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}Signals
|
||||||
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Save & Autosave
|
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Save & Autosave
|
||||||
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Vehicle windows
|
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Vehicle windows
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Rivers & Lakes
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Rivers & Lakes
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Cargo distribution - per cargo overrides
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Cargo distribution - per cargo overrides
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}Trees
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Map mode
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Map mode
|
||||||
STR_CONFIG_SETTING_VIEWPORT_SIGNALS :{ORANGE}Signals
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Vehicle route overlay
|
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Vehicle route overlay
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}Infrastructure sharing
|
STR_CONFIG_SETTING_SHARING :{ORANGE}Infrastructure sharing
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Scenario Editor
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Scenario Editor
|
||||||
|
@@ -601,14 +601,12 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Reloxo
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Opcións do cliente
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Opcións do cliente
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Opcións da partida
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Opcións da partida
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Horarios
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Horarios
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Sinais (avanzado)
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}Sinais
|
||||||
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Gardado e autogardado
|
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}Gardado e autogardado
|
||||||
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Ventás dos vehículos
|
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}Ventás dos vehículos
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Ríos e lagoas
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Ríos e lagoas
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Distribución de carga - por anulacións de carga
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Distribución de carga - por anulacións de carga
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}Árbores
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Modo do mapa
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Modo do mapa
|
||||||
STR_CONFIG_SETTING_VIEWPORT_SIGNALS :{ORANGE}Sinais
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Capa superposta da ruta do vehículo
|
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}Capa superposta da ruta do vehículo
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}Compartición de infraestrutura
|
STR_CONFIG_SETTING_SHARING :{ORANGE}Compartición de infraestrutura
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Editor de escenarios
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Editor de escenarios
|
||||||
|
@@ -507,10 +507,9 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Uhr
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Client-Einstellungen
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}Client-Einstellungen
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Spielstand-Einstellungen
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}Spielstand-Einstellungen
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Fahrpläne
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Fahrpläne
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Signale (erweitert)
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}Signale
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Flüsse & Seen
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}Flüsse & Seen
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Warenverteilung - Überschreibungen nach Frachtart
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}Warenverteilung - Überschreibungen nach Frachtart
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}Bäume
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Zusätzliche Kartenansicht
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}Zusätzliche Kartenansicht
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}Infrastruktur-Sharing
|
STR_CONFIG_SETTING_SHARING :{ORANGE}Infrastruktur-Sharing
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Szenarieneditor
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}Szenarieneditor
|
||||||
|
@@ -17,7 +17,7 @@ STR_CONFIG_SETTING_AUTOSAVE_HELPTEXT :オートセー
|
|||||||
STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS :{ORANGE}発車標
|
STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS :{ORANGE}発車標
|
||||||
STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}時刻
|
STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}時刻
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}ダイヤ
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}ダイヤ
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}信号
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}信号
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :ダイヤの時間単位にゲーム時を使用: {STRING}
|
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :ダイヤの時間単位にゲーム時を使用: {STRING}
|
||||||
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :ダイヤで行程時間を定めるために使われる時間単位を「日」ではなく「ゲーム時」にします。1日は約74ゲーム時に相当します
|
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :ダイヤで行程時間を定めるために使われる時間単位を「日」ではなく「ゲーム時」にします。1日は約74ゲーム時に相当します
|
||||||
|
@@ -601,14 +601,12 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}시계
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}클라이언트 설정
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}클라이언트 설정
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}세이브파일 설정
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}세이브파일 설정
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}시간표
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}시간표
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}신호기 (고급)
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}신호기
|
||||||
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}저장 & 자동 저장
|
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}저장 & 자동 저장
|
||||||
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}차량 창
|
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}차량 창
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}강 & 호수
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}강 & 호수
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}화물 분배 - 화물별
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}화물 분배 - 화물별
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}나무
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}지도 모드
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}지도 모드
|
||||||
STR_CONFIG_SETTING_VIEWPORT_SIGNALS :{ORANGE}신호기
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}차량 경로 오버레이
|
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}차량 경로 오버레이
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}시설 공유
|
STR_CONFIG_SETTING_SHARING :{ORANGE}시설 공유
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}시나리오 에디터
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}시나리오 에디터
|
||||||
|
@@ -595,14 +595,12 @@ STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}挂钟
|
|||||||
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}客户端设置
|
STR_CONFIG_SETTING_INTERFACE_TIME_CLIENT :{ORANGE}客户端设置
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}游戏保存设置
|
STR_CONFIG_SETTING_INTERFACE_TIME_SAVEGAME :{ORANGE}游戏保存设置
|
||||||
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}时刻表
|
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}时刻表
|
||||||
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}进阶信号
|
STR_CONFIG_SETTING_INTERFACE_SIGNALS :{ORANGE}信号
|
||||||
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}存档与自动存档
|
STR_CONFIG_SETTING_INTERFACE_SAVE :{ORANGE}存档与自动存档
|
||||||
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}载具窗口
|
STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS :{ORANGE}载具窗口
|
||||||
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}河流和湖泊
|
STR_CONFIG_SETTING_GENWORLD_RIVERS_LAKES :{ORANGE}河流和湖泊
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}货物分配
|
STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST_PER_CARGO_OVERRIDE :{ORANGE}货物分配
|
||||||
STR_CONFIG_SETTING_ENVIRONMENT_TREES :{ORANGE}树
|
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}地图模式
|
STR_CONFIG_SETTING_VIEWPORT_MAP_OPTIONS :{ORANGE}地图模式
|
||||||
STR_CONFIG_SETTING_VIEWPORT_SIGNALS :{ORANGE}信号
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}载具路径覆盖层
|
STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY :{ORANGE}载具路径覆盖层
|
||||||
STR_CONFIG_SETTING_SHARING :{ORANGE}基建共享
|
STR_CONFIG_SETTING_SHARING :{ORANGE}基建共享
|
||||||
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}场景编辑器
|
STR_CONFIG_SETTING_SCENARIO_EDITOR :{ORANGE}场景编辑器
|
||||||
|
@@ -1779,6 +1779,8 @@ STR_CONFIG_SETTING_SERVINT_DISABLED :izslēgts
|
|||||||
STR_CONFIG_SETTING_NOSERVICE :Aizliegt apkopi, kad bojāšanās ir izslēgta: {STRING}
|
STR_CONFIG_SETTING_NOSERVICE :Aizliegt apkopi, kad bojāšanās ir izslēgta: {STRING}
|
||||||
STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :Ja ieslēgts, transportlīdzekļiem netiek veikta apkope. Jo tie nebojājas
|
STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :Ja ieslēgts, transportlīdzekļiem netiek veikta apkope. Jo tie nebojājas
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY :Iekraušanas ātruma sods vilcieniem, kas ir garāki par staciju: {STRING}
|
||||||
|
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :Ja aktīs, vilcieni, kas ir pārāk gari stacijai, iekraujas lēnāk nekā vilcieni, kas atbilst stacijai. Šis iestatījums neietekmē ceļa meklēšanu.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Ieslēgt vagonu ātruma ierobežojumus: {STRING}
|
STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Ieslēgt vagonu ātruma ierobežojumus: {STRING}
|
||||||
STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :Ja ieslēgts, var izmantot vagonu ātruma ierobežojumus, lai lemtu par vilcienu maksimālo ātrumu
|
STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :Ja ieslēgts, var izmantot vagonu ātruma ierobežojumus, lai lemtu par vilcienu maksimālo ātrumu
|
||||||
|
@@ -260,7 +260,7 @@ STR_UNITS_SECONDS :{COMMA}{NBSP}
|
|||||||
STR_UNITS_TICKS :{COMMA}{NBSP} 刻
|
STR_UNITS_TICKS :{COMMA}{NBSP} 刻
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}关键字词:
|
STR_LIST_FILTER_TITLE :{BLACK}搜索:
|
||||||
STR_LIST_FILTER_OSKTITLE :{BLACK}输入关键字筛选
|
STR_LIST_FILTER_OSKTITLE :{BLACK}输入关键字筛选
|
||||||
STR_LIST_FILTER_TOOLTIP :{BLACK}输入关键字以筛选查找此列表
|
STR_LIST_FILTER_TOOLTIP :{BLACK}输入关键字以筛选查找此列表
|
||||||
|
|
||||||
@@ -520,7 +520,7 @@ STR_ABOUT_MENU_ABOUT_OPENTTD :关于 'OpenTTD
|
|||||||
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite 对齐
|
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite 对齐
|
||||||
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :切换边界框
|
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :切换边界框
|
||||||
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :切换脏方块的颜色
|
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :切换脏方块的颜色
|
||||||
STR_ABOUT_MENU_TOGGLE_WIDGET_OUTLINES :调节小组件边框
|
STR_ABOUT_MENU_TOGGLE_WIDGET_OUTLINES :切换小组件边框
|
||||||
|
|
||||||
# Place in highscore window
|
# Place in highscore window
|
||||||
###length 15
|
###length 15
|
||||||
@@ -667,7 +667,7 @@ STR_PERFORMANCE_DETAIL_TOTAL :{BLACK}总表
|
|||||||
###length 10
|
###length 10
|
||||||
STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP :{BLACK}上一年盈利的车船总数;包括火车、汽车、船只和飞机
|
STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP :{BLACK}上一年盈利的车船总数;包括火车、汽车、船只和飞机
|
||||||
STR_PERFORMANCE_DETAIL_STATIONS_TOOLTIP :{BLACK}最近仍然使用的车站组件数量。车站的每个组件(火车站、公交站、机场)即使是连接成为一个车站,也会被独立计数。
|
STR_PERFORMANCE_DETAIL_STATIONS_TOOLTIP :{BLACK}最近仍然使用的车站组件数量。车站的每个组件(火车站、公交站、机场)即使是连接成为一个车站,也会被独立计数。
|
||||||
STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP :{BLACK}单一运输工具最低年利润(只计算使用两年以上的车辆、船只和飞机)
|
STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP :{BLACK}最低收入载具的损益(只计算使用两年以上的车辆、船只和飞机)
|
||||||
STR_PERFORMANCE_DETAIL_MIN_INCOME_TOOLTIP :{BLACK}在过去 12 个季度中{}利润最少的季度的现金收入
|
STR_PERFORMANCE_DETAIL_MIN_INCOME_TOOLTIP :{BLACK}在过去 12 个季度中{}利润最少的季度的现金收入
|
||||||
STR_PERFORMANCE_DETAIL_MAX_INCOME_TOOLTIP :{BLACK}在过去 12 个季度中{}利润最多的季度的现金收入
|
STR_PERFORMANCE_DETAIL_MAX_INCOME_TOOLTIP :{BLACK}在过去 12 个季度中{}利润最多的季度的现金收入
|
||||||
STR_PERFORMANCE_DETAIL_DELIVERED_TOOLTIP :{BLACK}在过去 4 个季度中运输的货物总数
|
STR_PERFORMANCE_DETAIL_DELIVERED_TOOLTIP :{BLACK}在过去 4 个季度中运输的货物总数
|
||||||
@@ -909,7 +909,7 @@ STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE :{BIG_FONT}{BLAC
|
|||||||
STR_NEWS_NEW_VEHICLE_TYPE :{BIG_FONT}{BLACK}{ENGINE}
|
STR_NEWS_NEW_VEHICLE_TYPE :{BIG_FONT}{BLACK}{ENGINE}
|
||||||
STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}新 {STRING} 上市了! - {ENGINE}
|
STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}新 {STRING} 上市了! - {ENGINE}
|
||||||
|
|
||||||
STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}打开该运输工具所属的组
|
STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}打开该载具所属的组
|
||||||
|
|
||||||
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION}不再接受:{CARGO_LIST}
|
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION}不再接受:{CARGO_LIST}
|
||||||
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION}现在接受:{CARGO_LIST}
|
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION}现在接受:{CARGO_LIST}
|
||||||
@@ -1175,13 +1175,13 @@ STR_TERRAIN_TYPE_CUSTOM_VALUE :自定义高度
|
|||||||
STR_CITY_APPROVAL_LENIENT :宽容
|
STR_CITY_APPROVAL_LENIENT :宽容
|
||||||
STR_CITY_APPROVAL_TOLERANT :隐忍
|
STR_CITY_APPROVAL_TOLERANT :隐忍
|
||||||
STR_CITY_APPROVAL_HOSTILE :对立
|
STR_CITY_APPROVAL_HOSTILE :对立
|
||||||
STR_CITY_APPROVAL_PERMISSIVE :宽容(对公司行为没有影响 )
|
STR_CITY_APPROVAL_PERMISSIVE :放任(所有行为均不受影响)
|
||||||
|
|
||||||
STR_WARNING_NO_SUITABLE_AI :{WHITE}无合适的 AI 可用...{}你可以在线下载各种 AI 。
|
STR_WARNING_NO_SUITABLE_AI :{WHITE}无合适的 AI 可用...{}你可以在线下载各种 AI 。
|
||||||
|
|
||||||
# Settings tree window
|
# Settings tree window
|
||||||
STR_CONFIG_SETTING_TREE_CAPTION :{WHITE}设置
|
STR_CONFIG_SETTING_TREE_CAPTION :{WHITE}设置
|
||||||
STR_CONFIG_SETTING_FILTER_TITLE :{BLACK}关键字搜索:
|
STR_CONFIG_SETTING_FILTER_TITLE :{BLACK}搜索条目:
|
||||||
STR_CONFIG_SETTING_EXPAND_ALL :{BLACK}展开全部
|
STR_CONFIG_SETTING_EXPAND_ALL :{BLACK}展开全部
|
||||||
STR_CONFIG_SETTING_COLLAPSE_ALL :{BLACK}关闭全部
|
STR_CONFIG_SETTING_COLLAPSE_ALL :{BLACK}关闭全部
|
||||||
STR_CONFIG_SETTING_RESET_ALL :{BLACK}重置所有值
|
STR_CONFIG_SETTING_RESET_ALL :{BLACK}重置所有值
|
||||||
@@ -1252,16 +1252,16 @@ STR_CONFIG_SETTING_INTEREST_RATE :贷款利率: {
|
|||||||
STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT :贷款利率;如果通货膨胀启用,将同时影响通货膨胀率。
|
STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT :贷款利率;如果通货膨胀启用,将同时影响通货膨胀率。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_RUNNING_COSTS :运营费用: {STRING}
|
STR_CONFIG_SETTING_RUNNING_COSTS :运营费用: {STRING}
|
||||||
STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT :设置维护费用、运营费用的难度
|
STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT :设置载具的营运与维护成本水平。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED :建设速度: {STRING}
|
STR_CONFIG_SETTING_CONSTRUCTION_SPEED :建设速度: {STRING}
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :AI建设频率的上限
|
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :AI建设频率的上限
|
||||||
|
|
||||||
STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS :车辆损坏: {STRING}
|
STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS :车辆损坏: {STRING}
|
||||||
STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT :设置运输工具故障率
|
STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT :设置维修不足的载具的故障频率。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER :补贴系数: {STRING}
|
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER :财政补贴系数: {STRING}
|
||||||
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :设置线路补贴额度
|
STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT :设置获得财政补贴的线路的利润倍数
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SUBSIDY_DURATION :财政补贴尺度:{STRING}
|
STR_CONFIG_SETTING_SUBSIDY_DURATION :财政补贴尺度:{STRING}
|
||||||
STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT :设置发放财政补贴的年数
|
STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT :设置发放财政补贴的年数
|
||||||
@@ -1271,7 +1271,7 @@ STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE :{NUM} 年
|
|||||||
STR_CONFIG_SETTING_SUBSIDY_DURATION_DISABLED :没有财政补贴
|
STR_CONFIG_SETTING_SUBSIDY_DURATION_DISABLED :没有财政补贴
|
||||||
|
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS :建设费用: {STRING}
|
STR_CONFIG_SETTING_CONSTRUCTION_COSTS :建设费用: {STRING}
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :设置建设费用和交易费用难度
|
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :设定建造的成本水平。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_RECESSIONS :经济衰退: {STRING}
|
STR_CONFIG_SETTING_RECESSIONS :经济衰退: {STRING}
|
||||||
STR_CONFIG_SETTING_RECESSIONS_HELPTEXT :启用后,经济衰退将每隔几年就出现。在衰退期内,所有产出将大幅下降直至衰退结束。
|
STR_CONFIG_SETTING_RECESSIONS_HELPTEXT :启用后,经济衰退将每隔几年就出现。在衰退期内,所有产出将大幅下降直至衰退结束。
|
||||||
@@ -1282,7 +1282,7 @@ STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT :启用后,如
|
|||||||
STR_CONFIG_SETTING_DISASTERS :灾难: {STRING}
|
STR_CONFIG_SETTING_DISASTERS :灾难: {STRING}
|
||||||
STR_CONFIG_SETTING_DISASTERS_HELPTEXT :灾难可能引起堵车或者车祸或者建筑损毁。
|
STR_CONFIG_SETTING_DISASTERS_HELPTEXT :灾难可能引起堵车或者车祸或者建筑损毁。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_CITY_APPROVAL :地区政府对区域改造的态度: {STRING}
|
STR_CONFIG_SETTING_CITY_APPROVAL :地方政府态度: {STRING}
|
||||||
STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT :设置相关参数以决定各公司造成的噪音及环境破坏时,各城镇对该公司的评价及未来城镇建设的影响。
|
STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT :设置相关参数以决定各公司造成的噪音及环境破坏时,各城镇对该公司的评价及未来城镇建设的影响。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT :地图高度限制:{STRING}
|
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT :地图高度限制:{STRING}
|
||||||
@@ -1292,7 +1292,7 @@ STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_VALUE :{NUM}
|
|||||||
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_AUTO :(自动)
|
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_AUTO :(自动)
|
||||||
STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN :{WHITE}您不能把最高地面高度限制设为这个值,因为地图上至少有一座山的高度大于该值
|
STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN :{WHITE}您不能把最高地面高度限制设为这个值,因为地图上至少有一座山的高度大于该值
|
||||||
|
|
||||||
STR_CONFIG_SETTING_AUTOSLOPE :允许在建筑、轨道等下方改变地形(自动斜坡): {STRING}
|
STR_CONFIG_SETTING_AUTOSLOPE :允许在基建设施底下改变地形: {STRING}
|
||||||
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT :允许在建筑和轨道下方改变地形而不需要拆除他们
|
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT :允许在建筑和轨道下方改变地形而不需要拆除他们
|
||||||
|
|
||||||
STR_CONFIG_SETTING_CATCHMENT :允许更真实的客源范围:{STRING}
|
STR_CONFIG_SETTING_CATCHMENT :允许更真实的客源范围:{STRING}
|
||||||
@@ -1301,28 +1301,28 @@ STR_CONFIG_SETTING_CATCHMENT_HELPTEXT :启用时不同
|
|||||||
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES :公司私有车站可以服务自带车站的工业设施:{STRING}
|
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES :公司私有车站可以服务自带车站的工业设施:{STRING}
|
||||||
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES_HELPTEXT :启用后,自带车站的工业设施(如钻井平台)也可以被临近的公司私有车站服务。禁用后,这些工业设施只能被它们自带的车站服务。任何临近的公司车站将不能服务它们,工业设施自有车站也不会提供除本工业设施的产品以外的其他产品
|
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES_HELPTEXT :启用后,自带车站的工业设施(如钻井平台)也可以被临近的公司私有车站服务。禁用后,这些工业设施只能被它们自带的车站服务。任何临近的公司车站将不能服务它们,工业设施自有车站也不会提供除本工业设施的产品以外的其他产品
|
||||||
|
|
||||||
STR_CONFIG_SETTING_EXTRADYNAMITE :允许拆除更多的由城镇所有的公路、桥梁、隧道等:{STRING}
|
STR_CONFIG_SETTING_EXTRADYNAMITE :允许拆除更多的城市桥隧道路:{STRING}
|
||||||
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT :启用时更容易拆除城市自有的设施和建筑
|
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT :启用时更容易拆除城市自有的设施和建筑
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TRAIN_LENGTH :火车的最大长度:{STRING}
|
STR_CONFIG_SETTING_TRAIN_LENGTH :火车的最大长度:{STRING}
|
||||||
STR_CONFIG_SETTING_TRAIN_LENGTH_HELPTEXT :设置火车的最大长度
|
STR_CONFIG_SETTING_TRAIN_LENGTH_HELPTEXT :设置火车的最大长度
|
||||||
STR_CONFIG_SETTING_TILE_LENGTH :{COMMA} 格
|
STR_CONFIG_SETTING_TILE_LENGTH :{COMMA} 格
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SMOKE_AMOUNT :火车头产生的蒸气/火花数量: {STRING}
|
STR_CONFIG_SETTING_SMOKE_AMOUNT :载具废气数量: {STRING}
|
||||||
STR_CONFIG_SETTING_SMOKE_AMOUNT_HELPTEXT :设置由火车头产生的蒸汽或者火花数量
|
STR_CONFIG_SETTING_SMOKE_AMOUNT_HELPTEXT :设定载具可产生多少废气,即蒸汽/火花。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL :列车加速度: {STRING}
|
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL :列车加速模型: {STRING}
|
||||||
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_HELPTEXT :选择列车加速度模型,选“原版”时斜坡对所有列车影响相同,“真实”时影响因素包括斜坡长度、转弯半径、牵引力等
|
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_HELPTEXT :选择列车加速度模型,选“原版”时斜坡对所有列车影响相同,“真实”时影响因素包括斜坡长度、转弯半径、牵引力等
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL :汽车加速模型: {STRING}
|
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL :汽车加速模型: {STRING}
|
||||||
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL_HELPTEXT :选择汽车加速度模型,选“原版”时斜坡对所有汽车影响相同,选“真实”时依赖引擎性能,比如“牵引力”
|
STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL_HELPTEXT :选择汽车加速度模型,选“原版”时斜坡对所有汽车影响相同,选“真实”时依赖引擎性能,比如“牵引力”
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS :斜坡对火车的影响率:{STRING}
|
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS :列车斜坡坡度:{STRING}
|
||||||
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS_HELPTEXT :每一格斜坡对火车速度的影响率,数值越大,火车越难爬上斜坡
|
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS_HELPTEXT :设置对列车而言,一格斜坡的坡度大小。数值越高,坡度越大,列车越难爬上斜坡。
|
||||||
STR_CONFIG_SETTING_PERCENTAGE :{COMMA}%
|
STR_CONFIG_SETTING_PERCENTAGE :{COMMA}%
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :斜坡对汽车速度影响率: {STRING}
|
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :汽车斜坡坡度: {STRING}
|
||||||
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :每一格斜坡对汽车速度的影响率,数值越大,汽车越难爬上斜坡
|
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :设置对汽车而言,一格斜坡的坡度大小。数值越高,坡度越大,汽车越难爬上斜坡。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_FORBID_90_DEG :禁止列车 90 度转弯:{STRING}
|
STR_CONFIG_SETTING_FORBID_90_DEG :禁止列车 90 度转弯:{STRING}
|
||||||
STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :当水平方向轨道与垂直方向轨道交叉时,没有采用45度的轨道组合连接,而是采用轨道90度直接连接时,列车通过时需要90度转弯,当本设置”打开“时,将禁止火车90度转弯。
|
STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :当水平方向轨道与垂直方向轨道交叉时,没有采用45度的轨道组合连接,而是采用轨道90度直接连接时,列车通过时需要90度转弯,当本设置”打开“时,将禁止火车90度转弯。
|
||||||
@@ -1389,17 +1389,17 @@ STR_CONFIG_SETTING_BRIBE_HELPTEXT :“打开”时
|
|||||||
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE :允许买断经营权: {STRING}
|
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE :允许买断经营权: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT :如果一家公司购买了城市独家经营权,其它公司的站台将在一年之内不再产生乘客或者货物。
|
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT :如果一家公司购买了城市独家经营权,其它公司的站台将在一年之内不再产生乘客或者货物。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS :允许新建房屋: {STRING}
|
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS :允许资助城镇建设: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT :“打开”时,允许公司提供资助新建房屋
|
STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT :“打开”时,允许公司提供资助新建房屋
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ALLOW_FUND_ROAD :允许使用资助地方道路修整功能: {STRING}
|
STR_CONFIG_SETTING_ALLOW_FUND_ROAD :允许资助道路重建: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_FUND_ROAD_HELPTEXT :“打开”时,允许公司资助地方修整道路
|
STR_CONFIG_SETTING_ALLOW_FUND_ROAD_HELPTEXT :“打开”时,允许公司资助地方修整道路
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY :允许向其他公司转移资金: {STRING}
|
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY :允许向其他公司转移资金: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY_HELPTEXT :“打开”时,允许联机游戏模式下公司之间转移资金
|
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY_HELPTEXT :“打开”时,允许联机游戏模式下公司之间转移资金
|
||||||
|
|
||||||
STR_CONFIG_SETTING_FREIGHT_TRAINS :根据装载货物的数量模拟超重列车:{STRING}
|
STR_CONFIG_SETTING_FREIGHT_TRAINS :货物重量倍数:{STRING}
|
||||||
STR_CONFIG_SETTING_FREIGHT_TRAINS_HELPTEXT :设置载重量对火车的影响效果,高一些的数值会使火车对载重量更敏感,尤其是爬坡时
|
STR_CONFIG_SETTING_FREIGHT_TRAINS_HELPTEXT :设置列车所载货物的重量倍数。设定的数值越高,货物对列车而言月中,并影响其加速、转弯及上坡的效率。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_PLANE_SPEED :飞机速度因子:{STRING}
|
STR_CONFIG_SETTING_PLANE_SPEED :飞机速度因子:{STRING}
|
||||||
STR_CONFIG_SETTING_PLANE_SPEED_HELPTEXT :设置飞机与其它车辆类型的相对速率,使飞机运输收入减少
|
STR_CONFIG_SETTING_PLANE_SPEED_HELPTEXT :设置飞机与其它车辆类型的相对速率,使飞机运输收入减少
|
||||||
@@ -1421,14 +1421,14 @@ STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :允许在竞争
|
|||||||
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :“打开”时,允许在其它公司所属的道路上建设通过式车站
|
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :“打开”时,允许在其它公司所属的道路上建设通过式车站
|
||||||
STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}当有车辆时,不可能更改此设定。
|
STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}当有车辆时,不可能更改此设定。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :加强版固定资产维护: {STRING}
|
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :基础设施维护: {STRING}
|
||||||
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :固定资产会发生维护费用,“打开”本选项时,维护费用的增长会超过交通网络的增长规模,因而,对大公司影响更大。
|
STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :启用时,基础设施会产生维护成本。公司所拥有的基础建设越多,维护成本也相应地越多。此设定更多影响较大的公司,而对较小的公司影响更小。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :初创公司颜色:{STRING}
|
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :公司初始主色调:{STRING}
|
||||||
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :选定公司的初始配色方案
|
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :选定公司的初始配色方案
|
||||||
|
|
||||||
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :公司初始副色调: {STRING}
|
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :公司初始副色调: {STRING}
|
||||||
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :如果正在使用的NewGRF允许,选定一个公司初始副色调。
|
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :选择公司初始副色调,需要使用支持副色调的NewGRF。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :总允许建设小型机场: {STRING}
|
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :总允许建设小型机场: {STRING}
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :“打开”此选项,每种类型机场出现后一直是可用的
|
STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :“打开”此选项,每种类型机场出现后一直是可用的
|
||||||
@@ -1476,19 +1476,19 @@ STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT :在地图城镇
|
|||||||
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :图表曲线宽度: {STRING}
|
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :图表曲线宽度: {STRING}
|
||||||
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :图表中曲线的宽度,细线清晰易读,粗线容易分辨颜色
|
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :图表中曲线的宽度,细线清晰易读,粗线容易分辨颜色
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :在建造运输工具窗口中显示 NewGRF 的名字:{STRING}
|
STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :在购买载具窗口中显示 NewGRF 的名字:{STRING}
|
||||||
STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :在建造运输工具窗口中添加一行,显示选中运输工具来自的 NewGRF。
|
STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :在购买载具窗口中添加一行,显示选中载具的 NewGRF。
|
||||||
STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :在列表窗口中显示车辆可以携带的货物 {STRING}
|
STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS :在列表窗口中显示车辆可以携带的货物 {STRING}
|
||||||
STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :如果启用,车辆的可运输负载将出现在车辆列表的上方
|
STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :如果启用,车辆的可运输负载将出现在车辆列表的上方
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LANDSCAPE :景观: {STRING}
|
STR_CONFIG_SETTING_LANDSCAPE :景观: {STRING}
|
||||||
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :此设置决定基本的游戏场景、有什么货物可供运输,以及城镇发展的所需条件。然而,NewGRF 及游戏脚本可以比此设置更加细致地设置游戏场景
|
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :此设置决定基本的游戏场景、有什么货物可供运输,以及城镇发展的所需条件。然而,NewGRF 及游戏脚本可以比此设置更加细致地设置游戏场景
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LAND_GENERATOR :生成地形:{STRING}
|
STR_CONFIG_SETTING_LAND_GENERATOR :地形算法:{STRING}
|
||||||
STR_CONFIG_SETTING_LAND_GENERATOR_HELPTEXT :使用原始算法时,系统会依赖基础图形组去生成固定的地形。新算法 TerraGenesis 是一个基于 Perlin 噪声的地形生成程序,支持较为细致的地形设置
|
STR_CONFIG_SETTING_LAND_GENERATOR_HELPTEXT :使用原始算法时,系统会依赖基础图形组去生成固定的地形。新算法 TerraGenesis 是一个基于柏林噪声的地形生成程序,支持较为细致的地形设置
|
||||||
###length 2
|
###length 2
|
||||||
STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :原始算法
|
STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :原始算法
|
||||||
STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS :新算法
|
STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS :TerraGenesis
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TERRAIN_TYPE :地貌类型: {STRING}
|
STR_CONFIG_SETTING_TERRAIN_TYPE :地貌类型: {STRING}
|
||||||
STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT :选择生成地图的起伏度
|
STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT :选择生成地图的起伏度
|
||||||
@@ -1500,17 +1500,17 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :石油工业距
|
|||||||
STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :限制炼油厂和油井到地图边缘或海岛海岸的最大距离。对于大于 256 格的地图,该值将按比例放大。
|
STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :限制炼油厂和油井到地图边缘或海岛海岸的最大距离。对于大于 256 格的地图,该值将按比例放大。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SNOWLINE_HEIGHT :雪线高度:{STRING}
|
STR_CONFIG_SETTING_SNOWLINE_HEIGHT :雪线高度:{STRING}
|
||||||
STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :控制在寒带气候中雪线高度。大雪会影响工业和城镇发展需求。只能在场景编辑器中更改或由“积雪覆盖率”计算得到。
|
STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :控制在寒带气候中雪线高度。大雪会影响工业和城镇发展需求。只能在场景编辑器中更改或由“雪地比率”计算得到。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SNOW_COVERAGE :积雪覆盖率:{STRING}
|
STR_CONFIG_SETTING_SNOW_COVERAGE :雪地比率:{STRING}
|
||||||
STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :控制寒带气候中大致的雪量。雪会影响工业和城镇发展需求。只在地图生成时使用。海岸线上的土地永远没有积雪
|
STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :控制寒带气候中大致的雪量。雪会影响工业和城镇发展需求。只在地图生成时使用。海岸线上的土地永远没有积雪
|
||||||
STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE :{NUM}%
|
STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE :{NUM}%
|
||||||
|
|
||||||
STR_CONFIG_SETTING_DESERT_COVERAGE :沙漠覆盖率:{STRING}
|
STR_CONFIG_SETTING_DESERT_COVERAGE :沙漠比率:{STRING}
|
||||||
STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :控制热带气候中大致的沙漠量。沙漠会影响工业生成和城镇发展需求。只在地图生成时有效
|
STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT :控制热带气候中大致的沙漠量。沙漠会影响工业生成和城镇发展需求。只在地图生成时有效
|
||||||
STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}%
|
STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE :{NUM}%
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :地面粗糙度 (仅限生成地图时):{STRING}
|
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :地面粗糙度:{STRING}
|
||||||
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :选择在地图上的山丘密度。光滑的地形会包含较少且相互之间较分散的山丘;粗糙的地形的山丘较密集,但可能会使地图显得重复
|
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT :选择在地图上的山丘密度。光滑的地形会包含较少且相互之间较分散的山丘;粗糙的地形的山丘较密集,但可能会使地图显得重复
|
||||||
###length 4
|
###length 4
|
||||||
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH :非常光滑
|
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH :非常光滑
|
||||||
@@ -1528,15 +1528,15 @@ STR_CONFIG_SETTING_TREE_PLACER :森林算法:
|
|||||||
STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :选择地图上树木的分布方式:“原版”树木各处一致分布,“改良”各类树木成片分布
|
STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :选择地图上树木的分布方式:“原版”树木各处一致分布,“改良”各类树木成片分布
|
||||||
###length 3
|
###length 3
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_NONE :没有
|
STR_CONFIG_SETTING_TREE_PLACER_NONE :没有
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :原始的
|
STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :原版
|
||||||
STR_CONFIG_SETTING_TREE_PLACER_IMPROVED :增强的
|
STR_CONFIG_SETTING_TREE_PLACER_IMPROVED :改良
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE :道路车辆: {STRING}
|
STR_CONFIG_SETTING_ROAD_SIDE :道路车辆: {STRING}
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE_HELPTEXT :选择道路通行方向
|
STR_CONFIG_SETTING_ROAD_SIDE_HELPTEXT :选择道路通行方向
|
||||||
|
|
||||||
###length 2
|
###length 2
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE_LEFT :左侧通行
|
STR_CONFIG_SETTING_ROAD_SIDE_LEFT :左行
|
||||||
STR_CONFIG_SETTING_ROAD_SIDE_RIGHT :右侧通行
|
STR_CONFIG_SETTING_ROAD_SIDE_RIGHT :右行
|
||||||
|
|
||||||
STR_CONFIG_SETTING_HEIGHTMAP_ROTATION :高度图旋转:{STRING}
|
STR_CONFIG_SETTING_HEIGHTMAP_ROTATION :高度图旋转:{STRING}
|
||||||
STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_TOOLTIP :选择高度图旋转的方向以创建地图
|
STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_TOOLTIP :选择高度图旋转的方向以创建地图
|
||||||
@@ -1650,8 +1650,8 @@ STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL :暂停时允许
|
|||||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_HELPTEXT :选择游戏暂停时可以进行哪些操作
|
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_HELPTEXT :选择游戏暂停时可以进行哪些操作
|
||||||
###length 4
|
###length 4
|
||||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS :没有操作
|
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS :没有操作
|
||||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_NON_CONSTRUCTION :除建设面板外全部操作
|
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_NON_CONSTRUCTION :除建设操作外所有操作
|
||||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_NON_LANDSCAPING :除景观面板操作外全部操作
|
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_NON_LANDSCAPING :除景观操作所有操作
|
||||||
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_ACTIONS :所有操作
|
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_ALL_ACTIONS :所有操作
|
||||||
|
|
||||||
STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS :使用高级车辆列表: {STRING}
|
STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS :使用高级车辆列表: {STRING}
|
||||||
@@ -1713,8 +1713,8 @@ STR_CONFIG_SETTING_SOUND_CLICK_HELPTEXT :按一下按钮
|
|||||||
STR_CONFIG_SETTING_SOUND_DISASTER :灾难/事故: {STRING}
|
STR_CONFIG_SETTING_SOUND_DISASTER :灾难/事故: {STRING}
|
||||||
STR_CONFIG_SETTING_SOUND_DISASTER_HELPTEXT :播放灾难和事故音效
|
STR_CONFIG_SETTING_SOUND_DISASTER_HELPTEXT :播放灾难和事故音效
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SOUND_VEHICLE :运输工具: {STRING}
|
STR_CONFIG_SETTING_SOUND_VEHICLE :载具: {STRING}
|
||||||
STR_CONFIG_SETTING_SOUND_VEHICLE_HELPTEXT :播放运输工具音效
|
STR_CONFIG_SETTING_SOUND_VEHICLE_HELPTEXT :播放载具音效
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SOUND_AMBIENT :音效:{STRING}
|
STR_CONFIG_SETTING_SOUND_AMBIENT :音效:{STRING}
|
||||||
STR_CONFIG_SETTING_SOUND_AMBIENT_HELPTEXT :播放与地貌、工业设施和城镇有关的环境音效
|
STR_CONFIG_SETTING_SOUND_AMBIENT_HELPTEXT :播放与地貌、工业设施和城镇有关的环境音效
|
||||||
@@ -1759,7 +1759,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY :每个脚本的
|
|||||||
STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :单个脚本强制终止前可占用的最大内存量。对于大地图可能需要增加。
|
STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :单个脚本强制终止前可占用的最大内存量。对于大地图可能需要增加。
|
||||||
STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB
|
STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SERVINT_ISPERCENT :保养周期(百分数): {STRING}
|
STR_CONFIG_SETTING_SERVINT_ISPERCENT :维护间隔以百分比(%)计算: {STRING}
|
||||||
STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :“打开”时,当车辆的可靠性降到他们最大可靠性的一定百分比时,他们会去保养。{}{}例如,如果一辆车的最大可靠性是90%,而保养间隔是20%,车辆会在可靠性为72%时去保养。
|
STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :“打开”时,当车辆的可靠性降到他们最大可靠性的一定百分比时,他们会去保养。{}{}例如,如果一辆车的最大可靠性是90%,而保养间隔是20%,车辆会在可靠性为72%时去保养。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SERVINT_TRAINS :火车默认保养周期:{STRING}
|
STR_CONFIG_SETTING_SERVINT_TRAINS :火车默认保养周期:{STRING}
|
||||||
@@ -1780,23 +1780,23 @@ STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :“打开”时
|
|||||||
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY :站台长度装卸惩罚:{STRING}
|
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY :站台长度装卸惩罚:{STRING}
|
||||||
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :启用站台长度装卸惩罚。过长的火车将会在站台中装卸得更慢。此项设置不会影响寻路。
|
STR_CONFIG_SETTING_STATION_LENGTH_LOADING_PENALTY_HELPTEXT :启用站台长度装卸惩罚。过长的火车将会在站台中装卸得更慢。此项设置不会影响寻路。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_WAGONSPEEDLIMITS :启动车辆限速:{STRING}
|
STR_CONFIG_SETTING_WAGONSPEEDLIMITS :列车车厢速度限制:{STRING}
|
||||||
STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :“打开“时,还要根据车辆的限速来决定一列火车的最高速度
|
STR_CONFIG_SETTING_WAGONSPEEDLIMITS_HELPTEXT :启用时,列车的最高速度将取决于车厢的速度上限。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_DISABLE_ELRAILS :禁用电气化铁路:{STRING}
|
STR_CONFIG_SETTING_DISABLE_ELRAILS :禁用电气化铁路:{STRING}
|
||||||
STR_CONFIG_SETTING_DISABLE_ELRAILS_HELPTEXT :“打开”本选项时禁止电气化铁路的使用
|
STR_CONFIG_SETTING_DISABLE_ELRAILS_HELPTEXT :“打开”本选项时禁止电气化铁路的使用
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN :玩家车站的剪彩仪式: {STRING}
|
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN :玩家车站的剪彩仪式: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN_HELPTEXT :报纸报道运输工具到达新玩家的站台情况
|
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN_HELPTEXT :当玩家设立的车站首次有载具停靠时显示讯息。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER :对手车站的剪彩仪式: {STRING}
|
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER :对手车站的剪彩仪式: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER_HELPTEXT :报纸报道竞争对手运输工具新到一个站台的情况
|
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER_HELPTEXT :当对手设立的车站首次有载具停靠时显示讯息。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS :事故/灾难: {STRING}
|
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS :事故/灾难: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT :报纸报道事故或灾难发生情况
|
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT :报纸报道事故或灾难发生情况
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER :竞争对手的运输工具事故:{STRING}
|
STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER :竞争对手的载具事故:{STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER_HELPTEXT :显示竞争对手的运输工具事故消息
|
STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER_HELPTEXT :显示竞争对手的载具事故消息
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION :公司信息: {STRING}
|
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION :公司信息: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION_HELPTEXT :报纸报道新公司开业或者预警倒闭风险
|
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION_HELPTEXT :报纸报道新公司开业或者预警倒闭风险
|
||||||
@@ -1820,10 +1820,10 @@ STR_CONFIG_SETTING_NEWS_INDUSTRY_CHANGES_UNSERVED :其它工业产
|
|||||||
STR_CONFIG_SETTING_NEWS_INDUSTRY_CHANGES_UNSERVED_HELPTEXT :报纸报道非玩家或竞争对手的工业产量变化
|
STR_CONFIG_SETTING_NEWS_INDUSTRY_CHANGES_UNSERVED_HELPTEXT :报纸报道非玩家或竞争对手的工业产量变化
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_ADVICE :对于企业车辆的建议及信息: {STRING}
|
STR_CONFIG_SETTING_NEWS_ADVICE :对于企业车辆的建议及信息: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_ADVICE_HELPTEXT :显示运输工具需要关注的消息
|
STR_CONFIG_SETTING_NEWS_ADVICE_HELPTEXT :显示载具需要关注的消息
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_NEW_VEHICLES :新车型: {STRING}
|
STR_CONFIG_SETTING_NEWS_NEW_VEHICLES :载具上市: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_NEW_VEHICLES_HELPTEXT :显示新运输工具上市的消息
|
STR_CONFIG_SETTING_NEWS_NEW_VEHICLES_HELPTEXT :显示新载具上市的消息
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NEWS_CHANGES_ACCEPTANCE :货物接受情况变更: {STRING}
|
STR_CONFIG_SETTING_NEWS_CHANGES_ACCEPTANCE :货物接受情况变更: {STRING}
|
||||||
STR_CONFIG_SETTING_NEWS_CHANGES_ACCEPTANCE_HELPTEXT :显示站台接受货物种类变更的消息
|
STR_CONFIG_SETTING_NEWS_CHANGES_ACCEPTANCE_HELPTEXT :显示站台接受货物种类变更的消息
|
||||||
@@ -1879,7 +1879,7 @@ STR_CONFIG_SETTING_SIGNAL_GUI_MODE_HELPTEXT :选择在信号
|
|||||||
STR_CONFIG_SETTING_SIGNAL_GUI_MODE_PATH :仅路径信号灯
|
STR_CONFIG_SETTING_SIGNAL_GUI_MODE_PATH :仅路径信号灯
|
||||||
STR_CONFIG_SETTING_SIGNAL_GUI_MODE_ALL_CYCLE_PATH :所有信号
|
STR_CONFIG_SETTING_SIGNAL_GUI_MODE_ALL_CYCLE_PATH :所有信号
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TOWN_LAYOUT :新建城镇道路自动延伸: {STRING}
|
STR_CONFIG_SETTING_TOWN_LAYOUT :新建城镇道路布局: {STRING}
|
||||||
STR_CONFIG_SETTING_TOWN_LAYOUT_HELPTEXT :选择城市道路网络的建设方式
|
STR_CONFIG_SETTING_TOWN_LAYOUT_HELPTEXT :选择城市道路网络的建设方式
|
||||||
###length 5
|
###length 5
|
||||||
STR_CONFIG_SETTING_TOWN_LAYOUT_DEFAULT :默认
|
STR_CONFIG_SETTING_TOWN_LAYOUT_DEFAULT :默认
|
||||||
@@ -1891,10 +1891,10 @@ STR_CONFIG_SETTING_TOWN_LAYOUT_RANDOM :随机
|
|||||||
STR_CONFIG_SETTING_ALLOW_TOWN_ROADS :允许城镇建设道路: {STRING}
|
STR_CONFIG_SETTING_ALLOW_TOWN_ROADS :允许城镇建设道路: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :“打开”时允许成长时建设道路,“关闭”时禁止城镇自行建设道路
|
STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :“打开”时允许成长时建设道路,“关闭”时禁止城镇自行建设道路
|
||||||
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :允许城镇建设平交道: {STRING}
|
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :允许城镇建设平交道: {STRING}
|
||||||
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :“打开”时允许城镇建设平交路口
|
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :“打开”时允许城镇建设平交道口
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NOISE_LEVEL :基于噪音级别控制机场建设: {STRING}
|
STR_CONFIG_SETTING_NOISE_LEVEL :允许城镇限制机场噪音: {STRING}
|
||||||
STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :允许城镇基于城镇人口、机场大小和距离控制机场噪音。“关闭”时,每个城市只允许建设两座机场,除非地方政府态度被设为“宽容的”
|
STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :允许城镇基于城镇人口、机场大小和距离控制机场噪音。“关闭”时,每个城市只允许建设两座机场,除非地方政府态度被设为“放任”
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TOWN_FOUNDING :在游戏中建立城镇: {STRING}
|
STR_CONFIG_SETTING_TOWN_FOUNDING :在游戏中建立城镇: {STRING}
|
||||||
STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :“打开”本选项时,允许玩家在游戏中创建新城镇
|
STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :“打开”本选项时,允许玩家在游戏中创建新城镇
|
||||||
@@ -1960,7 +1960,7 @@ STR_CONFIG_SETTING_TOWN_GROWTH_NORMAL :正常
|
|||||||
STR_CONFIG_SETTING_TOWN_GROWTH_FAST :快
|
STR_CONFIG_SETTING_TOWN_GROWTH_FAST :快
|
||||||
STR_CONFIG_SETTING_TOWN_GROWTH_VERY_FAST :非常快
|
STR_CONFIG_SETTING_TOWN_GROWTH_VERY_FAST :非常快
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LARGER_TOWNS :随机生成城镇时,生成大都市的比例为: {STRING}
|
STR_CONFIG_SETTING_LARGER_TOWNS :都市比例: {STRING}
|
||||||
STR_CONFIG_SETTING_LARGER_TOWNS_HELPTEXT :随机生成城镇时,有可能生成大都市的数量,这些大都市起始人口较多、发展也较快。
|
STR_CONFIG_SETTING_LARGER_TOWNS_HELPTEXT :随机生成城镇时,有可能生成大都市的数量,这些大都市起始人口较多、发展也较快。
|
||||||
STR_CONFIG_SETTING_LARGER_TOWNS_VALUE :1 / {COMMA}
|
STR_CONFIG_SETTING_LARGER_TOWNS_VALUE :1 / {COMMA}
|
||||||
###setting-zero-is-special
|
###setting-zero-is-special
|
||||||
@@ -1998,7 +1998,7 @@ STR_CONFIG_SETTING_SHORT_PATH_SATURATION :如果最短路
|
|||||||
STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :货物分配功能在派送货物时,会优先使用最短路径,当它饱和后改用第二短的路径,如此类推。当所有路径皆饱和但仍未满足需求,系统會由容量较大的路径开始继续加载货物。{}由于路径饱和度难以准确估算,此设定容许您定义一值,使短路径达到该饱和度后,系统便开始加载容量较大的路径。{}如果此设定的值少於100%,就算系统高估路径容量,也不會使过多的货物滞留在站台上。
|
STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :货物分配功能在派送货物时,会优先使用最短路径,当它饱和后改用第二短的路径,如此类推。当所有路径皆饱和但仍未满足需求,系统會由容量较大的路径开始继续加载货物。{}由于路径饱和度难以准确估算,此设定容许您定义一值,使短路径达到该饱和度后,系统便开始加载容量较大的路径。{}如果此设定的值少於100%,就算系统高估路径容量,也不會使过多的货物滞留在站台上。
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位(陆地):{STRING}
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位(陆地):{STRING}
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :速度单位 (航海): {STRING}
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :速度单位(航海):{STRING}
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :在界面上以所选择的单位表示速度
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :在界面上以所选择的单位表示速度
|
||||||
###length 5
|
###length 5
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :英制(英里/小时)
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :英制(英里/小时)
|
||||||
@@ -2007,8 +2007,8 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :国际单位制
|
|||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :游戏单位 (格/日)
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :游戏单位 (格/日)
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :节
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :节
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :运输工具功率单位:{STRING}
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :载具功率单位:{STRING}
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :在界面上以所选择的单位表示运输工具的功率
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :在界面上以所选择的单位表示载具的功率
|
||||||
###length 3
|
###length 3
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_IMPERIAL :英制(马力)
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_IMPERIAL :英制(马力)
|
||||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_METRIC :公制(马力)
|
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_METRIC :公制(马力)
|
||||||
@@ -2316,7 +2316,7 @@ STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP :{BLACK}游戏
|
|||||||
STR_NETWORK_SERVER_LIST_DATE_CAPTION :{BLACK}日期
|
STR_NETWORK_SERVER_LIST_DATE_CAPTION :{BLACK}日期
|
||||||
STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP :{BLACK}当前日期
|
STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP :{BLACK}当前日期
|
||||||
STR_NETWORK_SERVER_LIST_YEARS_CAPTION :{BLACK}年数
|
STR_NETWORK_SERVER_LIST_YEARS_CAPTION :{BLACK}年数
|
||||||
STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP :{BLACK}年数{}游戏正在运行的
|
STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP :{BLACK}游戏年数{}游戏正在运行中
|
||||||
STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP :{BLACK}语言,服务器版本和其他信息
|
STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP :{BLACK}语言,服务器版本和其他信息
|
||||||
|
|
||||||
STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT :{BLACK}点击列表中的服务器可以选定它
|
STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT :{BLACK}点击列表中的服务器可以选定它
|
||||||
@@ -2324,12 +2324,12 @@ STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER :{BLACK}上一
|
|||||||
STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST :{BLACK}点击选择您上次加入的服务器
|
STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST :{BLACK}点击选择您上次加入的服务器
|
||||||
|
|
||||||
STR_NETWORK_SERVER_LIST_GAME_INFO :{SILVER}游戏信息
|
STR_NETWORK_SERVER_LIST_GAME_INFO :{SILVER}游戏信息
|
||||||
STR_NETWORK_SERVER_LIST_CLIENTS :{SILVER}客 户 端: {WHITE}{COMMA} / {COMMA} - {COMMA} / {COMMA}
|
STR_NETWORK_SERVER_LIST_CLIENTS :{SILVER}客户端: {WHITE}{COMMA} / {COMMA} - {COMMA} / {COMMA}
|
||||||
STR_NETWORK_SERVER_LIST_LANDSCAPE :{SILVER}场景类型: {WHITE}{STRING}
|
STR_NETWORK_SERVER_LIST_LANDSCAPE :{SILVER}场景类型: {WHITE}{STRING}
|
||||||
STR_NETWORK_SERVER_LIST_MAP_SIZE :{SILVER}地图尺寸: {WHITE}{COMMA}×{COMMA}
|
STR_NETWORK_SERVER_LIST_MAP_SIZE :{SILVER}地图尺寸: {WHITE}{COMMA}×{COMMA}
|
||||||
STR_NETWORK_SERVER_LIST_SERVER_VERSION :{SILVER}服务器版本: {WHITE}{STRING}
|
STR_NETWORK_SERVER_LIST_SERVER_VERSION :{SILVER}游戏版本: {WHITE}{STRING}
|
||||||
STR_NETWORK_SERVER_LIST_SERVER_ADDRESS :{SILVER}该服IP: {WHITE}{STRING}
|
STR_NETWORK_SERVER_LIST_SERVER_ADDRESS :{SILVER}该服IP: {WHITE}{STRING}
|
||||||
STR_NETWORK_SERVER_LIST_INVITE_CODE :{SILVER}邀请码:{WHITE}{STRING}
|
STR_NETWORK_SERVER_LIST_INVITE_CODE :{SILVER}邀请代码:{WHITE}{STRING}
|
||||||
STR_NETWORK_SERVER_LIST_START_DATE :{SILVER}开始日期: {WHITE}{DATE_SHORT}
|
STR_NETWORK_SERVER_LIST_START_DATE :{SILVER}开始日期: {WHITE}{DATE_SHORT}
|
||||||
STR_NETWORK_SERVER_LIST_CURRENT_DATE :{SILVER}当前日期: {WHITE}{DATE_SHORT}
|
STR_NETWORK_SERVER_LIST_CURRENT_DATE :{SILVER}当前日期: {WHITE}{DATE_SHORT}
|
||||||
STR_NETWORK_SERVER_LIST_GAMESCRIPT :{SILVER}游戏脚本:{WHITE}{STRING} (v{NUM})
|
STR_NETWORK_SERVER_LIST_GAMESCRIPT :{SILVER}游戏脚本:{WHITE}{STRING} (v{NUM})
|
||||||
@@ -3223,7 +3223,7 @@ STR_MAPGEN_NUMBER_OF_TOWNS :{BLACK}城镇
|
|||||||
STR_MAPGEN_NUMBER_OF_TOWNS_TOOLTIP :{BLACK}选择城镇密度,或者输入一个自定义数字
|
STR_MAPGEN_NUMBER_OF_TOWNS_TOOLTIP :{BLACK}选择城镇密度,或者输入一个自定义数字
|
||||||
STR_MAPGEN_TOWN_NAME_LABEL :{BLACK}城镇名称:
|
STR_MAPGEN_TOWN_NAME_LABEL :{BLACK}城镇名称:
|
||||||
STR_MAPGEN_TOWN_NAME_DROPDOWN_TOOLTIP :{BLACK}选择城镇名称的命名风格
|
STR_MAPGEN_TOWN_NAME_DROPDOWN_TOOLTIP :{BLACK}选择城镇名称的命名风格
|
||||||
STR_MAPGEN_DATE :{BLACK}日期:
|
STR_MAPGEN_DATE :{BLACK}起始日期:
|
||||||
STR_MAPGEN_DATE_TOOLTIP :{BLACK}选择起始日期
|
STR_MAPGEN_DATE_TOOLTIP :{BLACK}选择起始日期
|
||||||
STR_MAPGEN_NUMBER_OF_INDUSTRIES :{BLACK}工业数量:
|
STR_MAPGEN_NUMBER_OF_INDUSTRIES :{BLACK}工业数量:
|
||||||
STR_MAPGEN_NUMBER_OF_INDUSTRIES_TOOLTIP :{BLACK}选择工业密度,或者输入一个自定义数字
|
STR_MAPGEN_NUMBER_OF_INDUSTRIES_TOOLTIP :{BLACK}选择工业密度,或者输入一个自定义数字
|
||||||
@@ -3231,17 +3231,17 @@ STR_MAPGEN_HEIGHTMAP_HEIGHT :{BLACK}最高
|
|||||||
STR_MAPGEN_HEIGHTMAP_HEIGHT_TOOLTIP :{BLACK}选择游戏地图中最高峰的海拔,以海平面为原点计。
|
STR_MAPGEN_HEIGHTMAP_HEIGHT_TOOLTIP :{BLACK}选择游戏地图中最高峰的海拔,以海平面为原点计。
|
||||||
STR_MAPGEN_HEIGHTMAP_HEIGHT_UP :{BLACK}提高最高峰的最大高度一格
|
STR_MAPGEN_HEIGHTMAP_HEIGHT_UP :{BLACK}提高最高峰的最大高度一格
|
||||||
STR_MAPGEN_HEIGHTMAP_HEIGHT_DOWN :{BLACK}降低最高峰的最大高度一格
|
STR_MAPGEN_HEIGHTMAP_HEIGHT_DOWN :{BLACK}降低最高峰的最大高度一格
|
||||||
STR_MAPGEN_SNOW_COVERAGE :{BLACK}积雪覆盖率:
|
STR_MAPGEN_SNOW_COVERAGE :{BLACK}雪地比率:
|
||||||
STR_MAPGEN_SNOW_COVERAGE_UP :{BLACK}增加 10% 积雪覆盖率
|
STR_MAPGEN_SNOW_COVERAGE_UP :{BLACK}将雪地比率增加10%
|
||||||
STR_MAPGEN_SNOW_COVERAGE_DOWN :{BLACK}减少 10% 积雪覆盖率
|
STR_MAPGEN_SNOW_COVERAGE_DOWN :{BLACK}将雪地比率减少10%
|
||||||
STR_MAPGEN_SNOW_COVERAGE_TEXT :{BLACK}{NUM}%
|
STR_MAPGEN_SNOW_COVERAGE_TEXT :{BLACK}{NUM}%
|
||||||
STR_MAPGEN_DESERT_COVERAGE :{BLACK}沙漠覆盖率:
|
STR_MAPGEN_DESERT_COVERAGE :{BLACK}沙漠覆盖率:
|
||||||
STR_MAPGEN_DESERT_COVERAGE_UP :{BLACK}增加 10% 沙漠覆盖率
|
STR_MAPGEN_DESERT_COVERAGE_UP :{BLACK}将沙漠比率增加10%
|
||||||
STR_MAPGEN_DESERT_COVERAGE_DOWN :{BLACK}减少 10% 沙漠覆盖率
|
STR_MAPGEN_DESERT_COVERAGE_DOWN :{BLACK}将沙漠比率减少10%
|
||||||
STR_MAPGEN_DESERT_COVERAGE_TEXT :{BLACK}{NUM}%
|
STR_MAPGEN_DESERT_COVERAGE_TEXT :{BLACK}{NUM}%
|
||||||
STR_MAPGEN_TERRAIN_TYPE :{BLACK}地形特点:
|
STR_MAPGEN_TERRAIN_TYPE :{BLACK}地形特点:
|
||||||
STR_MAPGEN_SEA_LEVEL :{BLACK}海洋面积:
|
STR_MAPGEN_SEA_LEVEL :{BLACK}海洋面积:
|
||||||
STR_MAPGEN_SEA_LEVEL_TOOLTIP :{BLACK} 选择覆盖率
|
STR_MAPGEN_SEA_LEVEL_TOOLTIP :{BLACK}选择海洋覆盖率
|
||||||
STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}河流数量:
|
STR_MAPGEN_QUANTITY_OF_RIVERS :{BLACK}河流数量:
|
||||||
STR_MAPGEN_SMOOTHNESS :{BLACK}平滑度:
|
STR_MAPGEN_SMOOTHNESS :{BLACK}平滑度:
|
||||||
STR_MAPGEN_VARIETY :{BLACK}多样的分发:
|
STR_MAPGEN_VARIETY :{BLACK}多样的分发:
|
||||||
@@ -3255,11 +3255,11 @@ STR_MAPGEN_GS_SETTINGS :{BLACK}游戏
|
|||||||
STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}显示游戏脚本设置
|
STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}显示游戏脚本设置
|
||||||
|
|
||||||
###length 21
|
###length 21
|
||||||
STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :英国 (原始的)
|
STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :英国 (原版)
|
||||||
STR_MAPGEN_TOWN_NAME_FRENCH :法国
|
STR_MAPGEN_TOWN_NAME_FRENCH :法国
|
||||||
STR_MAPGEN_TOWN_NAME_GERMAN :德国
|
STR_MAPGEN_TOWN_NAME_GERMAN :德国
|
||||||
STR_MAPGEN_TOWN_NAME_ADDITIONAL_ENGLISH :英国 (增强的)
|
STR_MAPGEN_TOWN_NAME_ADDITIONAL_ENGLISH :英国 (增订)
|
||||||
STR_MAPGEN_TOWN_NAME_LATIN_AMERICAN :美式拉丁
|
STR_MAPGEN_TOWN_NAME_LATIN_AMERICAN :拉丁美洲
|
||||||
STR_MAPGEN_TOWN_NAME_SILLY :搞笑地名
|
STR_MAPGEN_TOWN_NAME_SILLY :搞笑地名
|
||||||
STR_MAPGEN_TOWN_NAME_SWEDISH :瑞典
|
STR_MAPGEN_TOWN_NAME_SWEDISH :瑞典
|
||||||
STR_MAPGEN_TOWN_NAME_DUTCH :荷兰
|
STR_MAPGEN_TOWN_NAME_DUTCH :荷兰
|
||||||
@@ -3338,12 +3338,12 @@ STR_NEWGRF_SETTINGS_INFO_TITLE :{WHITE}NewGRF
|
|||||||
STR_NEWGRF_SETTINGS_ACTIVE_LIST :{WHITE}已激活 NewGRF
|
STR_NEWGRF_SETTINGS_ACTIVE_LIST :{WHITE}已激活 NewGRF
|
||||||
STR_NEWGRF_SETTINGS_INACTIVE_LIST :{WHITE}已停用 NewGRF
|
STR_NEWGRF_SETTINGS_INACTIVE_LIST :{WHITE}已停用 NewGRF
|
||||||
STR_NEWGRF_SETTINGS_SELECT_PRESET :{ORANGE}选择预设
|
STR_NEWGRF_SETTINGS_SELECT_PRESET :{ORANGE}选择预设
|
||||||
STR_NEWGRF_FILTER_TITLE :{ORANGE}关键字词搜索:
|
STR_NEWGRF_FILTER_TITLE :{ORANGE}搜索:
|
||||||
STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP :{BLACK}装载选定的预定义
|
STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP :{BLACK}载入选定的预设
|
||||||
STR_NEWGRF_SETTINGS_PRESET_SAVE :{BLACK}保存预定义
|
STR_NEWGRF_SETTINGS_PRESET_SAVE :{BLACK}保存预设
|
||||||
STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP :{BLACK}将当前组保存为预定义
|
STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP :{BLACK}将当前激活列表保存为预设
|
||||||
STR_NEWGRF_SETTINGS_PRESET_DELETE :{BLACK}删除预定义组
|
STR_NEWGRF_SETTINGS_PRESET_DELETE :{BLACK}删除预设
|
||||||
STR_NEWGRF_SETTINGS_PRESET_DELETE_TOOLTIP :{BLACK}删掉当前预定义组
|
STR_NEWGRF_SETTINGS_PRESET_DELETE_TOOLTIP :{BLACK}删除选定的预设
|
||||||
STR_NEWGRF_SETTINGS_ADD :{BLACK}增加
|
STR_NEWGRF_SETTINGS_ADD :{BLACK}增加
|
||||||
STR_NEWGRF_SETTINGS_ADD_FILE_TOOLTIP :{BLACK}将选定的 NewGRF 文件添加到你的配置中
|
STR_NEWGRF_SETTINGS_ADD_FILE_TOOLTIP :{BLACK}将选定的 NewGRF 文件添加到你的配置中
|
||||||
STR_NEWGRF_SETTINGS_RESCAN_FILES :{BLACK}重新检索文件
|
STR_NEWGRF_SETTINGS_RESCAN_FILES :{BLACK}重新检索文件
|
||||||
@@ -3393,7 +3393,7 @@ STR_SAVE_PRESET_EDITBOX_TOOLTIP :{BLACK}保存
|
|||||||
STR_SAVE_PRESET_CANCEL :{BLACK}取消
|
STR_SAVE_PRESET_CANCEL :{BLACK}取消
|
||||||
STR_SAVE_PRESET_CANCEL_TOOLTIP :{BLACK}不修改默认设置
|
STR_SAVE_PRESET_CANCEL_TOOLTIP :{BLACK}不修改默认设置
|
||||||
STR_SAVE_PRESET_SAVE :{BLACK}保存
|
STR_SAVE_PRESET_SAVE :{BLACK}保存
|
||||||
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}以当前选定的名称保存预设值
|
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}以当前选定的名称保存预设
|
||||||
|
|
||||||
# NewGRF parameters window
|
# NewGRF parameters window
|
||||||
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}改变基本图形组参数
|
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}改变基本图形组参数
|
||||||
@@ -3513,7 +3513,7 @@ STR_NEWGRF_INVALID_ENGINE :<invalid vehicl
|
|||||||
STR_NEWGRF_INVALID_INDUSTRYTYPE :<invalid industry>
|
STR_NEWGRF_INVALID_INDUSTRYTYPE :<invalid industry>
|
||||||
|
|
||||||
# Placeholders for other invalid stuff, e.g. vehicles that have gone (Game Script).
|
# Placeholders for other invalid stuff, e.g. vehicles that have gone (Game Script).
|
||||||
STR_INVALID_VEHICLE :<种类不明的运输工具>
|
STR_INVALID_VEHICLE :<不明载具>
|
||||||
|
|
||||||
# NewGRF scanning window
|
# NewGRF scanning window
|
||||||
STR_NEWGRF_SCAN_CAPTION :{WHITE}正在扫描 NewGRF
|
STR_NEWGRF_SCAN_CAPTION :{WHITE}正在扫描 NewGRF
|
||||||
@@ -3670,7 +3670,7 @@ STR_STATION_LIST_CAPTION :{WHITE}{COMPANY
|
|||||||
STR_STATION_LIST_STATION :{YELLOW}{STATION} {STATION_FEATURES}
|
STR_STATION_LIST_STATION :{YELLOW}{STATION} {STATION_FEATURES}
|
||||||
STR_STATION_LIST_WAYPOINT :{YELLOW}{WAYPOINT}
|
STR_STATION_LIST_WAYPOINT :{YELLOW}{WAYPOINT}
|
||||||
STR_STATION_LIST_NONE :{YELLOW}- 没有 -
|
STR_STATION_LIST_NONE :{YELLOW}- 没有 -
|
||||||
STR_STATION_LIST_SELECT_ALL_FACILITIES :{BLACK}选择全部运输工具种类
|
STR_STATION_LIST_SELECT_ALL_FACILITIES :{BLACK}选择所有设施
|
||||||
STR_STATION_LIST_SELECT_ALL_TYPES :{BLACK}选择所有货物类型{}(包括不在等待列表中的)
|
STR_STATION_LIST_SELECT_ALL_TYPES :{BLACK}选择所有货物类型{}(包括不在等待列表中的)
|
||||||
STR_STATION_LIST_NO_WAITING_CARGO :{BLACK}无任何货物等待运送
|
STR_STATION_LIST_NO_WAITING_CARGO :{BLACK}无任何货物等待运送
|
||||||
|
|
||||||
@@ -3758,7 +3758,7 @@ STR_FINANCES_CAPITAL_EXPENSES_TITLE :{WHITE}资本
|
|||||||
|
|
||||||
###length 13
|
###length 13
|
||||||
STR_FINANCES_SECTION_CONSTRUCTION :{GOLD}建设费用
|
STR_FINANCES_SECTION_CONSTRUCTION :{GOLD}建设费用
|
||||||
STR_FINANCES_SECTION_NEW_VEHICLES :{GOLD}购置新运输工具
|
STR_FINANCES_SECTION_NEW_VEHICLES :{GOLD}购置新载具
|
||||||
STR_FINANCES_SECTION_TRAIN_RUNNING_COSTS :{GOLD}列车
|
STR_FINANCES_SECTION_TRAIN_RUNNING_COSTS :{GOLD}列车
|
||||||
STR_FINANCES_SECTION_ROAD_VEHICLE_RUNNING_COSTS :{GOLD}公路车辆
|
STR_FINANCES_SECTION_ROAD_VEHICLE_RUNNING_COSTS :{GOLD}公路车辆
|
||||||
STR_FINANCES_SECTION_AIRCRAFT_RUNNING_COSTS :{GOLD}航空运行成本
|
STR_FINANCES_SECTION_AIRCRAFT_RUNNING_COSTS :{GOLD}航空运行成本
|
||||||
@@ -3906,7 +3906,7 @@ STR_VEHICLE_LIST_AVAILABLE_SHIPS :可用的船只
|
|||||||
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT :可用的飞机
|
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT :可用的飞机
|
||||||
|
|
||||||
STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}管理列表
|
STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}管理列表
|
||||||
STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP :{BLACK}向所有在此列表中的运输工具发出指令
|
STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP :{BLACK}向列表中所有载具发出指令
|
||||||
STR_VEHICLE_LIST_REPLACE_VEHICLES :替换车辆/飞机/船只
|
STR_VEHICLE_LIST_REPLACE_VEHICLES :替换车辆/飞机/船只
|
||||||
STR_VEHICLE_LIST_SEND_FOR_SERVICING :进行保养
|
STR_VEHICLE_LIST_SEND_FOR_SERVICING :进行保养
|
||||||
STR_VEHICLE_LIST_CREATE_GROUP :创建分组
|
STR_VEHICLE_LIST_CREATE_GROUP :创建分组
|
||||||
@@ -3921,7 +3921,7 @@ STR_VEHICLE_LIST_SEND_AIRCRAFT_TO_HANGAR :前往机库
|
|||||||
|
|
||||||
STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP :{BLACK}点击这里可以停止列表中的{}所有车辆/船只/飞机
|
STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP :{BLACK}点击这里可以停止列表中的{}所有车辆/船只/飞机
|
||||||
STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP :{BLACK}点击这里可以启动列表中的{}所有车辆/船只/飞机
|
STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP :{BLACK}点击这里可以启动列表中的{}所有车辆/船只/飞机
|
||||||
STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP :{BLACK}查看此运输工具类型的{}全部可选购列表
|
STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP :{BLACK}显示此载具类别所有可用的设计
|
||||||
|
|
||||||
STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION :{WHITE}与 {COMMA} 车辆/船只/飞机共享调度计划
|
STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION :{WHITE}与 {COMMA} 车辆/船只/飞机共享调度计划
|
||||||
|
|
||||||
@@ -4187,10 +4187,10 @@ STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_RUNCOST :{BLACK}售价
|
|||||||
# Autoreplace window
|
# Autoreplace window
|
||||||
STR_REPLACE_VEHICLES_WHITE :{WHITE}更新 {STRING} - {STRING}
|
STR_REPLACE_VEHICLES_WHITE :{WHITE}更新 {STRING} - {STRING}
|
||||||
|
|
||||||
STR_REPLACE_VEHICLE_VEHICLES_IN_USE :{YELLOW}正在使用的运输工具
|
STR_REPLACE_VEHICLE_VEHICLES_IN_USE :{YELLOW}使用中的载具
|
||||||
STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP :{BLACK}此行显示您拥有的运输工具
|
STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP :{BLACK}此行显示拥有的载具
|
||||||
STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES :{YELLOW}可用的运输工具
|
STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES :{YELLOW}可用的载具
|
||||||
STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP :{BLACK}此行显示可供替换的运输工具
|
STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP :{BLACK}此行显示可供替换的载具
|
||||||
|
|
||||||
###length VEHICLE_TYPES
|
###length VEHICLE_TYPES
|
||||||
STR_REPLACE_VEHICLE_TRAIN :火车
|
STR_REPLACE_VEHICLE_TRAIN :火车
|
||||||
@@ -4494,7 +4494,7 @@ STR_ORDERS_DELETE_BUTTON :{BLACK}删除
|
|||||||
STR_ORDERS_DELETE_TOOLTIP :{BLACK}删除高亮的调度命令
|
STR_ORDERS_DELETE_TOOLTIP :{BLACK}删除高亮的调度命令
|
||||||
STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}删除全部调度
|
STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}删除全部调度
|
||||||
STR_ORDERS_STOP_SHARING_BUTTON :{BLACK}退出共享调度计划
|
STR_ORDERS_STOP_SHARING_BUTTON :{BLACK}退出共享调度计划
|
||||||
STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}退出共享调度计划。 按住 Ctrl 键单击可以同时清除此运输工具的调度计划。
|
STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}退出共享调度计划。 按住 Ctrl 键单击可以同时清除此载具的调度计划。
|
||||||
|
|
||||||
STR_ORDERS_GO_TO_BUTTON :{BLACK}前往
|
STR_ORDERS_GO_TO_BUTTON :{BLACK}前往
|
||||||
STR_ORDER_GO_TO_NEAREST_DEPOT :前往最近的车库
|
STR_ORDER_GO_TO_NEAREST_DEPOT :前往最近的车库
|
||||||
@@ -4681,8 +4681,8 @@ STR_AI_CONFIG_HUMAN_PLAYER :玩家
|
|||||||
STR_AI_CONFIG_RANDOM_AI :随机 AI
|
STR_AI_CONFIG_RANDOM_AI :随机 AI
|
||||||
STR_AI_CONFIG_NONE :(无)
|
STR_AI_CONFIG_NONE :(无)
|
||||||
STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM}
|
STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM}
|
||||||
STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}最大竞争对手个数:{ORANGE}{COMMA}
|
STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}电脑玩家数量上限:{ORANGE}{COMMA}
|
||||||
STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}竞争对手公司建立间隔: {ORANGE}{COMMA} 分钟
|
STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}电脑公司建立间隔 {ORANGE}{COMMA} 分钟
|
||||||
|
|
||||||
STR_AI_CONFIG_MOVE_UP :{BLACK}上移
|
STR_AI_CONFIG_MOVE_UP :{BLACK}上移
|
||||||
STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}在列表中将选择的AI上移
|
STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}在列表中将选择的AI上移
|
||||||
@@ -5086,9 +5086,9 @@ STR_ERROR_GROUP_CAN_T_DELETE :{WHITE}无法
|
|||||||
STR_ERROR_GROUP_CAN_T_RENAME :{WHITE}无法重命名分组……
|
STR_ERROR_GROUP_CAN_T_RENAME :{WHITE}无法重命名分组……
|
||||||
STR_ERROR_GROUP_CAN_T_SET_PARENT :{WHITE}无法移动分组...
|
STR_ERROR_GROUP_CAN_T_SET_PARENT :{WHITE}无法移动分组...
|
||||||
STR_ERROR_GROUP_CAN_T_SET_PARENT_RECURSION :{WHITE}... 组从属关系不能出现自环
|
STR_ERROR_GROUP_CAN_T_SET_PARENT_RECURSION :{WHITE}... 组从属关系不能出现自环
|
||||||
STR_ERROR_GROUP_CAN_T_REMOVE_ALL_VEHICLES :{WHITE}无法从该组移除所有运输工具
|
STR_ERROR_GROUP_CAN_T_REMOVE_ALL_VEHICLES :{WHITE}无法从该组移除所有载具……
|
||||||
STR_ERROR_GROUP_CAN_T_ADD_VEHICLE :{WHITE}无法添加运输工具到该组……
|
STR_ERROR_GROUP_CAN_T_ADD_VEHICLE :{WHITE}无法添加载具到该组……
|
||||||
STR_ERROR_GROUP_CAN_T_ADD_SHARED_VEHICLE :{WHITE}无法添加共享指令的运输工具到该组……
|
STR_ERROR_GROUP_CAN_T_ADD_SHARED_VEHICLE :{WHITE}无法添加共享指令的载具到该组……
|
||||||
|
|
||||||
# Generic vehicle errors
|
# Generic vehicle errors
|
||||||
|
|
||||||
@@ -5153,10 +5153,10 @@ STR_ERROR_VEHICLE_IS_DESTROYED :{WHITE}... 运
|
|||||||
|
|
||||||
STR_ERROR_CAN_T_CLONE_VEHICLE_LIST :{WHITE}...并非所有车辆都相同
|
STR_ERROR_CAN_T_CLONE_VEHICLE_LIST :{WHITE}...并非所有车辆都相同
|
||||||
|
|
||||||
STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL :{WHITE}没有可用的运输工具
|
STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL :{WHITE}没有可用的载具
|
||||||
STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION :{WHITE}请改动您的 NewGRF 设置
|
STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION :{WHITE}请改动您的 NewGRF 设置
|
||||||
STR_ERROR_NO_VEHICLES_AVAILABLE_YET :{WHITE}暂时沒有可用的运输工具
|
STR_ERROR_NO_VEHICLES_AVAILABLE_YET :{WHITE}暂时沒有可用的载具
|
||||||
STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION :{WHITE}在{DATE_SHORT}后开始新游戏,或使用一款能提供早期运输工具的NewGRF
|
STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION :{WHITE}在{DATE_SHORT}后开始新游戏,或使用一款能提供早期载具的NewGRF
|
||||||
|
|
||||||
# Specific vehicle errors
|
# Specific vehicle errors
|
||||||
STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL :{WHITE}不能让列车冒险通过信号...
|
STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL :{WHITE}不能让列车冒险通过信号...
|
||||||
|
@@ -49,7 +49,7 @@ void AllocateMap(uint size_x, uint size_y);
|
|||||||
* @note try to avoid using this one
|
* @note try to avoid using this one
|
||||||
* @return 2^"return value" == MapSizeX()
|
* @return 2^"return value" == MapSizeX()
|
||||||
*/
|
*/
|
||||||
static inline uint MapLogX()
|
inline uint MapLogX()
|
||||||
{
|
{
|
||||||
extern uint _map_log_x;
|
extern uint _map_log_x;
|
||||||
return _map_log_x;
|
return _map_log_x;
|
||||||
@@ -60,7 +60,7 @@ static inline uint MapLogX()
|
|||||||
* @note try to avoid using this one
|
* @note try to avoid using this one
|
||||||
* @return 2^"return value" == MapSizeY()
|
* @return 2^"return value" == MapSizeY()
|
||||||
*/
|
*/
|
||||||
static inline uint MapLogY()
|
inline uint MapLogY()
|
||||||
{
|
{
|
||||||
extern uint _map_log_y;
|
extern uint _map_log_y;
|
||||||
return _map_log_y;
|
return _map_log_y;
|
||||||
@@ -70,7 +70,7 @@ static inline uint MapLogY()
|
|||||||
* Get the size of the map along the X
|
* Get the size of the map along the X
|
||||||
* @return the number of tiles along the X of the map
|
* @return the number of tiles along the X of the map
|
||||||
*/
|
*/
|
||||||
static inline uint MapSizeX()
|
inline uint MapSizeX()
|
||||||
{
|
{
|
||||||
extern uint _map_size_x;
|
extern uint _map_size_x;
|
||||||
return _map_size_x;
|
return _map_size_x;
|
||||||
@@ -80,7 +80,7 @@ static inline uint MapSizeX()
|
|||||||
* Get the size of the map along the Y
|
* Get the size of the map along the Y
|
||||||
* @return the number of tiles along the Y of the map
|
* @return the number of tiles along the Y of the map
|
||||||
*/
|
*/
|
||||||
static inline uint MapSizeY()
|
inline uint MapSizeY()
|
||||||
{
|
{
|
||||||
extern uint _map_size_y;
|
extern uint _map_size_y;
|
||||||
return _map_size_y;
|
return _map_size_y;
|
||||||
@@ -90,7 +90,7 @@ static inline uint MapSizeY()
|
|||||||
* Get the size of the map
|
* Get the size of the map
|
||||||
* @return the number of tiles of the map
|
* @return the number of tiles of the map
|
||||||
*/
|
*/
|
||||||
static inline uint MapSize()
|
inline uint MapSize()
|
||||||
{
|
{
|
||||||
extern uint _map_size;
|
extern uint _map_size;
|
||||||
return _map_size;
|
return _map_size;
|
||||||
@@ -100,7 +100,7 @@ static inline uint MapSize()
|
|||||||
* Gets the maximum X coordinate within the map, including MP_VOID
|
* Gets the maximum X coordinate within the map, including MP_VOID
|
||||||
* @return the maximum X coordinate
|
* @return the maximum X coordinate
|
||||||
*/
|
*/
|
||||||
static inline uint MapMaxX()
|
inline uint MapMaxX()
|
||||||
{
|
{
|
||||||
return MapSizeX() - 1;
|
return MapSizeX() - 1;
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ static inline uint MapMaxX()
|
|||||||
* Gets the maximum Y coordinate within the map, including MP_VOID
|
* Gets the maximum Y coordinate within the map, including MP_VOID
|
||||||
* @return the maximum Y coordinate
|
* @return the maximum Y coordinate
|
||||||
*/
|
*/
|
||||||
static inline uint MapMaxY()
|
inline uint MapMaxY()
|
||||||
{
|
{
|
||||||
return MapSizeY() - 1;
|
return MapSizeY() - 1;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ static inline uint MapMaxY()
|
|||||||
* @param n the value to scale
|
* @param n the value to scale
|
||||||
* @return the scaled size
|
* @return the scaled size
|
||||||
*/
|
*/
|
||||||
static inline uint ScaleByMapSize(uint n)
|
inline uint ScaleByMapSize(uint n)
|
||||||
{
|
{
|
||||||
/* Subtract 12 from shift in order to prevent integer overflow
|
/* Subtract 12 from shift in order to prevent integer overflow
|
||||||
* for large values of n. It's safe since the min mapsize is 64x64. */
|
* for large values of n. It's safe since the min mapsize is 64x64. */
|
||||||
@@ -134,7 +134,7 @@ static inline uint ScaleByMapSize(uint n)
|
|||||||
* @param n the value to scale
|
* @param n the value to scale
|
||||||
* @return the scaled size
|
* @return the scaled size
|
||||||
*/
|
*/
|
||||||
static inline uint ScaleByMapSize1D(uint n)
|
inline uint ScaleByMapSize1D(uint n)
|
||||||
{
|
{
|
||||||
/* Normal circumference for the X+Y is 256+256 = 1<<9
|
/* Normal circumference for the X+Y is 256+256 = 1<<9
|
||||||
* Note, not actually taking the full circumference into account,
|
* Note, not actually taking the full circumference into account,
|
||||||
@@ -177,7 +177,7 @@ debug_inline static TileIndex TileXY(uint x, uint y)
|
|||||||
* @return The resulting offset value of the given coordinate
|
* @return The resulting offset value of the given coordinate
|
||||||
* @see ToTileIndexDiff(TileIndexDiffC)
|
* @see ToTileIndexDiff(TileIndexDiffC)
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiff TileDiffXY(int x, int y)
|
inline TileIndexDiff TileDiffXY(int x, int y)
|
||||||
{
|
{
|
||||||
/* Multiplication gives much better optimization on MSVC than shifting.
|
/* Multiplication gives much better optimization on MSVC than shifting.
|
||||||
* 0 << shift isn't optimized to 0 properly.
|
* 0 << shift isn't optimized to 0 properly.
|
||||||
@@ -204,7 +204,7 @@ debug_inline static TileIndex TileVirtXY(uint x, uint y)
|
|||||||
* @param y The virtual y coordinate of the tile.
|
* @param y The virtual y coordinate of the tile.
|
||||||
* @return The TileIndex calculated by the coordinate.
|
* @return The TileIndex calculated by the coordinate.
|
||||||
*/
|
*/
|
||||||
static inline TileIndex TileVirtXYClampedToMap(int x, int y)
|
inline TileIndex TileVirtXYClampedToMap(int x, int y)
|
||||||
{
|
{
|
||||||
int safe_x = Clamp<int>(x, 0, MapMaxX() * TILE_SIZE);
|
int safe_x = Clamp<int>(x, 0, MapMaxX() * TILE_SIZE);
|
||||||
int safe_y = Clamp<int>(y, 0, MapMaxY() * TILE_SIZE);
|
int safe_y = Clamp<int>(y, 0, MapMaxY() * TILE_SIZE);
|
||||||
@@ -241,7 +241,7 @@ debug_inline static uint TileY(TileIndex tile)
|
|||||||
* @return The difference between two tiles.
|
* @return The difference between two tiles.
|
||||||
* @see TileDiffXY(int, int)
|
* @see TileDiffXY(int, int)
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
|
inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
|
||||||
{
|
{
|
||||||
return (((uint) tidc.y) << MapLogX()) + tidc.x;
|
return (((uint) tidc.y) << MapLogX()) + tidc.x;
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ TileIndex TileAddSaturating(TileIndex tile, int addx, int addy);
|
|||||||
* @param dir The given direction
|
* @param dir The given direction
|
||||||
* @return The offset as TileIndexDiffC value
|
* @return The offset as TileIndexDiffC value
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir)
|
inline TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir)
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END];
|
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END];
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ static inline TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir)
|
|||||||
* @param dir The given direction
|
* @param dir The given direction
|
||||||
* @return The offset as TileIndexDiffC value
|
* @return The offset as TileIndexDiffC value
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiffC TileIndexDiffCByDir(Direction dir)
|
inline TileIndexDiffC TileIndexDiffCByDir(Direction dir)
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END];
|
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END];
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ static inline TileIndexDiffC TileIndexDiffCByDir(Direction dir)
|
|||||||
* @param diff The offset to add on the tile
|
* @param diff The offset to add on the tile
|
||||||
* @return The resulting TileIndex
|
* @return The resulting TileIndex
|
||||||
*/
|
*/
|
||||||
static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC diff)
|
inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC diff)
|
||||||
{
|
{
|
||||||
int x = TileX(tile) + diff.x;
|
int x = TileX(tile) + diff.x;
|
||||||
int y = TileY(tile) + diff.y;
|
int y = TileY(tile) + diff.y;
|
||||||
@@ -328,7 +328,7 @@ static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC dif
|
|||||||
* @param tile_b to tile
|
* @param tile_b to tile
|
||||||
* @return the difference between tila_a and tile_b
|
* @return the difference between tila_a and tile_b
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
|
inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
|
||||||
{
|
{
|
||||||
TileIndexDiffC difference;
|
TileIndexDiffC difference;
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ uint DistanceFromEdgeDir(TileIndex, DiagDirection); ///< distance from the map e
|
|||||||
* @return The resulting TileIndexDiff
|
* @return The resulting TileIndexDiff
|
||||||
* @see TileIndexDiffCByDiagDir
|
* @see TileIndexDiffCByDiagDir
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
|
inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END];
|
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END];
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
|
|||||||
* @param dir The direction to convert from
|
* @param dir The direction to convert from
|
||||||
* @return The resulting TileIndexDiff
|
* @return The resulting TileIndexDiff
|
||||||
*/
|
*/
|
||||||
static inline TileIndexDiff TileOffsByDir(Direction dir)
|
inline TileIndexDiff TileOffsByDir(Direction dir)
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END];
|
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END];
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ static inline TileIndexDiff TileOffsByDir(Direction dir)
|
|||||||
* @param dir The direction in which we want to step
|
* @param dir The direction in which we want to step
|
||||||
* @return the moved tile
|
* @return the moved tile
|
||||||
*/
|
*/
|
||||||
static inline TileIndex TileAddByDir(TileIndex tile, Direction dir)
|
inline TileIndex TileAddByDir(TileIndex tile, Direction dir)
|
||||||
{
|
{
|
||||||
return TILE_ADD(tile, TileOffsByDir(dir));
|
return TILE_ADD(tile, TileOffsByDir(dir));
|
||||||
}
|
}
|
||||||
@@ -394,13 +394,13 @@ static inline TileIndex TileAddByDir(TileIndex tile, Direction dir)
|
|||||||
* @param dir The direction in which we want to step
|
* @param dir The direction in which we want to step
|
||||||
* @return the moved tile
|
* @return the moved tile
|
||||||
*/
|
*/
|
||||||
static inline TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
|
inline TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
|
||||||
{
|
{
|
||||||
return TILE_ADD(tile, TileOffsByDiagDir(dir));
|
return TILE_ADD(tile, TileOffsByDiagDir(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks if two tiles are adjacent */
|
/** Checks if two tiles are adjacent */
|
||||||
static inline bool AreTilesAdjacent(TileIndex a, TileIndex b)
|
inline bool AreTilesAdjacent(TileIndex a, TileIndex b)
|
||||||
{
|
{
|
||||||
return (std::abs((int)TileX(a) - (int)TileX(b)) <= 1) &&
|
return (std::abs((int)TileX(a) - (int)TileX(b)) <= 1) &&
|
||||||
(std::abs((int)TileY(a) - (int)TileY(b)) <= 1);
|
(std::abs((int)TileY(a) - (int)TileY(b)) <= 1);
|
||||||
@@ -413,7 +413,7 @@ static inline bool AreTilesAdjacent(TileIndex a, TileIndex b)
|
|||||||
* @param tile_to Destination tile
|
* @param tile_to Destination tile
|
||||||
* @return DiagDirection from tile_from towards tile_to, or INVALID_DIAGDIR if the tiles are not on an axis
|
* @return DiagDirection from tile_from towards tile_to, or INVALID_DIAGDIR if the tiles are not on an axis
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection DiagdirBetweenTiles(TileIndex tile_from, TileIndex tile_to)
|
inline DiagDirection DiagdirBetweenTiles(TileIndex tile_from, TileIndex tile_to)
|
||||||
{
|
{
|
||||||
int dx = (int)TileX(tile_to) - (int)TileX(tile_from);
|
int dx = (int)TileX(tile_to) - (int)TileX(tile_from);
|
||||||
int dy = (int)TileY(tile_to) - (int)TileY(tile_from);
|
int dy = (int)TileY(tile_to) - (int)TileY(tile_from);
|
||||||
@@ -445,7 +445,7 @@ bool EnoughContiguousTilesMatchingCondition(TileIndex tile, uint threshold, Test
|
|||||||
* @param r the random 'seed'
|
* @param r the random 'seed'
|
||||||
* @return a valid tile
|
* @return a valid tile
|
||||||
*/
|
*/
|
||||||
static inline TileIndex RandomTileSeed(uint32 r)
|
inline TileIndex RandomTileSeed(uint32_t r)
|
||||||
{
|
{
|
||||||
return TILE_MASK(r);
|
return TILE_MASK(r);
|
||||||
}
|
}
|
||||||
|
@@ -137,7 +137,7 @@ typedef unsigned long in_addr_t;
|
|||||||
* @param address The address returned by those four functions.
|
* @param address The address returned by those four functions.
|
||||||
* @return The correct value for addrlen.
|
* @return The correct value for addrlen.
|
||||||
*/
|
*/
|
||||||
static inline socklen_t FixAddrLenForEmscripten(struct sockaddr_storage &address)
|
inline socklen_t FixAddrLenForEmscripten(struct sockaddr_storage &address)
|
||||||
{
|
{
|
||||||
switch (address.ss_family) {
|
switch (address.ss_family) {
|
||||||
case AF_INET6: return sizeof(struct sockaddr_in6);
|
case AF_INET6: return sizeof(struct sockaddr_in6);
|
||||||
|
@@ -432,7 +432,7 @@ struct GRFLoadedFeatures {
|
|||||||
* @param bit The bit to check.
|
* @param bit The bit to check.
|
||||||
* @return Whether the bit is set.
|
* @return Whether the bit is set.
|
||||||
*/
|
*/
|
||||||
static inline bool HasGrfMiscBit(GrfMiscBit bit)
|
inline bool HasGrfMiscBit(GrfMiscBit bit)
|
||||||
{
|
{
|
||||||
extern byte _misc_grf_features;
|
extern byte _misc_grf_features;
|
||||||
return HasBit(_misc_grf_features, bit);
|
return HasBit(_misc_grf_features, bit);
|
||||||
|
@@ -72,7 +72,7 @@ DECLARE_ENUM_AS_BIT_SET(TileLayoutFlags)
|
|||||||
* @param num_sprites Number of available sprites to select stage from.
|
* @param num_sprites Number of available sprites to select stage from.
|
||||||
* @return Sprite to use
|
* @return Sprite to use
|
||||||
*/
|
*/
|
||||||
static inline uint GetConstructionStageOffset(uint construction_stage, uint num_sprites)
|
inline uint GetConstructionStageOffset(uint construction_stage, uint num_sprites)
|
||||||
{
|
{
|
||||||
assert(num_sprites > 0);
|
assert(num_sprites > 0);
|
||||||
if (num_sprites > 4) num_sprites = 4;
|
if (num_sprites > 4) num_sprites = 4;
|
||||||
|
@@ -52,7 +52,7 @@ void AmbientSoundEffectCallback(TileIndex tile);
|
|||||||
uint16 GetTownZonesCallback(Town *t);
|
uint16 GetTownZonesCallback(Town *t);
|
||||||
|
|
||||||
/** Play an ambient sound effect for an empty tile. */
|
/** Play an ambient sound effect for an empty tile. */
|
||||||
static inline void AmbientSoundEffect(TileIndex tile)
|
inline void AmbientSoundEffect(TileIndex tile)
|
||||||
{
|
{
|
||||||
/* Only run callback if enabled. */
|
/* Only run callback if enabled. */
|
||||||
if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
|
if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
* @pre i < 0x110
|
* @pre i < 0x110
|
||||||
* @return the value of the register
|
* @return the value of the register
|
||||||
*/
|
*/
|
||||||
static inline uint32 GetRegister(uint i)
|
inline uint32_t GetRegister(uint i)
|
||||||
{
|
{
|
||||||
extern TemporaryStorageArray<int32, 0x110> _temp_store;
|
extern TemporaryStorageArray<int32, 0x110> _temp_store;
|
||||||
return _temp_store.GetValue(i);
|
return _temp_store.GetValue(i);
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, const NewsAllocatedData *data = nullptr);
|
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, const NewsAllocatedData *data = nullptr);
|
||||||
|
|
||||||
static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *cni)
|
inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *cni)
|
||||||
{
|
{
|
||||||
AddNewsItem(string, NT_COMPANY_INFO, NF_COMPANY, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
|
AddNewsItem(string, NT_COMPANY_INFO, NF_COMPANY, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *c
|
|||||||
*
|
*
|
||||||
* @warning The DParams may not reference the vehicle due to autoreplace stuff. See AddVehicleAdviceNewsItem for how that can be done.
|
* @warning The DParams may not reference the vehicle due to autoreplace stuff. See AddVehicleAdviceNewsItem for how that can be done.
|
||||||
*/
|
*/
|
||||||
static inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION)
|
inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID vehicle, StationID station = INVALID_STATION)
|
||||||
{
|
{
|
||||||
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
|
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);
|
||||||
}
|
}
|
||||||
@@ -37,17 +37,17 @@ static inline void AddVehicleNewsItem(StringID string, NewsType type, VehicleID
|
|||||||
*
|
*
|
||||||
* @warning DParam 0 must reference the vehicle!
|
* @warning DParam 0 must reference the vehicle!
|
||||||
*/
|
*/
|
||||||
static inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle)
|
inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle)
|
||||||
{
|
{
|
||||||
AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle);
|
AddNewsItem(string, NT_ADVICE, NF_INCOLOUR | NF_SMALL | NF_VEHICLE_PARAM0, NR_VEHICLE, vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, const NewsAllocatedData *data = nullptr, StationID station = INVALID_STATION)
|
inline void AddTileNewsItem(StringID string, NewsType type, TileIndex tile, const NewsAllocatedData *data = nullptr, StationID station = INVALID_STATION)
|
||||||
{
|
{
|
||||||
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_TILE, tile, station == INVALID_STATION ? NR_NONE : NR_STATION, station, data);
|
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_TILE, tile, station == INVALID_STATION ? NR_NONE : NR_STATION, station, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry, const NewsAllocatedData *data = nullptr)
|
inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry, const NewsAllocatedData *data = nullptr)
|
||||||
{
|
{
|
||||||
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry, NR_NONE, UINT32_MAX, data);
|
AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry, NR_NONE, UINT32_MAX, data);
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ ObjectType GetObjectType(TileIndex t);
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return True if type matches.
|
* @return True if type matches.
|
||||||
*/
|
*/
|
||||||
static inline bool IsObjectType(TileIndex t, ObjectType type)
|
inline bool IsObjectType(TileIndex t, ObjectType type)
|
||||||
{
|
{
|
||||||
return GetObjectType(t) == type;
|
return GetObjectType(t) == type;
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ static inline bool IsObjectType(TileIndex t, ObjectType type)
|
|||||||
* @param type Type to test.
|
* @param type Type to test.
|
||||||
* @return True if type matches.
|
* @return True if type matches.
|
||||||
*/
|
*/
|
||||||
static inline bool IsObjectTypeTile(TileIndex t, ObjectType type)
|
inline bool IsObjectTypeTile(TileIndex t, ObjectType type)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_OBJECT) && GetObjectType(t) == type;
|
return IsTileType(t, MP_OBJECT) && GetObjectType(t) == type;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ static inline bool IsObjectTypeTile(TileIndex t, ObjectType type)
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return The ObjectID of the object.
|
* @return The ObjectID of the object.
|
||||||
*/
|
*/
|
||||||
static inline ObjectID GetObjectIndex(TileIndex t)
|
inline ObjectID GetObjectIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return _m[t].m2 | _m[t].m5 << 16;
|
return _m[t].m2 | _m[t].m5 << 16;
|
||||||
@@ -62,7 +62,7 @@ static inline ObjectID GetObjectIndex(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return The random bits.
|
* @return The random bits.
|
||||||
*/
|
*/
|
||||||
static inline byte GetObjectRandomBits(TileIndex t)
|
inline byte GetObjectRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return _m[t].m3;
|
return _m[t].m3;
|
||||||
@@ -74,7 +74,7 @@ static inline byte GetObjectRandomBits(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return The ground type.
|
* @return The ground type.
|
||||||
*/
|
*/
|
||||||
static inline ObjectGround GetObjectGroundType(TileIndex t)
|
inline ObjectGround GetObjectGroundType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return (ObjectGround)GB(_m[t].m4, 2, 2);
|
return (ObjectGround)GB(_m[t].m4, 2, 2);
|
||||||
@@ -87,7 +87,7 @@ static inline ObjectGround GetObjectGroundType(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return the density
|
* @return the density
|
||||||
*/
|
*/
|
||||||
static inline uint GetObjectGroundDensity(TileIndex t)
|
inline uint GetObjectGroundDensity(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return GB(_m[t].m4, 0, 2);
|
return GB(_m[t].m4, 0, 2);
|
||||||
@@ -100,7 +100,7 @@ static inline uint GetObjectGroundDensity(TileIndex t)
|
|||||||
* @param d the new density
|
* @param d the new density
|
||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
*/
|
*/
|
||||||
static inline void SetObjectGroundDensity(TileIndex t, uint d)
|
inline void SetObjectGroundDensity(TileIndex t, uint d)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
SB(_m[t].m4, 0, 2, d);
|
SB(_m[t].m4, 0, 2, d);
|
||||||
@@ -112,7 +112,7 @@ static inline void SetObjectGroundDensity(TileIndex t, uint d)
|
|||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
* @return The value of the counter
|
* @return The value of the counter
|
||||||
*/
|
*/
|
||||||
static inline uint GetObjectGroundCounter(TileIndex t)
|
inline uint GetObjectGroundCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return GB(_m[t].m4, 5, 3);
|
return GB(_m[t].m4, 5, 3);
|
||||||
@@ -124,7 +124,7 @@ static inline uint GetObjectGroundCounter(TileIndex t)
|
|||||||
* @param c the amount to increment the counter with
|
* @param c the amount to increment the counter with
|
||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
*/
|
*/
|
||||||
static inline void AddObjectGroundCounter(TileIndex t, int c)
|
inline void AddObjectGroundCounter(TileIndex t, int c)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
_m[t].m4 += c << 5;
|
_m[t].m4 += c << 5;
|
||||||
@@ -136,7 +136,7 @@ static inline void AddObjectGroundCounter(TileIndex t, int c)
|
|||||||
* @param c The amount to set the counter to.
|
* @param c The amount to set the counter to.
|
||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
*/
|
*/
|
||||||
static inline void SetObjectGroundCounter(TileIndex t, uint c)
|
inline void SetObjectGroundCounter(TileIndex t, uint c)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
SB(_m[t].m4, 5, 3, c);
|
SB(_m[t].m4, 5, 3, c);
|
||||||
@@ -150,31 +150,31 @@ static inline void SetObjectGroundCounter(TileIndex t, uint c)
|
|||||||
* @param density the density of the ground tile
|
* @param density the density of the ground tile
|
||||||
* @pre IsTileType(t, MP_OBJECT)
|
* @pre IsTileType(t, MP_OBJECT)
|
||||||
*/
|
*/
|
||||||
static inline void SetObjectGroundTypeDensity(TileIndex t, ObjectGround type, uint density)
|
inline void SetObjectGroundTypeDensity(TileIndex t, ObjectGround type, uint density)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
_m[t].m4 = 0 << 5 | type << 2 | density;
|
_m[t].m4 = 0 << 5 | type << 2 | density;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ObjectEffectiveFoundationType GetObjectEffectiveFoundationType(TileIndex t)
|
inline ObjectEffectiveFoundationType GetObjectEffectiveFoundationType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return (ObjectEffectiveFoundationType)GB(_me[t].m6, 0, 2);
|
return (ObjectEffectiveFoundationType)GB(_me[t].m6, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetObjectEffectiveFoundationType(TileIndex t, ObjectEffectiveFoundationType foundation_type)
|
inline void SetObjectEffectiveFoundationType(TileIndex t, ObjectEffectiveFoundationType foundation_type)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
SB(_me[t].m6, 0, 2, foundation_type);
|
SB(_me[t].m6, 0, 2, foundation_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool GetObjectHasViewportMapViewOverride(TileIndex t)
|
inline bool GetObjectHasViewportMapViewOverride(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return HasBit(_m[t].m4, 4);
|
return HasBit(_m[t].m4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetObjectHasViewportMapViewOverride(TileIndex t, bool map_view_override)
|
inline void SetObjectHasViewportMapViewOverride(TileIndex t, bool map_view_override)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
dbg_assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
SB(_m[t].m4, 4, 1, map_view_override ? 1 : 0);
|
SB(_m[t].m4, 4, 1, map_view_override ? 1 : 0);
|
||||||
@@ -188,7 +188,7 @@ static inline void SetObjectHasViewportMapViewOverride(TileIndex t, bool map_vie
|
|||||||
* @param wc Water class for this object.
|
* @param wc Water class for this object.
|
||||||
* @param random Random data to store on the tile
|
* @param random Random data to store on the tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass wc, byte random)
|
inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass wc, byte random)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_OBJECT);
|
SetTileType(t, MP_OBJECT);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
|
@@ -22,7 +22,7 @@ void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix);
|
|||||||
* @param bugfix bugfix version of the os. This would be 11 in the case of 10.4.11.
|
* @param bugfix bugfix version of the os. This would be 11 in the case of 10.4.11.
|
||||||
* @return true if the running os is at least what we asked, false otherwise.
|
* @return true if the running os is at least what we asked, false otherwise.
|
||||||
*/
|
*/
|
||||||
static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
|
inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
|
||||||
{
|
{
|
||||||
int version_major, version_minor, version_bugfix;
|
int version_major, version_minor, version_bugfix;
|
||||||
GetMacOSVersion(&version_major, &version_minor, &version_bugfix);
|
GetMacOSVersion(&version_major, &version_minor, &version_bugfix);
|
||||||
|
@@ -18,7 +18,7 @@ void GfxInitPalettes();
|
|||||||
|
|
||||||
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b);
|
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
|
||||||
static inline uint8_t GetNearestColourIndex(const Colour colour)
|
inline uint8_t GetNearestColourIndex(const Colour colour)
|
||||||
{
|
{
|
||||||
return GetNearestColourIndex(colour.r, colour.g, colour.b);
|
return GetNearestColourIndex(colour.r, colour.g, colour.b);
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ static inline uint8_t GetNearestColourIndex(const Colour colour)
|
|||||||
* @param colours The value to check
|
* @param colours The value to check
|
||||||
* @return true if the given value is a valid Colours.
|
* @return true if the given value is a valid Colours.
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidColours(Colours colours)
|
inline bool IsValidColours(Colours colours)
|
||||||
{
|
{
|
||||||
return colours < COLOUR_END;
|
return colours < COLOUR_END;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
* @param station_type the station type to get the closest tile of
|
* @param station_type the station type to get the closest tile of
|
||||||
* @return The closest station tile to the given tile.
|
* @return The closest station tile to the given tile.
|
||||||
*/
|
*/
|
||||||
static inline TileIndex CalcClosestStationTile(StationID station, TileIndex tile, StationType station_type)
|
inline TileIndex CalcClosestStationTile(StationID station, TileIndex tile, StationType station_type)
|
||||||
{
|
{
|
||||||
const BaseStation *st = BaseStation::Get(station);
|
const BaseStation *st = BaseStation::Get(station);
|
||||||
TileArea ta;
|
TileArea ta;
|
||||||
@@ -57,7 +57,7 @@ static inline TileIndex CalcClosestStationTile(StationID station, TileIndex tile
|
|||||||
* the pathfinders cannot exit on the wrong side and allows reversing on such
|
* the pathfinders cannot exit on the wrong side and allows reversing on such
|
||||||
* tiles.
|
* tiles.
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits GetTrackdirBitsForRoad(TileIndex tile, RoadTramType rtt)
|
inline TrackdirBits GetTrackdirBitsForRoad(TileIndex tile, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
TrackdirBits bits = GetTileTrackdirBits(tile, TRANSPORT_ROAD, rtt);
|
TrackdirBits bits = GetTileTrackdirBits(tile, TRANSPORT_ROAD, rtt);
|
||||||
|
|
||||||
|
@@ -193,7 +193,7 @@ CommandCost CheckTrainInTunnelBridgePreventsTrackModification(TileIndex start, T
|
|||||||
* @param tracks the tracks to test
|
* @param tracks the tracks to test
|
||||||
* @return true if at least on of tracks is reserved
|
* @return true if at least on of tracks is reserved
|
||||||
*/
|
*/
|
||||||
static inline bool HasReservedTracks(TileIndex tile, TrackBits tracks)
|
inline bool HasReservedTracks(TileIndex tile, TrackBits tracks)
|
||||||
{
|
{
|
||||||
return (GetReservedTrackbits(tile) & tracks) != TRACK_BIT_NONE;
|
return (GetReservedTrackbits(tile) & tracks) != TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
|
@@ -413,7 +413,7 @@ typedef std::map<SignalReference, SignalProgram*> ProgramList;
|
|||||||
extern ProgramList _signal_programs;
|
extern ProgramList _signal_programs;
|
||||||
|
|
||||||
/// Verifies that a SignalReference refers to a signal which has a program.
|
/// Verifies that a SignalReference refers to a signal which has a program.
|
||||||
static inline bool HasProgrammableSignals(SignalReference ref)
|
inline bool HasProgrammableSignals(SignalReference ref)
|
||||||
{
|
{
|
||||||
return IsTileType(ref.tile, MP_RAILWAY) && GetRailTileType(ref.tile) == RAIL_TILE_SIGNALS
|
return IsTileType(ref.tile, MP_RAILWAY) && GetRailTileType(ref.tile) == RAIL_TILE_SIGNALS
|
||||||
&& IsPresignalProgrammable(ref.tile, ref.track);
|
&& IsPresignalProgrammable(ref.tile, ref.track);
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
* Check if we are currently in a modal progress state.
|
* Check if we are currently in a modal progress state.
|
||||||
* @return Are we in the modal state?
|
* @return Are we in the modal state?
|
||||||
*/
|
*/
|
||||||
static inline bool HasModalProgress()
|
inline bool HasModalProgress()
|
||||||
{
|
{
|
||||||
extern bool _in_modal_progress;
|
extern bool _in_modal_progress;
|
||||||
return _in_modal_progress;
|
return _in_modal_progress;
|
||||||
|
26
src/rail.h
26
src/rail.h
@@ -325,7 +325,7 @@ public:
|
|||||||
* @param railtype the rail type which the information is requested for
|
* @param railtype the rail type which the information is requested for
|
||||||
* @return The pointer to the RailTypeInfo
|
* @return The pointer to the RailTypeInfo
|
||||||
*/
|
*/
|
||||||
static inline const RailTypeInfo *GetRailTypeInfo(RailType railtype)
|
inline const RailTypeInfo *GetRailTypeInfo(RailType railtype)
|
||||||
{
|
{
|
||||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||||
dbg_assert_msg(railtype < RAILTYPE_END, "%u", railtype);
|
dbg_assert_msg(railtype < RAILTYPE_END, "%u", railtype);
|
||||||
@@ -340,7 +340,7 @@ static inline const RailTypeInfo *GetRailTypeInfo(RailType railtype)
|
|||||||
* @param enginetype The RailType of the engine we are considering.
|
* @param enginetype The RailType of the engine we are considering.
|
||||||
* @param tiletype The RailType of the tile we are considering.
|
* @param tiletype The RailType of the tile we are considering.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
|
inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
|
||||||
{
|
{
|
||||||
return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype);
|
return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype);
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
|
|||||||
* @param enginetype The RailType of the engine we are considering.
|
* @param enginetype The RailType of the engine we are considering.
|
||||||
* @param tiletype The RailType of the tile we are considering.
|
* @param tiletype The RailType of the tile we are considering.
|
||||||
*/
|
*/
|
||||||
static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
|
inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
|
||||||
{
|
{
|
||||||
return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype);
|
return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype);
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
|
|||||||
* @param rt The RailType to check.
|
* @param rt The RailType to check.
|
||||||
* @return Whether level crossings are not allowed.
|
* @return Whether level crossings are not allowed.
|
||||||
*/
|
*/
|
||||||
static inline bool RailNoLevelCrossings(RailType rt)
|
inline bool RailNoLevelCrossings(RailType rt)
|
||||||
{
|
{
|
||||||
return HasBit(GetRailTypeInfo(rt)->flags, RTF_NO_LEVEL_CROSSING);
|
return HasBit(GetRailTypeInfo(rt)->flags, RTF_NO_LEVEL_CROSSING);
|
||||||
}
|
}
|
||||||
@@ -375,7 +375,7 @@ static inline bool RailNoLevelCrossings(RailType rt)
|
|||||||
* @param def Default value to use if the rail type doesn't specify anything.
|
* @param def Default value to use if the rail type doesn't specify anything.
|
||||||
* @return True if 90 degree turns are disallowed between the two rail types.
|
* @return True if 90 degree turns are disallowed between the two rail types.
|
||||||
*/
|
*/
|
||||||
static inline bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def = _settings_game.pf.forbid_90_deg)
|
inline bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def = _settings_game.pf.forbid_90_deg)
|
||||||
{
|
{
|
||||||
if (rt1 == INVALID_RAILTYPE || rt2 == INVALID_RAILTYPE) return def;
|
if (rt1 == INVALID_RAILTYPE || rt2 == INVALID_RAILTYPE) return def;
|
||||||
|
|
||||||
@@ -388,17 +388,17 @@ static inline bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def
|
|||||||
return rt1_90deg || rt2_90deg;
|
return rt1_90deg || rt2_90deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool Rail90DegTurnDisallowedTilesFromDiagDir(TileIndex t1, TileIndex t2, DiagDirection t1_towards_t2, bool def = _settings_game.pf.forbid_90_deg)
|
inline bool Rail90DegTurnDisallowedTilesFromDiagDir(TileIndex t1, TileIndex t2, DiagDirection t1_towards_t2, bool def = _settings_game.pf.forbid_90_deg)
|
||||||
{
|
{
|
||||||
return Rail90DegTurnDisallowed(GetTileRailTypeByEntryDir(t1, ReverseDiagDir(t1_towards_t2)), GetTileRailTypeByEntryDir(t2, t1_towards_t2), def);
|
return Rail90DegTurnDisallowed(GetTileRailTypeByEntryDir(t1, ReverseDiagDir(t1_towards_t2)), GetTileRailTypeByEntryDir(t2, t1_towards_t2), def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool Rail90DegTurnDisallowedAdjacentTiles(TileIndex t1, TileIndex t2, bool def = _settings_game.pf.forbid_90_deg)
|
inline bool Rail90DegTurnDisallowedAdjacentTiles(TileIndex t1, TileIndex t2, bool def = _settings_game.pf.forbid_90_deg)
|
||||||
{
|
{
|
||||||
return Rail90DegTurnDisallowedTilesFromDiagDir(t1, t2, DiagdirBetweenTiles(t1, t2));
|
return Rail90DegTurnDisallowedTilesFromDiagDir(t1, t2, DiagdirBetweenTiles(t1, t2));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool Rail90DegTurnDisallowedTilesFromTrackdir(TileIndex t1, TileIndex t2, Trackdir t1_td, bool def = _settings_game.pf.forbid_90_deg)
|
inline bool Rail90DegTurnDisallowedTilesFromTrackdir(TileIndex t1, TileIndex t2, Trackdir t1_td, bool def = _settings_game.pf.forbid_90_deg)
|
||||||
{
|
{
|
||||||
return Rail90DegTurnDisallowedTilesFromDiagDir(t1, t2, TrackdirToExitdir(t1_td));
|
return Rail90DegTurnDisallowedTilesFromDiagDir(t1, t2, TrackdirToExitdir(t1_td));
|
||||||
}
|
}
|
||||||
@@ -408,7 +408,7 @@ static inline bool Rail90DegTurnDisallowedTilesFromTrackdir(TileIndex t1, TileIn
|
|||||||
* @param railtype The railtype being built.
|
* @param railtype The railtype being built.
|
||||||
* @return The cost multiplier.
|
* @return The cost multiplier.
|
||||||
*/
|
*/
|
||||||
static inline Money RailBuildCost(RailType railtype)
|
inline Money RailBuildCost(RailType railtype)
|
||||||
{
|
{
|
||||||
dbg_assert(railtype < RAILTYPE_END);
|
dbg_assert(railtype < RAILTYPE_END);
|
||||||
return (_price[PR_BUILD_RAIL] * GetRailTypeInfo(railtype)->cost_multiplier) >> 3;
|
return (_price[PR_BUILD_RAIL] * GetRailTypeInfo(railtype)->cost_multiplier) >> 3;
|
||||||
@@ -419,7 +419,7 @@ static inline Money RailBuildCost(RailType railtype)
|
|||||||
* @param railtype The railtype being removed.
|
* @param railtype The railtype being removed.
|
||||||
* @return The cost.
|
* @return The cost.
|
||||||
*/
|
*/
|
||||||
static inline Money RailClearCost(RailType railtype)
|
inline Money RailClearCost(RailType railtype)
|
||||||
{
|
{
|
||||||
/* Clearing rail in fact earns money, but if the build cost is set
|
/* Clearing rail in fact earns money, but if the build cost is set
|
||||||
* very low then a loophole exists where money can be made.
|
* very low then a loophole exists where money can be made.
|
||||||
@@ -436,7 +436,7 @@ static inline Money RailClearCost(RailType railtype)
|
|||||||
* @param to The railtype we are converting to
|
* @param to The railtype we are converting to
|
||||||
* @return Cost per TrackBit
|
* @return Cost per TrackBit
|
||||||
*/
|
*/
|
||||||
static inline Money RailConvertCost(RailType from, RailType to)
|
inline Money RailConvertCost(RailType from, RailType to)
|
||||||
{
|
{
|
||||||
/* Get the costs for removing and building anew
|
/* Get the costs for removing and building anew
|
||||||
* A conversion can never be more costly */
|
* A conversion can never be more costly */
|
||||||
@@ -463,7 +463,7 @@ static inline Money RailConvertCost(RailType from, RailType to)
|
|||||||
* @param total_num Total number of track bits of all railtypes.
|
* @param total_num Total number of track bits of all railtypes.
|
||||||
* @return Total cost.
|
* @return Total cost.
|
||||||
*/
|
*/
|
||||||
static inline Money RailMaintenanceCost(RailType railtype, uint32 num, uint32 total_num)
|
inline Money RailMaintenanceCost(RailType railtype, uint32_t num, uint32_t total_num)
|
||||||
{
|
{
|
||||||
dbg_assert(railtype < RAILTYPE_END);
|
dbg_assert(railtype < RAILTYPE_END);
|
||||||
return (_price[PR_INFRASTRUCTURE_RAIL] * GetRailTypeInfo(railtype)->maintenance_multiplier * num * (1 + IntSqrt(total_num))) >> 11; // 4 bits fraction for the multiplier and 7 bits scaling.
|
return (_price[PR_INFRASTRUCTURE_RAIL] * GetRailTypeInfo(railtype)->maintenance_multiplier * num * (1 + IntSqrt(total_num))) >> 11; // 4 bits fraction for the multiplier and 7 bits scaling.
|
||||||
@@ -474,7 +474,7 @@ static inline Money RailMaintenanceCost(RailType railtype, uint32 num, uint32 to
|
|||||||
* @param num Number of signals.
|
* @param num Number of signals.
|
||||||
* @return Total cost.
|
* @return Total cost.
|
||||||
*/
|
*/
|
||||||
static inline Money SignalMaintenanceCost(uint32 num)
|
inline Money SignalMaintenanceCost(uint32_t num)
|
||||||
{
|
{
|
||||||
return (_price[PR_INFRASTRUCTURE_RAIL] * 15 * num * (1 + IntSqrt(num))) >> 8; // 1 bit fraction for the multiplier and 7 bits scaling.
|
return (_price[PR_INFRASTRUCTURE_RAIL] * 15 * num * (1 + IntSqrt(num))) >> 8; // 1 bit fraction for the multiplier and 7 bits scaling.
|
||||||
}
|
}
|
||||||
|
126
src/rail_map.h
126
src/rail_map.h
@@ -70,7 +70,7 @@ debug_inline static bool IsPlainRailTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_RAILWAY)
|
* @pre IsTileType(t, MP_RAILWAY)
|
||||||
* @return true if and only if the tile has signals
|
* @return true if and only if the tile has signals
|
||||||
*/
|
*/
|
||||||
static inline bool HasSignals(TileIndex t)
|
inline bool HasSignals(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRailTileType(t) == RAIL_TILE_SIGNALS;
|
return GetRailTileType(t) == RAIL_TILE_SIGNALS;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ static inline bool HasSignals(TileIndex t)
|
|||||||
* @param signals whether the rail tile should have signals or not
|
* @param signals whether the rail tile should have signals or not
|
||||||
* @pre IsPlainRailTile(tile)
|
* @pre IsPlainRailTile(tile)
|
||||||
*/
|
*/
|
||||||
static inline void SetHasSignals(TileIndex tile, bool signals)
|
inline void SetHasSignals(TileIndex tile, bool signals)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsPlainRailTile(tile), tile);
|
dbg_assert_tile(IsPlainRailTile(tile), tile);
|
||||||
SB(_m[tile].m5, 6, 1, signals);
|
SB(_m[tile].m5, 6, 1, signals);
|
||||||
@@ -113,7 +113,7 @@ debug_inline static bool IsRailDepotTile(TileIndex t)
|
|||||||
* @param t the tile to get the rail type from
|
* @param t the tile to get the rail type from
|
||||||
* @return the rail type of the tile
|
* @return the rail type of the tile
|
||||||
*/
|
*/
|
||||||
static inline RailType GetRailType(TileIndex t)
|
inline RailType GetRailType(TileIndex t)
|
||||||
{
|
{
|
||||||
return (RailType)GB(_me[t].m8, 0, 6);
|
return (RailType)GB(_me[t].m8, 0, 6);
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ static inline RailType GetRailType(TileIndex t)
|
|||||||
* @param t the tile to set the rail type of
|
* @param t the tile to set the rail type of
|
||||||
* @param r the new rail type for the tile
|
* @param r the new rail type for the tile
|
||||||
*/
|
*/
|
||||||
static inline void SetRailType(TileIndex t, RailType r)
|
inline void SetRailType(TileIndex t, RailType r)
|
||||||
{
|
{
|
||||||
SB(_me[t].m8, 0, 6, r);
|
SB(_me[t].m8, 0, 6, r);
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ static inline void SetRailType(TileIndex t, RailType r)
|
|||||||
* @param t the tile to get the rail type from
|
* @param t the tile to get the rail type from
|
||||||
* @return the rail type of the tile
|
* @return the rail type of the tile
|
||||||
*/
|
*/
|
||||||
static inline RailType GetSecondaryRailType(TileIndex t)
|
inline RailType GetSecondaryRailType(TileIndex t)
|
||||||
{
|
{
|
||||||
return (RailType)GB(_me[t].m8, 6, 6);
|
return (RailType)GB(_me[t].m8, 6, 6);
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ static inline RailType GetSecondaryRailType(TileIndex t)
|
|||||||
* @param t the tile to set the rail type of
|
* @param t the tile to set the rail type of
|
||||||
* @param r the new rail type for the tile
|
* @param r the new rail type for the tile
|
||||||
*/
|
*/
|
||||||
static inline void SetSecondaryRailType(TileIndex t, RailType r)
|
inline void SetSecondaryRailType(TileIndex t, RailType r)
|
||||||
{
|
{
|
||||||
SB(_me[t].m8, 6, 6, r);
|
SB(_me[t].m8, 6, 6, r);
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ static inline void SetSecondaryRailType(TileIndex t, RailType r)
|
|||||||
* @param t the tile to get the rail type from
|
* @param t the tile to get the rail type from
|
||||||
* @return the rail type of the tile
|
* @return the rail type of the tile
|
||||||
*/
|
*/
|
||||||
static inline RailType GetPlainRailParallelTrackRailTypeByTrackBit(TileIndex t, TrackBits b)
|
inline RailType GetPlainRailParallelTrackRailTypeByTrackBit(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
return b & TRACK_BIT_RT_1 ? GetRailType(t) : GetSecondaryRailType(t);
|
return b & TRACK_BIT_RT_1 ? GetRailType(t) : GetSecondaryRailType(t);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ static inline RailType GetPlainRailParallelTrackRailTypeByTrackBit(TileIndex t,
|
|||||||
* @param tile the tile to get the track bits from
|
* @param tile the tile to get the track bits from
|
||||||
* @return the track bits of the tile
|
* @return the track bits of the tile
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetTrackBits(TileIndex tile)
|
inline TrackBits GetTrackBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsPlainRailTile(tile), tile);
|
dbg_assert_tile(IsPlainRailTile(tile), tile);
|
||||||
return (TrackBits)GB(_m[tile].m5, 0, 6);
|
return (TrackBits)GB(_m[tile].m5, 0, 6);
|
||||||
@@ -174,7 +174,7 @@ static inline TrackBits GetTrackBits(TileIndex tile)
|
|||||||
* @param t the tile to set the track bits of
|
* @param t the tile to set the track bits of
|
||||||
* @param b the new track bits for the tile
|
* @param b the new track bits for the tile
|
||||||
*/
|
*/
|
||||||
static inline void SetTrackBits(TileIndex t, TrackBits b)
|
inline void SetTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsPlainRailTile(t), t);
|
dbg_assert_tile(IsPlainRailTile(t), t);
|
||||||
SB(_m[t].m5, 0, 6, b);
|
SB(_m[t].m5, 0, 6, b);
|
||||||
@@ -187,7 +187,7 @@ static inline void SetTrackBits(TileIndex t, TrackBits b)
|
|||||||
* @pre IsPlainRailTile(tile)
|
* @pre IsPlainRailTile(tile)
|
||||||
* @return true if and only if the given track exists on the tile
|
* @return true if and only if the given track exists on the tile
|
||||||
*/
|
*/
|
||||||
static inline bool HasTrack(TileIndex tile, Track track)
|
inline bool HasTrack(TileIndex tile, Track track)
|
||||||
{
|
{
|
||||||
return HasBit(GetTrackBits(tile), track);
|
return HasBit(GetTrackBits(tile), track);
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ static inline bool HasTrack(TileIndex tile, Track track)
|
|||||||
* @pre IsRailDepotTile(t)
|
* @pre IsRailDepotTile(t)
|
||||||
* @return the direction the depot is facing
|
* @return the direction the depot is facing
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection GetRailDepotDirection(TileIndex t)
|
inline DiagDirection GetRailDepotDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ static inline DiagDirection GetRailDepotDirection(TileIndex t)
|
|||||||
* @param t the tile to get the depot track from
|
* @param t the tile to get the depot track from
|
||||||
* @return the track of the depot
|
* @return the track of the depot
|
||||||
*/
|
*/
|
||||||
static inline Track GetRailDepotTrack(TileIndex t)
|
inline Track GetRailDepotTrack(TileIndex t)
|
||||||
{
|
{
|
||||||
return DiagDirToDiagTrack(GetRailDepotDirection(t));
|
return DiagDirToDiagTrack(GetRailDepotDirection(t));
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ static inline Track GetRailDepotTrack(TileIndex t)
|
|||||||
* @param t the tile to query
|
* @param t the tile to query
|
||||||
* @return the track bits
|
* @return the track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsPlainRailTile(t), t);
|
dbg_assert_tile(IsPlainRailTile(t), t);
|
||||||
byte track_b = GB(_m[t].m2, 8, 3);
|
byte track_b = GB(_m[t].m2, 8, 3);
|
||||||
@@ -236,7 +236,7 @@ static inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
|||||||
* @param t the tile to change
|
* @param t the tile to change
|
||||||
* @param b the track bits
|
* @param b the track bits
|
||||||
*/
|
*/
|
||||||
static inline void SetTrackReservation(TileIndex t, TrackBits b)
|
inline void SetTrackReservation(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsPlainRailTile(t), t);
|
dbg_assert_tile(IsPlainRailTile(t), t);
|
||||||
dbg_assert(b != INVALID_TRACK_BIT);
|
dbg_assert(b != INVALID_TRACK_BIT);
|
||||||
@@ -253,7 +253,7 @@ static inline void SetTrackReservation(TileIndex t, TrackBits b)
|
|||||||
* @param t the rack to reserve
|
* @param t the rack to reserve
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
static inline bool TryReserveTrack(TileIndex tile, Track t)
|
inline bool TryReserveTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasTrack(tile, t), tile);
|
dbg_assert_tile(HasTrack(tile, t), tile);
|
||||||
TrackBits bits = TrackToTrackBits(t);
|
TrackBits bits = TrackToTrackBits(t);
|
||||||
@@ -271,7 +271,7 @@ static inline bool TryReserveTrack(TileIndex tile, Track t)
|
|||||||
* @param tile the tile
|
* @param tile the tile
|
||||||
* @param t the track to free
|
* @param t the track to free
|
||||||
*/
|
*/
|
||||||
static inline void UnreserveTrack(TileIndex tile, Track t)
|
inline void UnreserveTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasTrack(tile, t), tile);
|
dbg_assert_tile(HasTrack(tile, t), tile);
|
||||||
TrackBits res = GetRailReservationTrackBits(tile);
|
TrackBits res = GetRailReservationTrackBits(tile);
|
||||||
@@ -285,7 +285,7 @@ static inline void UnreserveTrack(TileIndex tile, Track t)
|
|||||||
* @param t the depot tile
|
* @param t the depot tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool HasDepotReservation(TileIndex t)
|
inline bool HasDepotReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRailDepot(t), t);
|
dbg_assert_tile(IsRailDepot(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
@@ -297,7 +297,7 @@ static inline bool HasDepotReservation(TileIndex t)
|
|||||||
* @param t the depot tile
|
* @param t the depot tile
|
||||||
* @param b the reservation state
|
* @param b the reservation state
|
||||||
*/
|
*/
|
||||||
static inline void SetDepotReservation(TileIndex t, bool b)
|
inline void SetDepotReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRailDepot(t), t);
|
dbg_assert_tile(IsRailDepot(t), t);
|
||||||
SB(_m[t].m5, 4, 1, (byte)b);
|
SB(_m[t].m5, 4, 1, (byte)b);
|
||||||
@@ -309,19 +309,19 @@ static inline void SetDepotReservation(TileIndex t, bool b)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetDepotReservationTrackBits(TileIndex t)
|
inline TrackBits GetDepotReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasDepotReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE;
|
return HasDepotReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SignalType GetSignalType(TileIndex t, Track track)
|
inline SignalType GetSignalType(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
return (SignalType)GB(_m[t].m2, pos, 3);
|
return (SignalType)GB(_m[t].m2, pos, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalType(TileIndex t, Track track, SignalType s)
|
inline void SetSignalType(TileIndex t, Track track, SignalType s)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
@@ -329,38 +329,38 @@ static inline void SetSignalType(TileIndex t, Track track, SignalType s)
|
|||||||
if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
|
if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPresignalEntry(TileIndex t, Track track)
|
inline bool IsPresignalEntry(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsEntrySignal(GetSignalType(t, track));
|
return IsEntrySignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPresignalExit(TileIndex t, Track track)
|
inline bool IsPresignalExit(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsExitSignal(GetSignalType(t, track));
|
return IsExitSignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPresignalCombo(TileIndex t, Track track)
|
inline bool IsPresignalCombo(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsComboSignal(GetSignalType(t, track));
|
return IsComboSignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPresignalProgrammable(TileIndex t, Track track)
|
inline bool IsPresignalProgrammable(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsProgrammableSignal(GetSignalType(t, track));
|
return IsProgrammableSignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsNoEntrySignal(TileIndex t, Track track)
|
inline bool IsNoEntrySignal(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsNoEntrySignal(GetSignalType(t, track));
|
return IsNoEntrySignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One-way signals can't be passed the 'wrong' way. */
|
/** One-way signals can't be passed the 'wrong' way. */
|
||||||
static inline bool IsOnewaySignal(TileIndex t, Track track)
|
inline bool IsOnewaySignal(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return IsOnewaySignal(GetSignalType(t, track));
|
return IsOnewaySignal(GetSignalType(t, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void CycleSignalSide(TileIndex t, Track track)
|
inline void CycleSignalSide(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
byte sig;
|
byte sig;
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6;
|
||||||
@@ -370,46 +370,46 @@ static inline void CycleSignalSide(TileIndex t, Track track)
|
|||||||
SB(_m[t].m3, pos, 2, sig);
|
SB(_m[t].m3, pos, 2, sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SignalVariant GetSignalVariant(TileIndex t, Track track)
|
inline SignalVariant GetSignalVariant(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
|
||||||
return (SignalVariant)GB(_m[t].m2, pos, 1);
|
return (SignalVariant)GB(_m[t].m2, pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v)
|
inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v)
|
||||||
{
|
{
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
|
||||||
SB(_m[t].m2, pos, 1, v);
|
SB(_m[t].m2, pos, 1, v);
|
||||||
if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v);
|
if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetSignalAspect(TileIndex t, Track track)
|
inline uint8 GetSignalAspect(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0;
|
||||||
return GB(_me[t].m7, pos, 3);
|
return GB(_me[t].m7, pos, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalAspect(TileIndex t, Track track, uint8 aspect)
|
inline void SetSignalAspect(TileIndex t, Track track, uint8 aspect)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 3 : 0;
|
||||||
SB(_me[t].m7, pos, 3, aspect);
|
SB(_me[t].m7, pos, 3, aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool NonZeroSignalStylePossiblyOnTile(TileIndex t)
|
inline bool NonZeroSignalStylePossiblyOnTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return _me[t].m6 != 0;
|
return _me[t].m6 != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetSignalStyle(TileIndex t, Track track)
|
inline uint8 GetSignalStyle(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
return GB(_me[t].m6, pos, 4);
|
return GB(_me[t].m6, pos, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetSignalStyleGeneric(TileIndex t, Track track)
|
inline uint8 GetSignalStyleGeneric(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
switch (GetTileType(t)) {
|
switch (GetTileType(t)) {
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
@@ -421,21 +421,21 @@ static inline uint8 GetSignalStyleGeneric(TileIndex t, Track track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalStyle(TileIndex t, Track track, uint8 style)
|
inline void SetSignalStyle(TileIndex t, Track track, uint8 style)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
SB(_me[t].m6, pos, 4, style);
|
SB(_me[t].m6, pos, 4, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool GetSignalAlwaysReserveThrough(TileIndex t, Track track)
|
inline bool GetSignalAlwaysReserveThrough(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
|
||||||
return HasBit(_me[t].m7, pos);
|
return HasBit(_me[t].m7, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool reserve_through)
|
inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool reserve_through)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
dbg_assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 6;
|
||||||
@@ -447,7 +447,7 @@ static inline void SetSignalAlwaysReserveThrough(TileIndex t, Track track, bool
|
|||||||
* @param tile the tile to set the states for
|
* @param tile the tile to set the states for
|
||||||
* @param state the new state
|
* @param state the new state
|
||||||
*/
|
*/
|
||||||
static inline void SetSignalStates(TileIndex tile, uint state)
|
inline void SetSignalStates(TileIndex tile, uint state)
|
||||||
{
|
{
|
||||||
SB(_m[tile].m4, 4, 4, state);
|
SB(_m[tile].m4, 4, 4, state);
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ static inline void SetSignalStates(TileIndex tile, uint state)
|
|||||||
* @param tile the tile to set the states for
|
* @param tile the tile to set the states for
|
||||||
* @return the state of the signals
|
* @return the state of the signals
|
||||||
*/
|
*/
|
||||||
static inline uint GetSignalStates(TileIndex tile)
|
inline uint GetSignalStates(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GB(_m[tile].m4, 4, 4);
|
return GB(_m[tile].m4, 4, 4);
|
||||||
}
|
}
|
||||||
@@ -468,7 +468,7 @@ static inline uint GetSignalStates(TileIndex tile)
|
|||||||
* @param signalbit the signal
|
* @param signalbit the signal
|
||||||
* @return the state of the signal
|
* @return the state of the signal
|
||||||
*/
|
*/
|
||||||
static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
|
inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
|
||||||
{
|
{
|
||||||
return (SignalState)HasBit(GetSignalStates(t), signalbit);
|
return (SignalState)HasBit(GetSignalStates(t), signalbit);
|
||||||
}
|
}
|
||||||
@@ -478,7 +478,7 @@ static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
|
|||||||
* @param tile the tile to set the present signals for
|
* @param tile the tile to set the present signals for
|
||||||
* @param signals the signals that have to be present
|
* @param signals the signals that have to be present
|
||||||
*/
|
*/
|
||||||
static inline void SetPresentSignals(TileIndex tile, uint signals)
|
inline void SetPresentSignals(TileIndex tile, uint signals)
|
||||||
{
|
{
|
||||||
SB(_m[tile].m3, 4, 4, signals);
|
SB(_m[tile].m3, 4, 4, signals);
|
||||||
}
|
}
|
||||||
@@ -488,7 +488,7 @@ static inline void SetPresentSignals(TileIndex tile, uint signals)
|
|||||||
* @param tile the tile to get the present signals for
|
* @param tile the tile to get the present signals for
|
||||||
* @return the signals that are present
|
* @return the signals that are present
|
||||||
*/
|
*/
|
||||||
static inline uint GetPresentSignals(TileIndex tile)
|
inline uint GetPresentSignals(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GB(_m[tile].m3, 4, 4);
|
return GB(_m[tile].m3, 4, 4);
|
||||||
}
|
}
|
||||||
@@ -499,7 +499,7 @@ static inline uint GetPresentSignals(TileIndex tile)
|
|||||||
* @param signalbit the signal
|
* @param signalbit the signal
|
||||||
* @return true if and only if the signal is present
|
* @return true if and only if the signal is present
|
||||||
*/
|
*/
|
||||||
static inline bool IsSignalPresent(TileIndex t, byte signalbit)
|
inline bool IsSignalPresent(TileIndex t, byte signalbit)
|
||||||
{
|
{
|
||||||
return HasBit(GetPresentSignals(t), signalbit);
|
return HasBit(GetPresentSignals(t), signalbit);
|
||||||
}
|
}
|
||||||
@@ -508,7 +508,7 @@ static inline bool IsSignalPresent(TileIndex t, byte signalbit)
|
|||||||
* Checks for the presence of signals (either way) on the given track on the
|
* Checks for the presence of signals (either way) on the given track on the
|
||||||
* given rail tile.
|
* given rail tile.
|
||||||
*/
|
*/
|
||||||
static inline bool HasSignalOnTrack(TileIndex tile, Track track)
|
inline bool HasSignalOnTrack(TileIndex tile, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0;
|
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0;
|
||||||
@@ -521,7 +521,7 @@ static inline bool HasSignalOnTrack(TileIndex tile, Track track)
|
|||||||
* Along meaning if you are currently driving on the given trackdir, this is
|
* Along meaning if you are currently driving on the given trackdir, this is
|
||||||
* the signal that is facing us (for which we stop when it's red).
|
* the signal that is facing us (for which we stop when it's red).
|
||||||
*/
|
*/
|
||||||
static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert (IsValidTrackdir(trackdir));
|
dbg_assert (IsValidTrackdir(trackdir));
|
||||||
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir);
|
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir);
|
||||||
@@ -533,7 +533,7 @@ static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
|||||||
* Along meaning if you are currently driving on the given trackdir, this is
|
* Along meaning if you are currently driving on the given trackdir, this is
|
||||||
* the signal that is facing us (for which we stop when it's red).
|
* the signal that is facing us (for which we stop when it's red).
|
||||||
*/
|
*/
|
||||||
static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
|
inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
dbg_assert_tile(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)), tile);
|
dbg_assert_tile(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)), tile);
|
||||||
@@ -544,7 +544,7 @@ static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trac
|
|||||||
/**
|
/**
|
||||||
* Sets the state of the signal along the given trackdir.
|
* Sets the state of the signal along the given trackdir.
|
||||||
*/
|
*/
|
||||||
static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
|
inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
|
||||||
{
|
{
|
||||||
if (state == SIGNAL_STATE_GREEN) { // set 1
|
if (state == SIGNAL_STATE_GREEN) { // set 1
|
||||||
SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir));
|
SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir));
|
||||||
@@ -558,7 +558,7 @@ static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, S
|
|||||||
* @param tile the tile to check
|
* @param tile the tile to check
|
||||||
* @param td the trackdir to check
|
* @param td the trackdir to check
|
||||||
*/
|
*/
|
||||||
static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
|
inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) &&
|
return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) &&
|
||||||
IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
|
IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
|
||||||
@@ -570,7 +570,7 @@ static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
|
|||||||
* @param tile the tile to check
|
* @param tile the tile to check
|
||||||
* @param td the trackdir to check
|
* @param td the trackdir to check
|
||||||
*/
|
*/
|
||||||
static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
|
inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
|
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
|
||||||
!HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td))) {
|
!HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td))) {
|
||||||
@@ -591,7 +591,7 @@ static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
|
|||||||
* Does signal tile have "one or more trace restrict mappings present" bit set
|
* Does signal tile have "one or more trace restrict mappings present" bit set
|
||||||
* @param tile the tile to check
|
* @param tile the tile to check
|
||||||
*/
|
*/
|
||||||
static inline bool IsRestrictedSignal(TileIndex tile)
|
inline bool IsRestrictedSignal(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
dbg_assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
||||||
return (bool) GB(_m[tile].m2, 12, 1);
|
return (bool) GB(_m[tile].m2, 12, 1);
|
||||||
@@ -601,7 +601,7 @@ static inline bool IsRestrictedSignal(TileIndex tile)
|
|||||||
* Set signal tile "one or more trace restrict mappings present" bit
|
* Set signal tile "one or more trace restrict mappings present" bit
|
||||||
* @param tile the tile to set
|
* @param tile the tile to set
|
||||||
*/
|
*/
|
||||||
static inline void SetRestrictedSignal(TileIndex tile, bool is_restricted)
|
inline void SetRestrictedSignal(TileIndex tile, bool is_restricted)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
dbg_assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
||||||
SB(_m[tile].m2, 12, 1, is_restricted);
|
SB(_m[tile].m2, 12, 1, is_restricted);
|
||||||
@@ -614,13 +614,13 @@ RailType GenericGetRailTypeByTrackBit(TileIndex t, TrackBits track, bool return_
|
|||||||
RailType GenericGetRailTypeByEntryDir(TileIndex t, DiagDirection enterdir, bool return_invalid);
|
RailType GenericGetRailTypeByEntryDir(TileIndex t, DiagDirection enterdir, bool return_invalid);
|
||||||
RailType GetTileSecondaryRailTypeIfValid(TileIndex t);
|
RailType GetTileSecondaryRailTypeIfValid(TileIndex t);
|
||||||
|
|
||||||
static inline RailType GetTileRailTypeByTrack(TileIndex t, Track track) { return GenericGetRailTypeByTrack(t, track, true); }
|
inline RailType GetTileRailTypeByTrack(TileIndex t, Track track) { return GenericGetRailTypeByTrack(t, track, true); }
|
||||||
static inline RailType GetTileRailTypeByTrackBit(TileIndex t, TrackBits track) { return GenericGetRailTypeByTrackBit(t, track, true); }
|
inline RailType GetTileRailTypeByTrackBit(TileIndex t, TrackBits track) { return GenericGetRailTypeByTrackBit(t, track, true); }
|
||||||
static inline RailType GetTileRailTypeByEntryDir(TileIndex t, DiagDirection enterdir) { return GenericGetRailTypeByEntryDir(t, enterdir, true); }
|
inline RailType GetTileRailTypeByEntryDir(TileIndex t, DiagDirection enterdir) { return GenericGetRailTypeByEntryDir(t, enterdir, true); }
|
||||||
|
|
||||||
static inline RailType GetRailTypeByTrack(TileIndex t, Track track) { return GenericGetRailTypeByTrack(t, track, false); }
|
inline RailType GetRailTypeByTrack(TileIndex t, Track track) { return GenericGetRailTypeByTrack(t, track, false); }
|
||||||
static inline RailType GetRailTypeByTrackBit(TileIndex t, TrackBits track) { return GenericGetRailTypeByTrackBit(t, track, false); }
|
inline RailType GetRailTypeByTrackBit(TileIndex t, TrackBits track) { return GenericGetRailTypeByTrackBit(t, track, false); }
|
||||||
static inline RailType GetRailTypeByEntryDir(TileIndex t, DiagDirection enterdir) { return GenericGetRailTypeByEntryDir(t, enterdir, false); }
|
inline RailType GetRailTypeByEntryDir(TileIndex t, DiagDirection enterdir) { return GenericGetRailTypeByEntryDir(t, enterdir, false); }
|
||||||
|
|
||||||
/** The ground 'under' the rail */
|
/** The ground 'under' the rail */
|
||||||
enum RailGroundType {
|
enum RailGroundType {
|
||||||
@@ -641,24 +641,24 @@ enum RailGroundType {
|
|||||||
RAIL_GROUND_HALF_SNOW = 14, ///< Snow only on higher part of slope (steep or one corner raised)
|
RAIL_GROUND_HALF_SNOW = 14, ///< Snow only on higher part of slope (steep or one corner raised)
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
|
inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
|
||||||
{
|
{
|
||||||
SB(_m[t].m4, 0, 4, rgt);
|
SB(_m[t].m4, 0, 4, rgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RailGroundType GetRailGroundType(TileIndex t)
|
inline RailGroundType GetRailGroundType(TileIndex t)
|
||||||
{
|
{
|
||||||
return (RailGroundType)GB(_m[t].m4, 0, 4);
|
return (RailGroundType)GB(_m[t].m4, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsSnowRailGround(TileIndex t)
|
inline bool IsSnowRailGround(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
|
return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
RailGroundType GetTunnelBridgeGroundType(TileIndex tile);
|
RailGroundType GetTunnelBridgeGroundType(TileIndex tile);
|
||||||
|
|
||||||
static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
|
inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_RAILWAY);
|
SetTileType(t, MP_RAILWAY);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
@@ -673,7 +673,7 @@ static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirection d, RailType r)
|
inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirection d, RailType r)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_RAILWAY);
|
SetTileType(t, MP_RAILWAY);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
|
22
src/road.h
22
src/road.h
@@ -234,22 +234,22 @@ public:
|
|||||||
|
|
||||||
extern RoadTypes _roadtypes_type;
|
extern RoadTypes _roadtypes_type;
|
||||||
|
|
||||||
static inline bool RoadTypeIsRoad(RoadType roadtype)
|
inline bool RoadTypeIsRoad(RoadType roadtype)
|
||||||
{
|
{
|
||||||
return !HasBit(_roadtypes_type, roadtype);
|
return !HasBit(_roadtypes_type, roadtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool RoadTypeIsTram(RoadType roadtype)
|
inline bool RoadTypeIsTram(RoadType roadtype)
|
||||||
{
|
{
|
||||||
return HasBit(_roadtypes_type, roadtype);
|
return HasBit(_roadtypes_type, roadtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadTramType GetRoadTramType(RoadType roadtype)
|
inline RoadTramType GetRoadTramType(RoadType roadtype)
|
||||||
{
|
{
|
||||||
return RoadTypeIsTram(roadtype) ? RTT_TRAM : RTT_ROAD;
|
return RoadTypeIsTram(roadtype) ? RTT_TRAM : RTT_ROAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadTramType OtherRoadTramType(RoadTramType rtt)
|
inline RoadTramType OtherRoadTramType(RoadTramType rtt)
|
||||||
{
|
{
|
||||||
return rtt == RTT_ROAD ? RTT_TRAM : RTT_ROAD;
|
return rtt == RTT_ROAD ? RTT_TRAM : RTT_ROAD;
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ static inline RoadTramType OtherRoadTramType(RoadTramType rtt)
|
|||||||
* @param roadtype the road type which the information is requested for
|
* @param roadtype the road type which the information is requested for
|
||||||
* @return The pointer to the RoadTypeInfo
|
* @return The pointer to the RoadTypeInfo
|
||||||
*/
|
*/
|
||||||
static inline const RoadTypeInfo *GetRoadTypeInfo(RoadType roadtype)
|
inline const RoadTypeInfo *GetRoadTypeInfo(RoadType roadtype)
|
||||||
{
|
{
|
||||||
extern RoadTypeInfo _roadtypes[ROADTYPE_END];
|
extern RoadTypeInfo _roadtypes[ROADTYPE_END];
|
||||||
assert(roadtype < ROADTYPE_END);
|
assert(roadtype < ROADTYPE_END);
|
||||||
@@ -274,7 +274,7 @@ static inline const RoadTypeInfo *GetRoadTypeInfo(RoadType roadtype)
|
|||||||
* @param enginetype The RoadType of the engine we are considering.
|
* @param enginetype The RoadType of the engine we are considering.
|
||||||
* @param tiletype The RoadType of the tile we are considering.
|
* @param tiletype The RoadType of the tile we are considering.
|
||||||
*/
|
*/
|
||||||
static inline bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
|
inline bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
|
||||||
{
|
{
|
||||||
return HasBit(GetRoadTypeInfo(enginetype)->powered_roadtypes, tiletype);
|
return HasBit(GetRoadTypeInfo(enginetype)->powered_roadtypes, tiletype);
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ static inline bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
|
|||||||
* @param roadtype The roadtype being built.
|
* @param roadtype The roadtype being built.
|
||||||
* @return The cost multiplier.
|
* @return The cost multiplier.
|
||||||
*/
|
*/
|
||||||
static inline Money RoadBuildCost(RoadType roadtype)
|
inline Money RoadBuildCost(RoadType roadtype)
|
||||||
{
|
{
|
||||||
assert(roadtype < ROADTYPE_END);
|
assert(roadtype < ROADTYPE_END);
|
||||||
return (_price[PR_BUILD_ROAD] * GetRoadTypeInfo(roadtype)->cost_multiplier) >> 3;
|
return (_price[PR_BUILD_ROAD] * GetRoadTypeInfo(roadtype)->cost_multiplier) >> 3;
|
||||||
@@ -295,7 +295,7 @@ static inline Money RoadBuildCost(RoadType roadtype)
|
|||||||
* @param roadtype The roadtype being removed.
|
* @param roadtype The roadtype being removed.
|
||||||
* @return The cost.
|
* @return The cost.
|
||||||
*/
|
*/
|
||||||
static inline Money RoadClearCost(RoadType roadtype)
|
inline Money RoadClearCost(RoadType roadtype)
|
||||||
{
|
{
|
||||||
assert(roadtype < ROADTYPE_END);
|
assert(roadtype < ROADTYPE_END);
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ static inline Money RoadClearCost(RoadType roadtype)
|
|||||||
* @param to The roadtype we are converting to
|
* @param to The roadtype we are converting to
|
||||||
* @return Cost per RoadBit
|
* @return Cost per RoadBit
|
||||||
*/
|
*/
|
||||||
static inline Money RoadConvertCost(RoadType from, RoadType to)
|
inline Money RoadConvertCost(RoadType from, RoadType to)
|
||||||
{
|
{
|
||||||
/* Don't apply convert costs when converting to the same roadtype (ex. building a roadstop over existing road) */
|
/* Don't apply convert costs when converting to the same roadtype (ex. building a roadstop over existing road) */
|
||||||
if (from == to) return (Money)0;
|
if (from == to) return (Money)0;
|
||||||
@@ -327,7 +327,7 @@ static inline Money RoadConvertCost(RoadType from, RoadType to)
|
|||||||
* @param roadtype The roadtype we are testing
|
* @param roadtype The roadtype we are testing
|
||||||
* @return True iff the roadtype disallows level crossings
|
* @return True iff the roadtype disallows level crossings
|
||||||
*/
|
*/
|
||||||
static inline bool RoadNoLevelCrossing(RoadType roadtype)
|
inline bool RoadNoLevelCrossing(RoadType roadtype)
|
||||||
{
|
{
|
||||||
assert(roadtype < ROADTYPE_END);
|
assert(roadtype < ROADTYPE_END);
|
||||||
return HasBit(GetRoadTypeInfo(roadtype)->flags, ROTF_NO_LEVEL_CROSSING);
|
return HasBit(GetRoadTypeInfo(roadtype)->flags, ROTF_NO_LEVEL_CROSSING);
|
||||||
@@ -338,7 +338,7 @@ static inline bool RoadNoLevelCrossing(RoadType roadtype)
|
|||||||
* @param roadtype The roadtype we are testing
|
* @param roadtype The roadtype we are testing
|
||||||
* @return True iff the roadtype disallows tunnels
|
* @return True iff the roadtype disallows tunnels
|
||||||
*/
|
*/
|
||||||
static inline bool RoadNoTunnels(RoadType roadtype)
|
inline bool RoadNoTunnels(RoadType roadtype)
|
||||||
{
|
{
|
||||||
assert(roadtype < ROADTYPE_END);
|
assert(roadtype < ROADTYPE_END);
|
||||||
return HasBit(GetRoadTypeInfo(roadtype)->extra_flags, RXTF_NO_TUNNELS);
|
return HasBit(GetRoadTypeInfo(roadtype)->extra_flags, RXTF_NO_TUNNELS);
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
* @param r the roadtype to check for validness
|
* @param r the roadtype to check for validness
|
||||||
* @return true if and only if valid
|
* @return true if and only if valid
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidRoadBits(RoadBits r)
|
inline bool IsValidRoadBits(RoadBits r)
|
||||||
{
|
{
|
||||||
return r < ROAD_END;
|
return r < ROAD_END;
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ static inline bool IsValidRoadBits(RoadBits r)
|
|||||||
* @param r The given RoadBits value
|
* @param r The given RoadBits value
|
||||||
* @return the complement
|
* @return the complement
|
||||||
*/
|
*/
|
||||||
static inline RoadBits ComplementRoadBits(RoadBits r)
|
inline RoadBits ComplementRoadBits(RoadBits r)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidRoadBits(r));
|
dbg_assert(IsValidRoadBits(r));
|
||||||
return (RoadBits)(ROAD_ALL ^ r);
|
return (RoadBits)(ROAD_ALL ^ r);
|
||||||
@@ -49,7 +49,7 @@ static inline RoadBits ComplementRoadBits(RoadBits r)
|
|||||||
* @param r The given RoadBits value
|
* @param r The given RoadBits value
|
||||||
* @return the mirrored
|
* @return the mirrored
|
||||||
*/
|
*/
|
||||||
static inline RoadBits MirrorRoadBits(RoadBits r)
|
inline RoadBits MirrorRoadBits(RoadBits r)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidRoadBits(r));
|
dbg_assert(IsValidRoadBits(r));
|
||||||
return (RoadBits)(GB(r, 0, 2) << 2 | GB(r, 2, 2));
|
return (RoadBits)(GB(r, 0, 2) << 2 | GB(r, 2, 2));
|
||||||
@@ -64,7 +64,7 @@ static inline RoadBits MirrorRoadBits(RoadBits r)
|
|||||||
* @param rot The given Rotation angle
|
* @param rot The given Rotation angle
|
||||||
* @return the rotated
|
* @return the rotated
|
||||||
*/
|
*/
|
||||||
static inline RoadBits RotateRoadBits(RoadBits r, DiagDirDiff rot)
|
inline RoadBits RotateRoadBits(RoadBits r, DiagDirDiff rot)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidRoadBits(r));
|
dbg_assert(IsValidRoadBits(r));
|
||||||
for (; rot > (DiagDirDiff)0; rot--) {
|
for (; rot > (DiagDirDiff)0; rot--) {
|
||||||
@@ -79,7 +79,7 @@ static inline RoadBits RotateRoadBits(RoadBits r, DiagDirDiff rot)
|
|||||||
* @param r The given RoadBits
|
* @param r The given RoadBits
|
||||||
* @return true if we've got a straight road
|
* @return true if we've got a straight road
|
||||||
*/
|
*/
|
||||||
static inline bool IsStraightRoad(RoadBits r)
|
inline bool IsStraightRoad(RoadBits r)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidRoadBits(r));
|
dbg_assert(IsValidRoadBits(r));
|
||||||
return (r == ROAD_X || r == ROAD_Y);
|
return (r == ROAD_X || r == ROAD_Y);
|
||||||
@@ -94,7 +94,7 @@ static inline bool IsStraightRoad(RoadBits r)
|
|||||||
* @param d The DiagDirection
|
* @param d The DiagDirection
|
||||||
* @return The result RoadBits which the selected road-part set
|
* @return The result RoadBits which the selected road-part set
|
||||||
*/
|
*/
|
||||||
static inline RoadBits DiagDirToRoadBits(DiagDirection d)
|
inline RoadBits DiagDirToRoadBits(DiagDirection d)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(d));
|
dbg_assert(IsValidDiagDirection(d));
|
||||||
return (RoadBits)(ROAD_NW << (3 ^ d));
|
return (RoadBits)(ROAD_NW << (3 ^ d));
|
||||||
@@ -109,7 +109,7 @@ static inline RoadBits DiagDirToRoadBits(DiagDirection d)
|
|||||||
* @param a The Axis
|
* @param a The Axis
|
||||||
* @return The result RoadBits which the selected road-part set
|
* @return The result RoadBits which the selected road-part set
|
||||||
*/
|
*/
|
||||||
static inline RoadBits AxisToRoadBits(Axis a)
|
inline RoadBits AxisToRoadBits(Axis a)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(a));
|
dbg_assert(IsValidAxis(a));
|
||||||
return a == AXIS_X ? ROAD_X : ROAD_Y;
|
return a == AXIS_X ? ROAD_X : ROAD_Y;
|
||||||
@@ -123,7 +123,7 @@ static inline RoadBits AxisToRoadBits(Axis a)
|
|||||||
* @param total_num Total number of road bits of all road/tram-types.
|
* @param total_num Total number of road bits of all road/tram-types.
|
||||||
* @return Total cost.
|
* @return Total cost.
|
||||||
*/
|
*/
|
||||||
static inline Money RoadMaintenanceCost(RoadType roadtype, uint32 num, uint32 total_num)
|
inline Money RoadMaintenanceCost(RoadType roadtype, uint32_t num, uint32_t total_num)
|
||||||
{
|
{
|
||||||
dbg_assert(roadtype < ROADTYPE_END);
|
dbg_assert(roadtype < ROADTYPE_END);
|
||||||
return (_price[PR_INFRASTRUCTURE_ROAD] * GetRoadTypeInfo(roadtype)->maintenance_multiplier * num * (1 + IntSqrt(total_num))) >> 12;
|
return (_price[PR_INFRASTRUCTURE_ROAD] * GetRoadTypeInfo(roadtype)->maintenance_multiplier * num * (1 + IntSqrt(total_num))) >> 12;
|
||||||
@@ -133,7 +133,7 @@ static inline Money RoadMaintenanceCost(RoadType roadtype, uint32 num, uint32 to
|
|||||||
* Test if a road type has catenary
|
* Test if a road type has catenary
|
||||||
* @param roadtype Road type to test
|
* @param roadtype Road type to test
|
||||||
*/
|
*/
|
||||||
static inline bool HasRoadCatenary(RoadType roadtype)
|
inline bool HasRoadCatenary(RoadType roadtype)
|
||||||
{
|
{
|
||||||
dbg_assert(roadtype < ROADTYPE_END);
|
dbg_assert(roadtype < ROADTYPE_END);
|
||||||
return HasBit(GetRoadTypeInfo(roadtype)->flags, ROTF_CATENARY);
|
return HasBit(GetRoadTypeInfo(roadtype)->flags, ROTF_CATENARY);
|
||||||
@@ -143,7 +143,7 @@ static inline bool HasRoadCatenary(RoadType roadtype)
|
|||||||
* Test if we should draw road catenary
|
* Test if we should draw road catenary
|
||||||
* @param roadtype Road type to test
|
* @param roadtype Road type to test
|
||||||
*/
|
*/
|
||||||
static inline bool HasRoadCatenaryDrawn(RoadType roadtype)
|
inline bool HasRoadCatenaryDrawn(RoadType roadtype)
|
||||||
{
|
{
|
||||||
return HasRoadCatenary(roadtype) && !IsInvisibilitySet(TO_CATENARY);
|
return HasRoadCatenary(roadtype) && !IsInvisibilitySet(TO_CATENARY);
|
||||||
}
|
}
|
||||||
|
102
src/road_map.h
102
src/road_map.h
@@ -29,7 +29,7 @@ enum RoadTileType {
|
|||||||
* @param t Tile to query.
|
* @param t Tile to query.
|
||||||
* @return true if tile can be queried about road/tram types.
|
* @return true if tile can be queried about road/tram types.
|
||||||
*/
|
*/
|
||||||
static inline bool MayHaveRoad(TileIndex t)
|
inline bool MayHaveRoad(TileIndex t)
|
||||||
{
|
{
|
||||||
switch (GetTileType(t)) {
|
switch (GetTileType(t)) {
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
@@ -85,7 +85,7 @@ debug_inline static bool IsNormalRoadTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_ROAD)
|
* @pre IsTileType(t, MP_ROAD)
|
||||||
* @return True if level crossing.
|
* @return True if level crossing.
|
||||||
*/
|
*/
|
||||||
static inline bool IsLevelCrossing(TileIndex t)
|
inline bool IsLevelCrossing(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRoadTileType(t) == ROAD_TILE_CROSSING;
|
return GetRoadTileType(t) == ROAD_TILE_CROSSING;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ static inline bool IsLevelCrossing(TileIndex t)
|
|||||||
* @param t Tile to query.
|
* @param t Tile to query.
|
||||||
* @return True if level crossing tile.
|
* @return True if level crossing tile.
|
||||||
*/
|
*/
|
||||||
static inline bool IsLevelCrossingTile(TileIndex t)
|
inline bool IsLevelCrossingTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
|
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ debug_inline static bool IsRoadDepotTile(TileIndex t)
|
|||||||
* @pre IsNormalRoad(t)
|
* @pre IsNormalRoad(t)
|
||||||
* @return The present road bits for the road type.
|
* @return The present road bits for the road type.
|
||||||
*/
|
*/
|
||||||
static inline RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
|
inline RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsNormalRoad(t), t);
|
dbg_assert_tile(IsNormalRoad(t), t);
|
||||||
if (rtt == RTT_TRAM) return (RoadBits)GB(_m[t].m3, 0, 4);
|
if (rtt == RTT_TRAM) return (RoadBits)GB(_m[t].m3, 0, 4);
|
||||||
@@ -141,7 +141,7 @@ static inline RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
|
|||||||
* @param tile The tile from which we want to get the RoadBits
|
* @param tile The tile from which we want to get the RoadBits
|
||||||
* @return all set RoadBits of the tile
|
* @return all set RoadBits of the tile
|
||||||
*/
|
*/
|
||||||
static inline RoadBits GetAllRoadBits(TileIndex tile)
|
inline RoadBits GetAllRoadBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetRoadBits(tile, RTT_ROAD) | GetRoadBits(tile, RTT_TRAM);
|
return GetRoadBits(tile, RTT_ROAD) | GetRoadBits(tile, RTT_TRAM);
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ static inline RoadBits GetAllRoadBits(TileIndex tile)
|
|||||||
* @param rt Road type.
|
* @param rt Road type.
|
||||||
* @pre IsNormalRoad(t)
|
* @pre IsNormalRoad(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
|
inline void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
assert_tile(IsNormalRoad(t), t); // XXX incomplete
|
assert_tile(IsNormalRoad(t), t); // XXX incomplete
|
||||||
if (rtt == RTT_TRAM) {
|
if (rtt == RTT_TRAM) {
|
||||||
@@ -163,19 +163,19 @@ static inline void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadType GetRoadTypeRoad(TileIndex t)
|
inline RoadType GetRoadTypeRoad(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert(MayHaveRoad(t));
|
dbg_assert(MayHaveRoad(t));
|
||||||
return (RoadType)GB(_m[t].m4, 0, 6);
|
return (RoadType)GB(_m[t].m4, 0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadType GetRoadTypeTram(TileIndex t)
|
inline RoadType GetRoadTypeTram(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert(MayHaveRoad(t));
|
dbg_assert(MayHaveRoad(t));
|
||||||
return (RoadType)GB(_me[t].m8, 6, 6);
|
return (RoadType)GB(_me[t].m8, 6, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadType GetRoadType(TileIndex t, RoadTramType rtt)
|
inline RoadType GetRoadType(TileIndex t, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
return (rtt == RTT_TRAM) ? GetRoadTypeTram(t) : GetRoadTypeRoad(t);
|
return (rtt == RTT_TRAM) ? GetRoadTypeTram(t) : GetRoadTypeRoad(t);
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ static inline RoadType GetRoadType(TileIndex t, RoadTramType rtt)
|
|||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return Present road types.
|
* @return Present road types.
|
||||||
*/
|
*/
|
||||||
static inline RoadTypes GetPresentRoadTypes(TileIndex t)
|
inline RoadTypes GetPresentRoadTypes(TileIndex t)
|
||||||
{
|
{
|
||||||
RoadTypes result = ROADTYPES_NONE;
|
RoadTypes result = ROADTYPES_NONE;
|
||||||
if (MayHaveRoad(t)) {
|
if (MayHaveRoad(t)) {
|
||||||
@@ -195,12 +195,12 @@ static inline RoadTypes GetPresentRoadTypes(TileIndex t)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool HasRoadTypeRoad(TileIndex t)
|
inline bool HasRoadTypeRoad(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRoadTypeRoad(t) != INVALID_ROADTYPE;
|
return GetRoadTypeRoad(t) != INVALID_ROADTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool HasRoadTypeTram(TileIndex t)
|
inline bool HasRoadTypeTram(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRoadTypeTram(t) != INVALID_ROADTYPE;
|
return GetRoadTypeTram(t) != INVALID_ROADTYPE;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ static inline bool HasRoadTypeTram(TileIndex t)
|
|||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return Present road types.
|
* @return Present road types.
|
||||||
*/
|
*/
|
||||||
static inline RoadTramTypes GetPresentRoadTramTypes(TileIndex t)
|
inline RoadTramTypes GetPresentRoadTramTypes(TileIndex t)
|
||||||
{
|
{
|
||||||
RoadTramTypes result = (RoadTramTypes)0;
|
RoadTramTypes result = (RoadTramTypes)0;
|
||||||
if (MayHaveRoad(t)) {
|
if (MayHaveRoad(t)) {
|
||||||
@@ -226,7 +226,7 @@ static inline RoadTramTypes GetPresentRoadTramTypes(TileIndex t)
|
|||||||
* @param tram True to check tram, false to check road.
|
* @param tram True to check tram, false to check road.
|
||||||
* @return True if the tile has the specified road type.
|
* @return True if the tile has the specified road type.
|
||||||
*/
|
*/
|
||||||
static inline bool HasTileRoadType(TileIndex t, RoadTramType rtt)
|
inline bool HasTileRoadType(TileIndex t, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
return GetRoadType(t, rtt) != INVALID_ROADTYPE;
|
return GetRoadType(t, rtt) != INVALID_ROADTYPE;
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ static inline bool HasTileRoadType(TileIndex t, RoadTramType rtt)
|
|||||||
* @param rts Allowed road types.
|
* @param rts Allowed road types.
|
||||||
* @return True if the tile has one of the specified road types.
|
* @return True if the tile has one of the specified road types.
|
||||||
*/
|
*/
|
||||||
static inline bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
|
inline bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
|
||||||
{
|
{
|
||||||
if (!MayHaveRoad(t)) return false;
|
if (!MayHaveRoad(t)) return false;
|
||||||
return (GetPresentRoadTypes(t) & rts);
|
return (GetPresentRoadTypes(t) & rts);
|
||||||
@@ -249,7 +249,7 @@ static inline bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
|
|||||||
* @param rtt RoadTramType.
|
* @param rtt RoadTramType.
|
||||||
* @return Owner of the given road type.
|
* @return Owner of the given road type.
|
||||||
*/
|
*/
|
||||||
static inline Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
|
inline Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
dbg_assert(MayHaveRoad(t));
|
dbg_assert(MayHaveRoad(t));
|
||||||
if (rtt == RTT_ROAD) return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
|
if (rtt == RTT_ROAD) return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
|
||||||
@@ -266,7 +266,7 @@ static inline Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
|
|||||||
* @param rtt RoadTramType.
|
* @param rtt RoadTramType.
|
||||||
* @param o New owner of the given road type.
|
* @param o New owner of the given road type.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
inline void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
||||||
{
|
{
|
||||||
if (rtt == RTT_ROAD) {
|
if (rtt == RTT_ROAD) {
|
||||||
SB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5, o);
|
SB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5, o);
|
||||||
@@ -283,7 +283,7 @@ static inline void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
|||||||
* @pre HasTileRoadType(t, rt)
|
* @pre HasTileRoadType(t, rt)
|
||||||
* @return True if the road type is owned by the given owner.
|
* @return True if the road type is owned by the given owner.
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
inline bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasTileRoadType(t, rtt), t);
|
dbg_assert_tile(HasTileRoadType(t, rtt), t);
|
||||||
return (GetRoadOwner(t, rtt) == o);
|
return (GetRoadOwner(t, rtt) == o);
|
||||||
@@ -295,7 +295,7 @@ static inline bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
|
|||||||
* @pre IsTileType(t, MP_ROAD)
|
* @pre IsTileType(t, MP_ROAD)
|
||||||
* @return true iff tile has road and the road is owned by a town
|
* @return true iff tile has road and the road is owned by a town
|
||||||
*/
|
*/
|
||||||
static inline bool HasTownOwnedRoad(TileIndex t)
|
inline bool HasTownOwnedRoad(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasTileRoadType(t, RTT_ROAD) && IsRoadOwner(t, RTT_ROAD, OWNER_TOWN);
|
return HasTileRoadType(t, RTT_ROAD) && IsRoadOwner(t, RTT_ROAD, OWNER_TOWN);
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ template <> struct EnumPropsT<DisallowedRoadDirections> : MakeEnumPropsT<Disallo
|
|||||||
* @param t the tile to get the directions from
|
* @param t the tile to get the directions from
|
||||||
* @return the disallowed directions
|
* @return the disallowed directions
|
||||||
*/
|
*/
|
||||||
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsNormalRoad(t), t);
|
dbg_assert_tile(IsNormalRoad(t), t);
|
||||||
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
||||||
@@ -328,7 +328,7 @@ static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
|||||||
* @param t the tile to set the directions for
|
* @param t the tile to set the directions for
|
||||||
* @param drd the disallowed directions
|
* @param drd the disallowed directions
|
||||||
*/
|
*/
|
||||||
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
||||||
{
|
{
|
||||||
assert_tile(IsNormalRoad(t), t);
|
assert_tile(IsNormalRoad(t), t);
|
||||||
assert(drd < DRD_END);
|
assert(drd < DRD_END);
|
||||||
@@ -350,7 +350,7 @@ enum RoadCachedOneWayState {
|
|||||||
* @pre MayHaveRoad(t)
|
* @pre MayHaveRoad(t)
|
||||||
* @return road cached one way state
|
* @return road cached one way state
|
||||||
*/
|
*/
|
||||||
static inline RoadCachedOneWayState GetRoadCachedOneWayState(TileIndex t)
|
inline RoadCachedOneWayState GetRoadCachedOneWayState(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert(MayHaveRoad(t));
|
dbg_assert(MayHaveRoad(t));
|
||||||
return (RoadCachedOneWayState)GB(_me[t].m8, 12, 3);
|
return (RoadCachedOneWayState)GB(_me[t].m8, 12, 3);
|
||||||
@@ -362,7 +362,7 @@ static inline RoadCachedOneWayState GetRoadCachedOneWayState(TileIndex t)
|
|||||||
* @param rcows road cached one way state
|
* @param rcows road cached one way state
|
||||||
* @pre MayHaveRoad(t)
|
* @pre MayHaveRoad(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadCachedOneWayState(TileIndex t, RoadCachedOneWayState rcows)
|
inline void SetRoadCachedOneWayState(TileIndex t, RoadCachedOneWayState rcows)
|
||||||
{
|
{
|
||||||
assert(MayHaveRoad(t));
|
assert(MayHaveRoad(t));
|
||||||
SB(_me[t].m8, 12, 3, rcows);
|
SB(_me[t].m8, 12, 3, rcows);
|
||||||
@@ -374,7 +374,7 @@ static inline void SetRoadCachedOneWayState(TileIndex t, RoadCachedOneWayState r
|
|||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
* @return The axis of the road.
|
* @return The axis of the road.
|
||||||
*/
|
*/
|
||||||
static inline Axis GetCrossingRoadAxis(TileIndex t)
|
inline Axis GetCrossingRoadAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsLevelCrossing(t), t);
|
dbg_assert_tile(IsLevelCrossing(t), t);
|
||||||
return (Axis)GB(_m[t].m5, 0, 1);
|
return (Axis)GB(_m[t].m5, 0, 1);
|
||||||
@@ -386,7 +386,7 @@ static inline Axis GetCrossingRoadAxis(TileIndex t)
|
|||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
* @return The axis of the rail.
|
* @return The axis of the rail.
|
||||||
*/
|
*/
|
||||||
static inline Axis GetCrossingRailAxis(TileIndex t)
|
inline Axis GetCrossingRailAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsLevelCrossing(t), t);
|
dbg_assert_tile(IsLevelCrossing(t), t);
|
||||||
return OtherAxis((Axis)GetCrossingRoadAxis(t));
|
return OtherAxis((Axis)GetCrossingRoadAxis(t));
|
||||||
@@ -397,7 +397,7 @@ static inline Axis GetCrossingRailAxis(TileIndex t)
|
|||||||
* @param tile The tile to query.
|
* @param tile The tile to query.
|
||||||
* @return The present road bits.
|
* @return The present road bits.
|
||||||
*/
|
*/
|
||||||
static inline RoadBits GetCrossingRoadBits(TileIndex tile)
|
inline RoadBits GetCrossingRoadBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y;
|
return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y;
|
||||||
}
|
}
|
||||||
@@ -407,7 +407,7 @@ static inline RoadBits GetCrossingRoadBits(TileIndex tile)
|
|||||||
* @param tile The tile to query.
|
* @param tile The tile to query.
|
||||||
* @return The rail track.
|
* @return The rail track.
|
||||||
*/
|
*/
|
||||||
static inline Track GetCrossingRailTrack(TileIndex tile)
|
inline Track GetCrossingRailTrack(TileIndex tile)
|
||||||
{
|
{
|
||||||
return AxisToTrack(GetCrossingRailAxis(tile));
|
return AxisToTrack(GetCrossingRailAxis(tile));
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ static inline Track GetCrossingRailTrack(TileIndex tile)
|
|||||||
* @param tile The tile to query.
|
* @param tile The tile to query.
|
||||||
* @return The rail track bits.
|
* @return The rail track bits.
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetCrossingRailBits(TileIndex tile)
|
inline TrackBits GetCrossingRailBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
return AxisToTrackBits(GetCrossingRailAxis(tile));
|
return AxisToTrackBits(GetCrossingRailAxis(tile));
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ static inline TrackBits GetCrossingRailBits(TileIndex tile)
|
|||||||
* @return reservation state
|
* @return reservation state
|
||||||
* @pre IsLevelCrossingTile(t)
|
* @pre IsLevelCrossingTile(t)
|
||||||
*/
|
*/
|
||||||
static inline bool HasCrossingReservation(TileIndex t)
|
inline bool HasCrossingReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsLevelCrossingTile(t), t);
|
dbg_assert_tile(IsLevelCrossingTile(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
@@ -442,7 +442,7 @@ static inline bool HasCrossingReservation(TileIndex t)
|
|||||||
* @param b the reservation state
|
* @param b the reservation state
|
||||||
* @pre IsLevelCrossingTile(t)
|
* @pre IsLevelCrossingTile(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCrossingReservation(TileIndex t, bool b)
|
inline void SetCrossingReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert_tile(IsLevelCrossingTile(t), t);
|
assert_tile(IsLevelCrossingTile(t), t);
|
||||||
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
||||||
@@ -454,7 +454,7 @@ static inline void SetCrossingReservation(TileIndex t, bool b)
|
|||||||
* @pre IsLevelCrossingTile(t)
|
* @pre IsLevelCrossingTile(t)
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetCrossingReservationTrackBits(TileIndex t)
|
inline TrackBits GetCrossingReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasCrossingReservation(t) ? GetCrossingRailBits(t) : TRACK_BIT_NONE;
|
return HasCrossingReservation(t) ? GetCrossingRailBits(t) : TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ static inline TrackBits GetCrossingReservationTrackBits(TileIndex t)
|
|||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
* @return True if the level crossing is barred.
|
* @return True if the level crossing is barred.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCrossingBarred(TileIndex t)
|
inline bool IsCrossingBarred(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsLevelCrossing(t), t);
|
dbg_assert_tile(IsLevelCrossing(t), t);
|
||||||
return HasBit(_m[t].m5, 5);
|
return HasBit(_m[t].m5, 5);
|
||||||
@@ -477,7 +477,7 @@ static inline bool IsCrossingBarred(TileIndex t)
|
|||||||
* @param barred True if the crossing should be barred, false otherwise.
|
* @param barred True if the crossing should be barred, false otherwise.
|
||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCrossingBarred(TileIndex t, bool barred)
|
inline void SetCrossingBarred(TileIndex t, bool barred)
|
||||||
{
|
{
|
||||||
assert_tile(IsLevelCrossing(t), t);
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
SB(_m[t].m5, 5, 1, barred ? 1 : 0);
|
SB(_m[t].m5, 5, 1, barred ? 1 : 0);
|
||||||
@@ -489,7 +489,7 @@ static inline void SetCrossingBarred(TileIndex t, bool barred)
|
|||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
* @return True if the level crossing is marked as occupied. This may return false positives.
|
* @return True if the level crossing is marked as occupied. This may return false positives.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsLevelCrossing(t), t);
|
dbg_assert_tile(IsLevelCrossing(t), t);
|
||||||
return HasBit(_m[t].m5, 1);
|
return HasBit(_m[t].m5, 1);
|
||||||
@@ -501,7 +501,7 @@ static inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
|||||||
* @param barred True if the crossing should be marked as occupied, false otherwise.
|
* @param barred True if the crossing should be marked as occupied, false otherwise.
|
||||||
* @pre IsLevelCrossing(t)
|
* @pre IsLevelCrossing(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCrossingOccupiedByRoadVehicle(TileIndex t, bool occupied)
|
inline void SetCrossingOccupiedByRoadVehicle(TileIndex t, bool occupied)
|
||||||
{
|
{
|
||||||
assert_tile(IsLevelCrossing(t), t);
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
SB(_m[t].m5, 1, 1, occupied ? 1 : 0);
|
SB(_m[t].m5, 1, 1, occupied ? 1 : 0);
|
||||||
@@ -514,7 +514,7 @@ static inline void SetCrossingOccupiedByRoadVehicle(TileIndex t, bool occupied)
|
|||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return True if the tile has snow/desert.
|
* @return True if the tile has snow/desert.
|
||||||
*/
|
*/
|
||||||
static inline bool IsOnSnow(TileIndex t)
|
inline bool IsOnSnow(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasBit(_me[t].m7, 5);
|
return HasBit(_me[t].m7, 5);
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ static inline bool IsOnSnow(TileIndex t)
|
|||||||
* Toggle the snow/desert state of a road tile.
|
* Toggle the snow/desert state of a road tile.
|
||||||
* @param t The tile to change.
|
* @param t The tile to change.
|
||||||
*/
|
*/
|
||||||
static inline void ToggleSnow(TileIndex t)
|
inline void ToggleSnow(TileIndex t)
|
||||||
{
|
{
|
||||||
ToggleBit(_me[t].m7, 5);
|
ToggleBit(_me[t].m7, 5);
|
||||||
}
|
}
|
||||||
@@ -548,7 +548,7 @@ enum Roadside {
|
|||||||
* @param tile The tile to query.
|
* @param tile The tile to query.
|
||||||
* @return The road decoration of the tile.
|
* @return The road decoration of the tile.
|
||||||
*/
|
*/
|
||||||
static inline Roadside GetRoadside(TileIndex tile)
|
inline Roadside GetRoadside(TileIndex tile)
|
||||||
{
|
{
|
||||||
return (Roadside)GB(_me[tile].m6, 3, 3);
|
return (Roadside)GB(_me[tile].m6, 3, 3);
|
||||||
}
|
}
|
||||||
@@ -558,7 +558,7 @@ static inline Roadside GetRoadside(TileIndex tile)
|
|||||||
* @param tile The tile to change.
|
* @param tile The tile to change.
|
||||||
* @param s The new road decoration of the tile.
|
* @param s The new road decoration of the tile.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadside(TileIndex tile, Roadside s)
|
inline void SetRoadside(TileIndex tile, Roadside s)
|
||||||
{
|
{
|
||||||
SB(_me[tile].m6, 3, 3, s);
|
SB(_me[tile].m6, 3, 3, s);
|
||||||
}
|
}
|
||||||
@@ -568,7 +568,7 @@ static inline void SetRoadside(TileIndex tile, Roadside s)
|
|||||||
* @param t The tile to check.
|
* @param t The tile to check.
|
||||||
* @return True if the tile has road works in progress.
|
* @return True if the tile has road works in progress.
|
||||||
*/
|
*/
|
||||||
static inline bool HasRoadWorks(TileIndex t)
|
inline bool HasRoadWorks(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRoadside(t) >= ROADSIDE_GRASS_ROAD_WORKS;
|
return GetRoadside(t) >= ROADSIDE_GRASS_ROAD_WORKS;
|
||||||
}
|
}
|
||||||
@@ -578,7 +578,7 @@ static inline bool HasRoadWorks(TileIndex t)
|
|||||||
* @param t The tile to modify.
|
* @param t The tile to modify.
|
||||||
* @return True if the road works are in the last stage.
|
* @return True if the road works are in the last stage.
|
||||||
*/
|
*/
|
||||||
static inline bool IncreaseRoadWorksCounter(TileIndex t)
|
inline bool IncreaseRoadWorksCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
AB(_me[t].m7, 0, 4, 1);
|
AB(_me[t].m7, 0, 4, 1);
|
||||||
|
|
||||||
@@ -590,7 +590,7 @@ static inline bool IncreaseRoadWorksCounter(TileIndex t)
|
|||||||
* @param t The tile to start the work on.
|
* @param t The tile to start the work on.
|
||||||
* @pre !HasRoadWorks(t)
|
* @pre !HasRoadWorks(t)
|
||||||
*/
|
*/
|
||||||
static inline void StartRoadWorks(TileIndex t)
|
inline void StartRoadWorks(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(!HasRoadWorks(t), t);
|
assert_tile(!HasRoadWorks(t), t);
|
||||||
/* Remove any trees or lamps in case or roadwork */
|
/* Remove any trees or lamps in case or roadwork */
|
||||||
@@ -606,7 +606,7 @@ static inline void StartRoadWorks(TileIndex t)
|
|||||||
* @param t Tile to stop the road works on.
|
* @param t Tile to stop the road works on.
|
||||||
* @pre HasRoadWorks(t)
|
* @pre HasRoadWorks(t)
|
||||||
*/
|
*/
|
||||||
static inline void TerminateRoadWorks(TileIndex t)
|
inline void TerminateRoadWorks(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(HasRoadWorks(t), t);
|
assert_tile(HasRoadWorks(t), t);
|
||||||
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS));
|
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS));
|
||||||
@@ -620,7 +620,7 @@ static inline void TerminateRoadWorks(TileIndex t)
|
|||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return Diagonal direction of the depot exit.
|
* @return Diagonal direction of the depot exit.
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRoadDepot(t), t);
|
dbg_assert_tile(IsRoadDepot(t), t);
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
@@ -634,7 +634,7 @@ RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_b
|
|||||||
* @param t The tile to change.
|
* @param t The tile to change.
|
||||||
* @param rt The road type to set.
|
* @param rt The road type to set.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadTypeRoad(TileIndex t, RoadType rt)
|
inline void SetRoadTypeRoad(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(MayHaveRoad(t));
|
assert(MayHaveRoad(t));
|
||||||
assert(rt == INVALID_ROADTYPE || RoadTypeIsRoad(rt));
|
assert(rt == INVALID_ROADTYPE || RoadTypeIsRoad(rt));
|
||||||
@@ -646,7 +646,7 @@ static inline void SetRoadTypeRoad(TileIndex t, RoadType rt)
|
|||||||
* @param t The tile to change.
|
* @param t The tile to change.
|
||||||
* @param rt The road type to set.
|
* @param rt The road type to set.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadTypeTram(TileIndex t, RoadType rt)
|
inline void SetRoadTypeTram(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(MayHaveRoad(t));
|
assert(MayHaveRoad(t));
|
||||||
assert(rt == INVALID_ROADTYPE || RoadTypeIsTram(rt));
|
assert(rt == INVALID_ROADTYPE || RoadTypeIsTram(rt));
|
||||||
@@ -659,7 +659,7 @@ static inline void SetRoadTypeTram(TileIndex t, RoadType rt)
|
|||||||
* @param rtt Set road or tram type.
|
* @param rtt Set road or tram type.
|
||||||
* @param rt The road type to set.
|
* @param rt The road type to set.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
|
inline void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
|
||||||
{
|
{
|
||||||
if (rtt == RTT_TRAM) {
|
if (rtt == RTT_TRAM) {
|
||||||
SetRoadTypeTram(t, rt);
|
SetRoadTypeTram(t, rt);
|
||||||
@@ -674,7 +674,7 @@ static inline void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
|
|||||||
* @param road_rt The road roadtype to set for the tile.
|
* @param road_rt The road roadtype to set for the tile.
|
||||||
* @param tram_rt The tram roadtype to set for the tile.
|
* @param tram_rt The tram roadtype to set for the tile.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
|
inline void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
|
||||||
{
|
{
|
||||||
SetRoadTypeRoad(t, road_rt);
|
SetRoadTypeRoad(t, road_rt);
|
||||||
SetRoadTypeTram(t, tram_rt);
|
SetRoadTypeTram(t, tram_rt);
|
||||||
@@ -690,7 +690,7 @@ static inline void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
|
|||||||
* @param road New owner of road.
|
* @param road New owner of road.
|
||||||
* @param tram New owner of tram tracks.
|
* @param tram New owner of tram tracks.
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
|
inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_ROAD);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, road);
|
SetTileOwner(t, road);
|
||||||
@@ -715,7 +715,7 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt,
|
|||||||
* @param tram_rt The tram roadtype to set for the tile.
|
* @param tram_rt The tram roadtype to set for the tile.
|
||||||
* @param town Town ID if the road is a town-owned road.
|
* @param town Town ID if the road is a town-owned road.
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
|
inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_ROAD);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, rail);
|
SetTileOwner(t, rail);
|
||||||
@@ -738,7 +738,7 @@ static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner r
|
|||||||
* @param dir Direction of the depot exit.*
|
* @param dir Direction of the depot exit.*
|
||||||
* @param rt Road type of the depot.
|
* @param rt Road type of the depot.
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
|
inline void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_ROAD);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, owner);
|
SetTileOwner(t, owner);
|
||||||
|
@@ -324,7 +324,7 @@ struct SaveLoadCompat {
|
|||||||
* @param type VarType holding information about the variable-type
|
* @param type VarType holding information about the variable-type
|
||||||
* @return the SLE_VAR_* part of a variable-type description
|
* @return the SLE_VAR_* part of a variable-type description
|
||||||
*/
|
*/
|
||||||
static inline constexpr VarType GetVarMemType(VarType type)
|
inline constexpr VarType GetVarMemType(VarType type)
|
||||||
{
|
{
|
||||||
return type & 0xF0; // GB(type, 4, 4) << 4;
|
return type & 0xF0; // GB(type, 4, 4) << 4;
|
||||||
}
|
}
|
||||||
@@ -335,7 +335,7 @@ static inline constexpr VarType GetVarMemType(VarType type)
|
|||||||
* @param type VarType holding information about the file-type
|
* @param type VarType holding information about the file-type
|
||||||
* @return the SLE_FILE_* part of a variable-type description
|
* @return the SLE_FILE_* part of a variable-type description
|
||||||
*/
|
*/
|
||||||
static inline VarType GetVarFileType(VarType type)
|
inline constexpr VarType GetVarFileType(VarType type)
|
||||||
{
|
{
|
||||||
return type & 0xF; // GB(type, 0, 4);
|
return type & 0xF; // GB(type, 0, 4);
|
||||||
}
|
}
|
||||||
@@ -345,7 +345,7 @@ static inline VarType GetVarFileType(VarType type)
|
|||||||
* @param conv the type to check
|
* @param conv the type to check
|
||||||
* @return True if it's a numeric type.
|
* @return True if it's a numeric type.
|
||||||
*/
|
*/
|
||||||
static inline constexpr bool IsNumericType(VarType conv)
|
inline constexpr bool IsNumericType(VarType conv)
|
||||||
{
|
{
|
||||||
return GetVarMemType(conv) <= SLE_VAR_U64;
|
return GetVarMemType(conv) <= SLE_VAR_U64;
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ static inline constexpr bool IsNumericType(VarType conv)
|
|||||||
* @param type VarType to get size of.
|
* @param type VarType to get size of.
|
||||||
* @return size of type in bytes.
|
* @return size of type in bytes.
|
||||||
*/
|
*/
|
||||||
static inline constexpr size_t SlVarSize(VarType type)
|
inline constexpr size_t SlVarSize(VarType type)
|
||||||
{
|
{
|
||||||
switch (GetVarMemType(type)) {
|
switch (GetVarMemType(type)) {
|
||||||
case SLE_VAR_BL: return sizeof(bool);
|
case SLE_VAR_BL: return sizeof(bool);
|
||||||
@@ -383,7 +383,7 @@ static inline constexpr size_t SlVarSize(VarType type)
|
|||||||
* @param size Actual size of variable.
|
* @param size Actual size of variable.
|
||||||
* @return true iff the sizes match.
|
* @return true iff the sizes match.
|
||||||
*/
|
*/
|
||||||
static inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t length, size_t size)
|
inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t length, size_t size)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SL_VAR: return SlVarSize(type) == size;
|
case SL_VAR: return SlVarSize(type) == size;
|
||||||
@@ -853,7 +853,7 @@ static inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size
|
|||||||
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
||||||
* @return Savegame version is earlier than the specified version.
|
* @return Savegame version is earlier than the specified version.
|
||||||
*/
|
*/
|
||||||
static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
|
inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
|
||||||
{
|
{
|
||||||
return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
|
return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
|
||||||
}
|
}
|
||||||
@@ -865,7 +865,7 @@ static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0
|
|||||||
* @param major Major number of the version to check against.
|
* @param major Major number of the version to check against.
|
||||||
* @return Savegame version is at most the specified version.
|
* @return Savegame version is at most the specified version.
|
||||||
*/
|
*/
|
||||||
static inline bool IsSavegameVersionBeforeOrAt(SaveLoadVersion major)
|
inline bool IsSavegameVersionBeforeOrAt(SaveLoadVersion major)
|
||||||
{
|
{
|
||||||
return _sl_version <= major;
|
return _sl_version <= major;
|
||||||
}
|
}
|
||||||
@@ -875,7 +875,7 @@ static inline bool IsSavegameVersionBeforeOrAt(SaveLoadVersion major)
|
|||||||
* everything else has a callback function that returns the address based
|
* everything else has a callback function that returns the address based
|
||||||
* on the saveload data and the current object for non-globals.
|
* on the saveload data and the current object for non-globals.
|
||||||
*/
|
*/
|
||||||
static inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
|
inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
|
||||||
{
|
{
|
||||||
/* Entry is a null-variable, mostly used to read old savegames etc. */
|
/* Entry is a null-variable, mostly used to read old savegames etc. */
|
||||||
if (GetVarMemType(sld.conv) == SLE_VAR_NULL) {
|
if (GetVarMemType(sld.conv) == SLE_VAR_NULL) {
|
||||||
|
@@ -1993,12 +1993,6 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
viewport_map->Add(new SettingEntry("gui.show_tunnels_on_map"));
|
viewport_map->Add(new SettingEntry("gui.show_tunnels_on_map"));
|
||||||
viewport_map->Add(new SettingEntry("gui.use_owner_colour_for_tunnelbridge"));
|
viewport_map->Add(new SettingEntry("gui.use_owner_colour_for_tunnelbridge"));
|
||||||
}
|
}
|
||||||
SettingsPage *viewport_signals = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VIEWPORT_SIGNALS));
|
|
||||||
{
|
|
||||||
viewport_signals->Add(new SettingEntry("construction.train_signal_side"));
|
|
||||||
viewport_signals->Add(new SettingEntry("gui.show_restricted_signal_recolour"));
|
|
||||||
viewport_signals->Add(new SettingEntry("gui.show_all_signal_default"));
|
|
||||||
}
|
|
||||||
SettingsPage *viewport_route_overlay = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY));
|
SettingsPage *viewport_route_overlay = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY));
|
||||||
{
|
{
|
||||||
viewport_route_overlay->Add(new SettingEntry("gui.show_vehicle_route_mode"));
|
viewport_route_overlay->Add(new SettingEntry("gui.show_vehicle_route_mode"));
|
||||||
@@ -2032,7 +2026,6 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
{
|
{
|
||||||
construction->Add(new SettingEntry("gui.link_terraform_toolbar"));
|
construction->Add(new SettingEntry("gui.link_terraform_toolbar"));
|
||||||
construction->Add(new SettingEntry("gui.persistent_buildingtools"));
|
construction->Add(new SettingEntry("gui.persistent_buildingtools"));
|
||||||
construction->Add(new SettingEntry("gui.quick_goto"));
|
|
||||||
construction->Add(new SettingEntry("gui.default_rail_type"));
|
construction->Add(new SettingEntry("gui.default_rail_type"));
|
||||||
construction->Add(new SettingEntry("gui.default_road_type"));
|
construction->Add(new SettingEntry("gui.default_road_type"));
|
||||||
construction->Add(new SettingEntry("gui.demolish_confirm_mode"));
|
construction->Add(new SettingEntry("gui.demolish_confirm_mode"));
|
||||||
@@ -2118,15 +2111,23 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
timetable->Add(new SettingEntry("gui.timetable_start_text_entry"));
|
timetable->Add(new SettingEntry("gui.timetable_start_text_entry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *advsig = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS));
|
SettingsPage *signals = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_SIGNALS));
|
||||||
{
|
{
|
||||||
advsig->Add(new SettingEntry("gui.show_progsig_ui"));
|
signals->Add(new SettingEntry("construction.train_signal_side"));
|
||||||
advsig->Add(new SettingEntry("gui.show_noentrysig_ui"));
|
signals->Add(new SettingEntry("gui.semaphore_build_before"));
|
||||||
advsig->Add(new SettingEntry("gui.show_adv_tracerestrict_features"));
|
signals->Add(new SettingEntry("gui.signal_gui_mode"));
|
||||||
advsig->Add(new SettingEntry("gui.adv_sig_bridge_tun_modes"));
|
signals->Add(new SettingEntry("gui.cycle_signal_types"));
|
||||||
|
signals->Add(new SettingEntry("gui.drag_signals_fixed_distance"));
|
||||||
|
signals->Add(new SettingEntry("gui.drag_signals_skip_stations"));
|
||||||
|
signals->Add(new SettingEntry("gui.auto_remove_signals"));
|
||||||
|
signals->Add(new SettingEntry("gui.show_restricted_signal_recolour"));
|
||||||
|
signals->Add(new SettingEntry("gui.show_all_signal_default"));
|
||||||
|
signals->Add(new SettingEntry("gui.show_progsig_ui"));
|
||||||
|
signals->Add(new SettingEntry("gui.show_noentrysig_ui"));
|
||||||
|
signals->Add(new SettingEntry("gui.show_adv_tracerestrict_features"));
|
||||||
|
signals->Add(new SettingEntry("gui.adv_sig_bridge_tun_modes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Add(new SettingEntry("gui.fast_forward_speed_limit"));
|
|
||||||
interface->Add(new SettingEntry("gui.toolbar_pos"));
|
interface->Add(new SettingEntry("gui.toolbar_pos"));
|
||||||
interface->Add(new SettingEntry("gui.statusbar_pos"));
|
interface->Add(new SettingEntry("gui.statusbar_pos"));
|
||||||
interface->Add(new SettingEntry("gui.prefer_teamchat"));
|
interface->Add(new SettingEntry("gui.prefer_teamchat"));
|
||||||
@@ -2163,14 +2164,6 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
|
|
||||||
SettingsPage *company = main->Add(new SettingsPage(STR_CONFIG_SETTING_COMPANY));
|
SettingsPage *company = main->Add(new SettingsPage(STR_CONFIG_SETTING_COMPANY));
|
||||||
{
|
{
|
||||||
company->Add(new SettingEntry("gui.semaphore_build_before"));
|
|
||||||
company->Add(new SettingEntry("gui.cycle_signal_types"));
|
|
||||||
company->Add(new SettingEntry("gui.signal_gui_mode"));
|
|
||||||
company->Add(new SettingEntry("gui.drag_signals_fixed_distance"));
|
|
||||||
company->Add(new SettingEntry("gui.drag_signals_skip_stations"));
|
|
||||||
company->Add(new SettingEntry("gui.auto_remove_signals"));
|
|
||||||
company->Add(new SettingEntry("gui.new_nonstop"));
|
|
||||||
company->Add(new SettingEntry("gui.stop_location"));
|
|
||||||
company->Add(new SettingEntry("gui.starting_colour"));
|
company->Add(new SettingEntry("gui.starting_colour"));
|
||||||
company->Add(new SettingEntry("gui.starting_colour_secondary"));
|
company->Add(new SettingEntry("gui.starting_colour_secondary"));
|
||||||
company->Add(new SettingEntry("company.engine_renew"));
|
company->Add(new SettingEntry("company.engine_renew"));
|
||||||
@@ -2237,6 +2230,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
|
|
||||||
SettingsPage *routing = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
|
SettingsPage *routing = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
|
||||||
{
|
{
|
||||||
|
routing->Add(new SettingEntry("vehicle.road_side"));
|
||||||
routing->Add(new SettingEntry("pf.pathfinder_for_trains"));
|
routing->Add(new SettingEntry("pf.pathfinder_for_trains"));
|
||||||
routing->Add(new SettingEntry("difficulty.line_reverse_mode"));
|
routing->Add(new SettingEntry("difficulty.line_reverse_mode"));
|
||||||
routing->Add(new SettingEntry("pf.reverse_at_signals"));
|
routing->Add(new SettingEntry("pf.reverse_at_signals"));
|
||||||
@@ -2248,9 +2242,14 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
routing->Add(new SettingEntry("vehicle.drive_through_train_depot"));
|
routing->Add(new SettingEntry("vehicle.drive_through_train_depot"));
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicles->Add(new SettingEntry("order.no_servicing_if_no_breakdowns"));
|
SettingsPage *orders = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ORDERS));
|
||||||
vehicles->Add(new SettingEntry("order.serviceathelipad"));
|
{
|
||||||
vehicles->Add(new SettingEntry("order.nonstop_only"));
|
orders->Add(new SettingEntry("gui.new_nonstop"));
|
||||||
|
orders->Add(new SettingEntry("gui.quick_goto"));
|
||||||
|
orders->Add(new SettingEntry("gui.stop_location"));
|
||||||
|
orders->Add(new SettingEntry("order.nonstop_only"));
|
||||||
|
}
|
||||||
|
|
||||||
vehicles->Add(new SettingEntry("vehicle.adjacent_crossings"));
|
vehicles->Add(new SettingEntry("vehicle.adjacent_crossings"));
|
||||||
vehicles->Add(new SettingEntry("vehicle.safer_crossings"));
|
vehicles->Add(new SettingEntry("vehicle.safer_crossings"));
|
||||||
vehicles->Add(new SettingEntry("vehicle.non_leading_engines_keep_name"));
|
vehicles->Add(new SettingEntry("vehicle.non_leading_engines_keep_name"));
|
||||||
@@ -2279,6 +2278,8 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
limitations->Add(new SettingEntry("vehicle.rail_depot_speed_limit"));
|
limitations->Add(new SettingEntry("vehicle.rail_depot_speed_limit"));
|
||||||
limitations->Add(new SettingEntry("station.station_spread"));
|
limitations->Add(new SettingEntry("station.station_spread"));
|
||||||
limitations->Add(new SettingEntry("station.distant_join_stations"));
|
limitations->Add(new SettingEntry("station.distant_join_stations"));
|
||||||
|
limitations->Add(new SettingEntry("station.modified_catchment"));
|
||||||
|
limitations->Add(new SettingEntry("station.catchment_increase"));
|
||||||
limitations->Add(new SettingEntry("construction.road_stop_on_town_road"));
|
limitations->Add(new SettingEntry("construction.road_stop_on_town_road"));
|
||||||
limitations->Add(new SettingEntry("construction.road_stop_on_competitor_road"));
|
limitations->Add(new SettingEntry("construction.road_stop_on_competitor_road"));
|
||||||
limitations->Add(new SettingEntry("construction.crossing_with_competitor"));
|
limitations->Add(new SettingEntry("construction.crossing_with_competitor"));
|
||||||
@@ -2304,12 +2305,14 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
{
|
{
|
||||||
disasters->Add(new SettingEntry("difficulty.disasters"));
|
disasters->Add(new SettingEntry("difficulty.disasters"));
|
||||||
disasters->Add(new SettingEntry("difficulty.economy"));
|
disasters->Add(new SettingEntry("difficulty.economy"));
|
||||||
|
disasters->Add(new SettingEntry("vehicle.plane_crashes"));
|
||||||
|
disasters->Add(new SettingEntry("vehicle.no_train_crash_other_company"));
|
||||||
disasters->Add(new SettingEntry("difficulty.vehicle_breakdowns"));
|
disasters->Add(new SettingEntry("difficulty.vehicle_breakdowns"));
|
||||||
disasters->Add(new SettingEntry("vehicle.improved_breakdowns"));
|
disasters->Add(new SettingEntry("vehicle.improved_breakdowns"));
|
||||||
disasters->Add(new SettingEntry("vehicle.pay_for_repair"));
|
disasters->Add(new SettingEntry("vehicle.pay_for_repair"));
|
||||||
disasters->Add(new SettingEntry("vehicle.repair_cost"));
|
disasters->Add(new SettingEntry("vehicle.repair_cost"));
|
||||||
disasters->Add(new SettingEntry("vehicle.plane_crashes"));
|
disasters->Add(new SettingEntry("order.no_servicing_if_no_breakdowns"));
|
||||||
disasters->Add(new SettingEntry("vehicle.no_train_crash_other_company"));
|
disasters->Add(new SettingEntry("order.serviceathelipad"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *genworld = main->Add(new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
|
SettingsPage *genworld = main->Add(new SettingsPage(STR_CONFIG_SETTING_GENWORLD));
|
||||||
@@ -2341,23 +2344,20 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
genworld->Add(new ConditionallyHiddenSettingEntry("game_creation.rainforest_line_height", rainforest_line_height_hide));
|
genworld->Add(new ConditionallyHiddenSettingEntry("game_creation.rainforest_line_height", rainforest_line_height_hide));
|
||||||
genworld->Add(new SettingEntry("game_creation.amount_of_rocks"));
|
genworld->Add(new SettingEntry("game_creation.amount_of_rocks"));
|
||||||
genworld->Add(new SettingEntry("game_creation.height_affects_rocks"));
|
genworld->Add(new SettingEntry("game_creation.height_affects_rocks"));
|
||||||
genworld->Add(new SettingEntry("game_creation.tree_placer"));
|
|
||||||
genworld->Add(new SettingEntry("vehicle.road_side"));
|
|
||||||
genworld->Add(new SettingEntry("economy.larger_towns"));
|
|
||||||
genworld->Add(new SettingEntry("economy.initial_city_size"));
|
|
||||||
genworld->Add(new SettingEntry("economy.town_layout"));
|
|
||||||
genworld->Add(new SettingEntry("economy.town_min_distance"));
|
|
||||||
genworld->Add(new SettingEntry("economy.max_town_heightlevel"));
|
|
||||||
genworld->Add(new SettingEntry("economy.min_town_land_area"));
|
|
||||||
genworld->Add(new SettingEntry("economy.min_city_land_area"));
|
|
||||||
genworld->Add(new SettingEntry("game_creation.build_public_roads"));
|
genworld->Add(new SettingEntry("game_creation.build_public_roads"));
|
||||||
genworld->Add(new SettingEntry("difficulty.industry_density"));
|
|
||||||
genworld->Add(new SettingEntry("gui.pause_on_newgame"));
|
|
||||||
genworld->Add(new SettingEntry("game_creation.ending_year"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *environment = main->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
|
SettingsPage *environment = main->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT));
|
||||||
{
|
{
|
||||||
|
SettingsPage *time = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TIME));
|
||||||
|
{
|
||||||
|
time->Add(new SettingEntry("game_creation.ending_year"));
|
||||||
|
time->Add(new SettingEntry("gui.pause_on_newgame"));
|
||||||
|
time->Add(new SettingEntry("gui.fast_forward_speed_limit"));
|
||||||
|
time->Add(new SettingEntry("economy.day_length_factor"));
|
||||||
|
time->Add(new SettingEntry("economy.tick_rate"));
|
||||||
|
}
|
||||||
|
|
||||||
SettingsPage *authorities = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
|
SettingsPage *authorities = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_AUTHORITIES));
|
||||||
{
|
{
|
||||||
authorities->Add(new SettingEntry("difficulty.town_council_tolerance"));
|
authorities->Add(new SettingEntry("difficulty.town_council_tolerance"));
|
||||||
@@ -2395,6 +2395,13 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
towns->Add(new SettingEntry("economy.town_build_tunnels"));
|
towns->Add(new SettingEntry("economy.town_build_tunnels"));
|
||||||
towns->Add(new SettingEntry("economy.town_max_road_slope"));
|
towns->Add(new SettingEntry("economy.town_max_road_slope"));
|
||||||
towns->Add(new SettingEntry("economy.found_town"));
|
towns->Add(new SettingEntry("economy.found_town"));
|
||||||
|
towns->Add(new SettingEntry("economy.town_layout"));
|
||||||
|
towns->Add(new SettingEntry("economy.larger_towns"));
|
||||||
|
towns->Add(new SettingEntry("economy.initial_city_size"));
|
||||||
|
towns->Add(new SettingEntry("economy.town_min_distance"));
|
||||||
|
towns->Add(new SettingEntry("economy.max_town_heightlevel"));
|
||||||
|
towns->Add(new SettingEntry("economy.min_town_land_area"));
|
||||||
|
towns->Add(new SettingEntry("economy.min_city_land_area"));
|
||||||
towns->Add(new SettingEntry("economy.town_cargogen_mode"));
|
towns->Add(new SettingEntry("economy.town_cargogen_mode"));
|
||||||
towns->Add(new SettingEntry("economy.town_cargo_scale_factor"));
|
towns->Add(new SettingEntry("economy.town_cargo_scale_factor"));
|
||||||
towns->Add(new SettingEntry("economy.random_road_reconstruction"));
|
towns->Add(new SettingEntry("economy.random_road_reconstruction"));
|
||||||
@@ -2402,6 +2409,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
|
|
||||||
SettingsPage *industries = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
|
SettingsPage *industries = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));
|
||||||
{
|
{
|
||||||
|
industries->Add(new SettingEntry("difficulty.industry_density"));
|
||||||
industries->Add(new SettingEntry("construction.raw_industry_construction"));
|
industries->Add(new SettingEntry("construction.raw_industry_construction"));
|
||||||
industries->Add(new SettingEntry("construction.industry_platform"));
|
industries->Add(new SettingEntry("construction.industry_platform"));
|
||||||
industries->Add(new SettingEntry("economy.multiple_industry_per_town"));
|
industries->Add(new SettingEntry("economy.multiple_industry_per_town"));
|
||||||
@@ -2435,23 +2443,21 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
cdist->Add(new SettingEntry("linkgraph.short_path_saturation"));
|
cdist->Add(new SettingEntry("linkgraph.short_path_saturation"));
|
||||||
cdist->Add(new SettingEntry("linkgraph.aircraft_link_scale"));
|
cdist->Add(new SettingEntry("linkgraph.aircraft_link_scale"));
|
||||||
}
|
}
|
||||||
SettingsPage *treedist = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TREES));
|
|
||||||
|
SettingsPage *trees = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_TREES));
|
||||||
{
|
{
|
||||||
treedist->Add(new SettingEntry("construction.extra_tree_placement"));
|
trees->Add(new SettingEntry("game_creation.tree_placer"));
|
||||||
treedist->Add(new SettingEntry("construction.trees_around_snow_line_enabled"));
|
trees->Add(new SettingEntry("construction.extra_tree_placement"));
|
||||||
treedist->Add(new SettingEntry("construction.trees_around_snow_line_range"));
|
trees->Add(new SettingEntry("construction.trees_around_snow_line_enabled"));
|
||||||
treedist->Add(new SettingEntry("construction.trees_around_snow_line_dynamic_range"));
|
trees->Add(new SettingEntry("construction.trees_around_snow_line_range"));
|
||||||
treedist->Add(new SettingEntry("construction.tree_growth_rate"));
|
trees->Add(new SettingEntry("construction.trees_around_snow_line_dynamic_range"));
|
||||||
|
trees->Add(new SettingEntry("construction.tree_growth_rate"));
|
||||||
}
|
}
|
||||||
|
|
||||||
environment->Add(new SettingEntry("construction.flood_from_edges"));
|
environment->Add(new SettingEntry("construction.flood_from_edges"));
|
||||||
environment->Add(new SettingEntry("construction.map_edge_mode"));
|
environment->Add(new SettingEntry("construction.map_edge_mode"));
|
||||||
environment->Add(new SettingEntry("economy.day_length_factor"));
|
|
||||||
environment->Add(new SettingEntry("station.modified_catchment"));
|
|
||||||
environment->Add(new SettingEntry("station.catchment_increase"));
|
|
||||||
environment->Add(new SettingEntry("station.cargo_class_rating_wait_time"));
|
environment->Add(new SettingEntry("station.cargo_class_rating_wait_time"));
|
||||||
environment->Add(new SettingEntry("station.station_size_rating_cargo_amount"));
|
environment->Add(new SettingEntry("station.station_size_rating_cargo_amount"));
|
||||||
environment->Add(new SettingEntry("economy.tick_rate"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI));
|
SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI));
|
||||||
|
@@ -911,7 +911,7 @@ extern VehicleDefaultSettings _old_vds;
|
|||||||
* Get the settings-object applicable for the current situation: the newgame settings
|
* Get the settings-object applicable for the current situation: the newgame settings
|
||||||
* when we're in the main menu and otherwise the settings of the current game.
|
* when we're in the main menu and otherwise the settings of the current game.
|
||||||
*/
|
*/
|
||||||
static inline GameSettings &GetGameSettings()
|
inline GameSettings &GetGameSettings()
|
||||||
{
|
{
|
||||||
return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
|
return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
extern uint8 _extra_aspects;
|
extern uint8 _extra_aspects;
|
||||||
extern uint64 _aspect_cfg_hash;
|
extern uint64 _aspect_cfg_hash;
|
||||||
|
|
||||||
static inline uint8 GetMaximumSignalAspect()
|
inline uint8 GetMaximumSignalAspect()
|
||||||
{
|
{
|
||||||
return _extra_aspects + 1;
|
return _extra_aspects + 1;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ extern bool _signal_sprite_oversized;
|
|||||||
* Maps a trackdir to the bit that stores its status in the map arrays, in the
|
* Maps a trackdir to the bit that stores its status in the map arrays, in the
|
||||||
* direction along with the trackdir.
|
* direction along with the trackdir.
|
||||||
*/
|
*/
|
||||||
static inline byte SignalAlongTrackdir(Trackdir trackdir)
|
inline byte SignalAlongTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
extern const byte _signal_along_trackdir[TRACKDIR_END];
|
extern const byte _signal_along_trackdir[TRACKDIR_END];
|
||||||
return _signal_along_trackdir[trackdir];
|
return _signal_along_trackdir[trackdir];
|
||||||
@@ -53,7 +53,7 @@ static inline byte SignalAlongTrackdir(Trackdir trackdir)
|
|||||||
* Maps a trackdir to the bit that stores its status in the map arrays, in the
|
* Maps a trackdir to the bit that stores its status in the map arrays, in the
|
||||||
* direction against the trackdir.
|
* direction against the trackdir.
|
||||||
*/
|
*/
|
||||||
static inline byte SignalAgainstTrackdir(Trackdir trackdir)
|
inline byte SignalAgainstTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
extern const byte _signal_against_trackdir[TRACKDIR_END];
|
extern const byte _signal_against_trackdir[TRACKDIR_END];
|
||||||
return _signal_against_trackdir[trackdir];
|
return _signal_against_trackdir[trackdir];
|
||||||
@@ -63,73 +63,73 @@ static inline byte SignalAgainstTrackdir(Trackdir trackdir)
|
|||||||
* Maps a Track to the bits that store the status of the two signals that can
|
* Maps a Track to the bits that store the status of the two signals that can
|
||||||
* be present on the given track.
|
* be present on the given track.
|
||||||
*/
|
*/
|
||||||
static inline byte SignalOnTrack(Track track)
|
inline byte SignalOnTrack(Track track)
|
||||||
{
|
{
|
||||||
extern const byte _signal_on_track[TRACK_END];
|
extern const byte _signal_on_track[TRACK_END];
|
||||||
return _signal_on_track[track];
|
return _signal_on_track[track];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is a given signal type a presignal entry signal?
|
/// Is a given signal type a presignal entry signal?
|
||||||
static inline bool IsEntrySignal(SignalType type)
|
inline bool IsEntrySignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_ENTRY || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
return type == SIGTYPE_ENTRY || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is a given signal type a presignal exit signal?
|
/// Is a given signal type a presignal exit signal?
|
||||||
static inline bool IsExitSignal(SignalType type)
|
inline bool IsExitSignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_EXIT || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
return type == SIGTYPE_EXIT || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is a given signal type a presignal combo signal?
|
/// Is a given signal type a presignal combo signal?
|
||||||
static inline bool IsComboSignal(SignalType type)
|
inline bool IsComboSignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
return type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is a given signal type a PBS signal?
|
/// Is a given signal type a PBS signal?
|
||||||
static inline bool IsPbsSignal(SignalType type)
|
inline bool IsPbsSignal(SignalType type)
|
||||||
{
|
{
|
||||||
return _settings_game.vehicle.train_braking_model == TBM_REALISTIC || type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY || type == SIGTYPE_NO_ENTRY;
|
return _settings_game.vehicle.train_braking_model == TBM_REALISTIC || type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY || type == SIGTYPE_NO_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is a given signal type a PBS signal?
|
/// Is a given signal type a PBS signal?
|
||||||
static inline bool IsPbsSignalNonExtended(SignalType type)
|
inline bool IsPbsSignalNonExtended(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY;
|
return type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a programmable pre-signal?
|
/// Is this a programmable pre-signal?
|
||||||
static inline bool IsProgrammableSignal(SignalType type)
|
inline bool IsProgrammableSignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_PROG;
|
return type == SIGTYPE_PROG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a programmable pre-signal?
|
/// Is this a programmable pre-signal?
|
||||||
static inline bool IsNoEntrySignal(SignalType type)
|
inline bool IsNoEntrySignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_NO_ENTRY;
|
return type == SIGTYPE_NO_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One-way signals can't be passed the 'wrong' way. */
|
/** One-way signals can't be passed the 'wrong' way. */
|
||||||
static inline bool IsOnewaySignal(SignalType type)
|
inline bool IsOnewaySignal(SignalType type)
|
||||||
{
|
{
|
||||||
return type != SIGTYPE_PBS && type != SIGTYPE_NO_ENTRY;
|
return type != SIGTYPE_PBS && type != SIGTYPE_NO_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this signal type unsuitable for realistic braking?
|
/// Is this signal type unsuitable for realistic braking?
|
||||||
static inline bool IsSignalTypeUnsuitableForRealisticBraking(SignalType type)
|
inline bool IsSignalTypeUnsuitableForRealisticBraking(SignalType type)
|
||||||
{
|
{
|
||||||
return type == SIGTYPE_ENTRY || type == SIGTYPE_EXIT || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
return type == SIGTYPE_ENTRY || type == SIGTYPE_EXIT || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Does a given signal have a PBS sprite?
|
/// Does a given signal have a PBS sprite?
|
||||||
static inline bool IsSignalSpritePBS(SignalType type)
|
inline bool IsSignalSpritePBS(SignalType type)
|
||||||
{
|
{
|
||||||
return type >= SIGTYPE_FIRST_PBS_SPRITE;
|
return type >= SIGTYPE_FIRST_PBS_SPRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SignalType NextSignalType(SignalType cur, uint which_signals)
|
inline SignalType NextSignalType(SignalType cur, uint which_signals)
|
||||||
{
|
{
|
||||||
bool pbs = true;
|
bool pbs = true;
|
||||||
bool block = (which_signals == SIGNAL_CYCLE_ALL);
|
bool block = (which_signals == SIGNAL_CYCLE_ALL);
|
||||||
|
@@ -102,13 +102,13 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks);
|
|||||||
bool LoadTTDMain(LoadgameState *ls);
|
bool LoadTTDMain(LoadgameState *ls);
|
||||||
bool LoadTTOMain(LoadgameState *ls);
|
bool LoadTTOMain(LoadgameState *ls);
|
||||||
|
|
||||||
static inline uint16 ReadUint16(LoadgameState *ls)
|
inline uint16_t ReadUint16(LoadgameState *ls)
|
||||||
{
|
{
|
||||||
byte x = ReadByte(ls);
|
byte x = ReadByte(ls);
|
||||||
return x | ReadByte(ls) << 8;
|
return x | ReadByte(ls) << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 ReadUint32(LoadgameState *ls)
|
inline uint32_t ReadUint32(LoadgameState *ls)
|
||||||
{
|
{
|
||||||
uint16 x = ReadUint16(ls);
|
uint16 x = ReadUint16(ls);
|
||||||
return x | ReadUint16(ls) << 16;
|
return x | ReadUint16(ls) << 16;
|
||||||
|
@@ -261,7 +261,7 @@ DECLARE_ENUM_AS_BIT_SET(SaveLoadChunkExtHeaderFlags)
|
|||||||
* @param type VarType holding information about the variable-type
|
* @param type VarType holding information about the variable-type
|
||||||
* @return the SLE_VAR_* part of a variable-type description
|
* @return the SLE_VAR_* part of a variable-type description
|
||||||
*/
|
*/
|
||||||
static inline constexpr VarType GetVarMemType(VarType type)
|
inline constexpr VarType GetVarMemType(VarType type)
|
||||||
{
|
{
|
||||||
return type & 0xF0; // GB(type, 4, 4) << 4;
|
return type & 0xF0; // GB(type, 4, 4) << 4;
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ static inline constexpr VarType GetVarMemType(VarType type)
|
|||||||
* @param type VarType holding information about the file-type
|
* @param type VarType holding information about the file-type
|
||||||
* @return the SLE_FILE_* part of a variable-type description
|
* @return the SLE_FILE_* part of a variable-type description
|
||||||
*/
|
*/
|
||||||
static inline constexpr VarType GetVarFileType(VarType type)
|
inline constexpr VarType GetVarFileType(VarType type)
|
||||||
{
|
{
|
||||||
return type & 0xF; // GB(type, 0, 4);
|
return type & 0xF; // GB(type, 0, 4);
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ public:
|
|||||||
* @param type VarType to get size of.
|
* @param type VarType to get size of.
|
||||||
* @return size of type in bytes.
|
* @return size of type in bytes.
|
||||||
*/
|
*/
|
||||||
static inline constexpr size_t SlVarSize(VarType type)
|
inline constexpr size_t SlVarSize(VarType type)
|
||||||
{
|
{
|
||||||
switch (GetVarMemType(type)) {
|
switch (GetVarMemType(type)) {
|
||||||
case SLE_VAR_BL:
|
case SLE_VAR_BL:
|
||||||
@@ -329,7 +329,7 @@ static inline constexpr size_t SlVarSize(VarType type)
|
|||||||
* matches with the actual variable size, for primitive types.
|
* matches with the actual variable size, for primitive types.
|
||||||
*/
|
*/
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
static inline constexpr bool SlCheckPrimitiveTypeVar(VarType type)
|
inline constexpr bool SlCheckPrimitiveTypeVar(VarType type)
|
||||||
{
|
{
|
||||||
using T = typename std::remove_reference<TYPE>::type;
|
using T = typename std::remove_reference<TYPE>::type;
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ static inline constexpr bool SlCheckPrimitiveTypeVar(VarType type)
|
|||||||
* matches with the actual variable size, for array types.
|
* matches with the actual variable size, for array types.
|
||||||
*/
|
*/
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
static inline constexpr bool SlCheckArrayTypeVar(VarType type, size_t length, bool top_level)
|
inline constexpr bool SlCheckArrayTypeVar(VarType type, size_t length, bool top_level)
|
||||||
{
|
{
|
||||||
using T = typename std::remove_reference<TYPE>::type;
|
using T = typename std::remove_reference<TYPE>::type;
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ static inline constexpr bool SlCheckArrayTypeVar(VarType type, size_t length, bo
|
|||||||
* matches with the actual variable size.
|
* matches with the actual variable size.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline constexpr bool SlCheckVar(SaveLoadType cmd, VarType type, size_t length)
|
inline constexpr bool SlCheckVar(SaveLoadType cmd, VarType type, size_t length)
|
||||||
{
|
{
|
||||||
if (GetVarMemType(type) == SLE_VAR_NULL) return true;
|
if (GetVarMemType(type) == SLE_VAR_NULL) return true;
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ static inline constexpr bool SlCheckVar(SaveLoadType cmd, VarType type, size_t l
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, SaveLoadType cmd, VarType type, size_t length>
|
template <typename T, SaveLoadType cmd, VarType type, size_t length>
|
||||||
static inline constexpr void *SlVarWrapper(void* ptr)
|
inline constexpr void *SlVarWrapper(void* ptr)
|
||||||
{
|
{
|
||||||
static_assert(SlCheckVar<T>(cmd, type, length));
|
static_assert(SlCheckVar<T>(cmd, type, length));
|
||||||
return ptr;
|
return ptr;
|
||||||
@@ -856,7 +856,7 @@ static inline constexpr void *SlVarWrapper(void* ptr)
|
|||||||
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
||||||
* @return Savegame version is earlier than the specified version.
|
* @return Savegame version is earlier than the specified version.
|
||||||
*/
|
*/
|
||||||
static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
|
inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
|
||||||
{
|
{
|
||||||
extern SaveLoadVersion _sl_version;
|
extern SaveLoadVersion _sl_version;
|
||||||
extern byte _sl_minor_version;
|
extern byte _sl_minor_version;
|
||||||
@@ -870,7 +870,7 @@ static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0
|
|||||||
* @param major Major number of the version to check against.
|
* @param major Major number of the version to check against.
|
||||||
* @return Savegame version is at most the specified version.
|
* @return Savegame version is at most the specified version.
|
||||||
*/
|
*/
|
||||||
static inline bool IsSavegameVersionUntil(SaveLoadVersion major)
|
inline bool IsSavegameVersionUntil(SaveLoadVersion major)
|
||||||
{
|
{
|
||||||
extern SaveLoadVersion _sl_version;
|
extern SaveLoadVersion _sl_version;
|
||||||
return _sl_version <= major;
|
return _sl_version <= major;
|
||||||
@@ -883,7 +883,7 @@ static inline bool IsSavegameVersionUntil(SaveLoadVersion major)
|
|||||||
* @param version_to Exclusive savegame version upper bound. SL_MAX_VERSION if no upper bound.
|
* @param version_to Exclusive savegame version upper bound. SL_MAX_VERSION if no upper bound.
|
||||||
* @return Active savegame version falls within the given range.
|
* @return Active savegame version falls within the given range.
|
||||||
*/
|
*/
|
||||||
static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to, SlXvFeatureTest ext_feature_test)
|
inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to, SlXvFeatureTest ext_feature_test)
|
||||||
{
|
{
|
||||||
extern const SaveLoadVersion SAVEGAME_VERSION;
|
extern const SaveLoadVersion SAVEGAME_VERSION;
|
||||||
if (!ext_feature_test.IsFeaturePresent(_sl_xv_feature_static_versions, SAVEGAME_VERSION, version_from, version_to)) return false;
|
if (!ext_feature_test.IsFeaturePresent(_sl_xv_feature_static_versions, SAVEGAME_VERSION, version_from, version_to)) return false;
|
||||||
@@ -896,7 +896,7 @@ static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLo
|
|||||||
* @param conv the type to check
|
* @param conv the type to check
|
||||||
* @return True if it's a numeric type.
|
* @return True if it's a numeric type.
|
||||||
*/
|
*/
|
||||||
static inline bool IsNumericType(VarType conv)
|
inline bool IsNumericType(VarType conv)
|
||||||
{
|
{
|
||||||
return GetVarMemType(conv) <= SLE_VAR_U64;
|
return GetVarMemType(conv) <= SLE_VAR_U64;
|
||||||
}
|
}
|
||||||
@@ -907,7 +907,7 @@ static inline bool IsNumericType(VarType conv)
|
|||||||
* is taken. If non-null only the offset is stored in the union and we need
|
* is taken. If non-null only the offset is stored in the union and we need
|
||||||
* to add this to the address of the object
|
* to add this to the address of the object
|
||||||
*/
|
*/
|
||||||
static inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
|
inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
|
||||||
{
|
{
|
||||||
/* Entry is a global address. */
|
/* Entry is a global address. */
|
||||||
if (sld.global) return sld.address;
|
if (sld.global) return sld.address;
|
||||||
|
@@ -73,7 +73,7 @@ static constexpr inline Slope RemoveHalftileSlope(Slope s)
|
|||||||
* @param s The #Slope to get the complement.
|
* @param s The #Slope to get the complement.
|
||||||
* @return a complement Slope of the given slope.
|
* @return a complement Slope of the given slope.
|
||||||
*/
|
*/
|
||||||
static inline Slope ComplementSlope(Slope s)
|
inline Slope ComplementSlope(Slope s)
|
||||||
{
|
{
|
||||||
dbg_assert(!IsSteepSlope(s) && !IsHalftileSlope(s));
|
dbg_assert(!IsSteepSlope(s) && !IsHalftileSlope(s));
|
||||||
return s ^ SLOPE_ELEVATED;
|
return s ^ SLOPE_ELEVATED;
|
||||||
@@ -85,7 +85,7 @@ static inline Slope ComplementSlope(Slope s)
|
|||||||
* @param s The #Slope
|
* @param s The #Slope
|
||||||
* @return true iff exactly one corner is raised
|
* @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);
|
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.
|
* @param corner The #Corner.
|
||||||
* @return The #Slope with corner "corner" raised.
|
* @return The #Slope with corner "corner" raised.
|
||||||
*/
|
*/
|
||||||
static inline Slope SlopeWithOneCornerRaised(Corner corner)
|
inline Slope SlopeWithOneCornerRaised(Corner corner)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidCorner(corner));
|
dbg_assert(IsValidCorner(corner));
|
||||||
return (Slope)(1 << corner);
|
return (Slope)(1 << corner);
|
||||||
@@ -110,7 +110,7 @@ static inline Slope SlopeWithOneCornerRaised(Corner corner)
|
|||||||
* @param s The #Slope.
|
* @param s The #Slope.
|
||||||
* @return true iff the slope has a highest corner.
|
* @return true iff the slope has a highest corner.
|
||||||
*/
|
*/
|
||||||
static inline bool HasSlopeHighestCorner(Slope s)
|
inline bool HasSlopeHighestCorner(Slope s)
|
||||||
{
|
{
|
||||||
s = RemoveHalftileSlope(s);
|
s = RemoveHalftileSlope(s);
|
||||||
return IsSteepSlope(s) || IsSlopeWithOneCornerRaised(s);
|
return IsSteepSlope(s) || IsSlopeWithOneCornerRaised(s);
|
||||||
@@ -123,7 +123,7 @@ static inline bool HasSlopeHighestCorner(Slope s)
|
|||||||
* @param s The #Slope.
|
* @param s The #Slope.
|
||||||
* @return Highest corner.
|
* @return Highest corner.
|
||||||
*/
|
*/
|
||||||
static inline Corner GetHighestSlopeCorner(Slope s)
|
inline Corner GetHighestSlopeCorner(Slope s)
|
||||||
{
|
{
|
||||||
switch (RemoveHalftileSlope(s)) {
|
switch (RemoveHalftileSlope(s)) {
|
||||||
case SLOPE_W:
|
case SLOPE_W:
|
||||||
@@ -181,7 +181,7 @@ static constexpr inline int GetSlopeMaxPixelZ(Slope s)
|
|||||||
* @param corner A #Corner.
|
* @param corner A #Corner.
|
||||||
* @return The opposite corner to "corner".
|
* @return The opposite corner to "corner".
|
||||||
*/
|
*/
|
||||||
static inline Corner OppositeCorner(Corner corner)
|
inline Corner OppositeCorner(Corner corner)
|
||||||
{
|
{
|
||||||
return (Corner)(corner ^ 2);
|
return (Corner)(corner ^ 2);
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ static inline Corner OppositeCorner(Corner corner)
|
|||||||
* @param s The #Slope
|
* @param s The #Slope
|
||||||
* @return true iff exactly three corners are raised
|
* @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));
|
return !IsHalftileSlope(s) && !IsSteepSlope(s) && IsSlopeWithOneCornerRaised(ComplementSlope(s));
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ static inline bool IsSlopeWithThreeCornersRaised(Slope s)
|
|||||||
* @param corner The #Corner.
|
* @param corner The #Corner.
|
||||||
* @return The #Slope with all corners but "corner" raised.
|
* @return The #Slope with all corners but "corner" raised.
|
||||||
*/
|
*/
|
||||||
static inline Slope SlopeWithThreeCornersRaised(Corner corner)
|
inline Slope SlopeWithThreeCornersRaised(Corner corner)
|
||||||
{
|
{
|
||||||
return ComplementSlope(SlopeWithOneCornerRaised(corner));
|
return ComplementSlope(SlopeWithOneCornerRaised(corner));
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ static inline Slope SlopeWithThreeCornersRaised(Corner corner)
|
|||||||
* @param corner A #Corner.
|
* @param corner A #Corner.
|
||||||
* @return The steep #Slope with "corner" as highest 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));
|
return SLOPE_STEEP | SlopeWithThreeCornersRaised(OppositeCorner(corner));
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ static inline Slope SteepSlope(Corner corner)
|
|||||||
* @param s The #Slope
|
* @param s The #Slope
|
||||||
* @return true iff the slope is inclined.
|
* @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);
|
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
|
* @param s A #Slope
|
||||||
* @return The direction the slope goes up in. Or INVALID_DIAGDIR if the slope is not an inclined 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) {
|
switch (s) {
|
||||||
case SLOPE_NE: return DIAGDIR_NE;
|
case SLOPE_NE: return DIAGDIR_NE;
|
||||||
@@ -253,7 +253,7 @@ static inline DiagDirection GetInclinedSlopeDirection(Slope s)
|
|||||||
* @param dir A #DiagDirection
|
* @param dir A #DiagDirection
|
||||||
* @return The #Slope that goes up in direction dir.
|
* @return The #Slope that goes up in direction dir.
|
||||||
*/
|
*/
|
||||||
static inline Slope InclinedSlope(DiagDirection dir)
|
inline Slope InclinedSlope(DiagDirection dir)
|
||||||
{
|
{
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case DIAGDIR_NE: return SLOPE_NE;
|
case DIAGDIR_NE: return SLOPE_NE;
|
||||||
@@ -284,7 +284,7 @@ static constexpr inline Slope HalftileSlope(Slope s, Corner corner)
|
|||||||
* @param f Maybe a #Foundation.
|
* @param f Maybe a #Foundation.
|
||||||
* @return true iff f is a foundation.
|
* @return true iff f is a foundation.
|
||||||
*/
|
*/
|
||||||
static inline bool IsFoundation(Foundation f)
|
inline bool IsFoundation(Foundation f)
|
||||||
{
|
{
|
||||||
return f != FOUNDATION_NONE;
|
return f != FOUNDATION_NONE;
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ static inline bool IsFoundation(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return true iff f is a leveled foundation.
|
* @return true iff f is a leveled foundation.
|
||||||
*/
|
*/
|
||||||
static inline bool IsLeveledFoundation(Foundation f)
|
inline bool IsLeveledFoundation(Foundation f)
|
||||||
{
|
{
|
||||||
return f == FOUNDATION_LEVELED;
|
return f == FOUNDATION_LEVELED;
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ static inline bool IsLeveledFoundation(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return true iff f is an inclined 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);
|
return (f == FOUNDATION_INCLINED_X) || (f == FOUNDATION_INCLINED_Y);
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ static inline bool IsInclinedFoundation(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return true iff f is a non-continuous 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);
|
return IsInsideMM(f, FOUNDATION_STEEP_BOTH, FOUNDATION_HALFTILE_N + 1);
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ static inline bool IsNonContinuousFoundation(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return The #Corner with track.
|
* @return The #Corner with track.
|
||||||
*/
|
*/
|
||||||
static inline Corner GetHalftileFoundationCorner(Foundation f)
|
inline Corner GetHalftileFoundationCorner(Foundation f)
|
||||||
{
|
{
|
||||||
dbg_assert(IsInsideMM(f, FOUNDATION_HALFTILE_W, FOUNDATION_HALFTILE_N + 1));
|
dbg_assert(IsInsideMM(f, FOUNDATION_HALFTILE_W, FOUNDATION_HALFTILE_N + 1));
|
||||||
return (Corner)(f - FOUNDATION_HALFTILE_W);
|
return (Corner)(f - FOUNDATION_HALFTILE_W);
|
||||||
@@ -342,7 +342,7 @@ static inline Corner GetHalftileFoundationCorner(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return true iff f is a special rail foundation for single horizontal/vertical track.
|
* @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);
|
return IsInsideMM(f, FOUNDATION_RAIL_W, FOUNDATION_RAIL_N + 1);
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ static inline bool IsSpecialRailFoundation(Foundation f)
|
|||||||
* @param f The #Foundation.
|
* @param f The #Foundation.
|
||||||
* @return The #Corner with track.
|
* @return The #Corner with track.
|
||||||
*/
|
*/
|
||||||
static inline Corner GetRailFoundationCorner(Foundation f)
|
inline Corner GetRailFoundationCorner(Foundation f)
|
||||||
{
|
{
|
||||||
dbg_assert(IsSpecialRailFoundation(f));
|
dbg_assert(IsSpecialRailFoundation(f));
|
||||||
return (Corner)(f - FOUNDATION_RAIL_W);
|
return (Corner)(f - FOUNDATION_RAIL_W);
|
||||||
@@ -366,7 +366,7 @@ static inline Corner GetRailFoundationCorner(Foundation f)
|
|||||||
* @param s The current #Slope.
|
* @param s The current #Slope.
|
||||||
* @return The needed #Foundation.
|
* @return The needed #Foundation.
|
||||||
*/
|
*/
|
||||||
static inline Foundation FlatteningFoundation(Slope s)
|
inline Foundation FlatteningFoundation(Slope s)
|
||||||
{
|
{
|
||||||
return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED);
|
return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED);
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@ static inline Foundation FlatteningFoundation(Slope s)
|
|||||||
* @param axis The #Axis.
|
* @param axis The #Axis.
|
||||||
* @return The needed #Foundation.
|
* @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);
|
return (axis == AXIS_X ? FOUNDATION_INCLINED_X : FOUNDATION_INCLINED_Y);
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ static inline Foundation InclinedFoundation(Axis axis)
|
|||||||
* @param corner The #Corner with the track.
|
* @param corner The #Corner with the track.
|
||||||
* @return The wanted #Foundation.
|
* @return The wanted #Foundation.
|
||||||
*/
|
*/
|
||||||
static inline Foundation HalftileFoundation(Corner corner)
|
inline Foundation HalftileFoundation(Corner corner)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidCorner(corner));
|
dbg_assert(IsValidCorner(corner));
|
||||||
return (Foundation)(FOUNDATION_HALFTILE_W + corner);
|
return (Foundation)(FOUNDATION_HALFTILE_W + corner);
|
||||||
@@ -400,7 +400,7 @@ static inline Foundation HalftileFoundation(Corner corner)
|
|||||||
* @param corner The #Corner with the track.
|
* @param corner The #Corner with the track.
|
||||||
* @return The wanted #Foundation.
|
* @return The wanted #Foundation.
|
||||||
*/
|
*/
|
||||||
static inline Foundation SpecialRailFoundation(Corner corner)
|
inline Foundation SpecialRailFoundation(Corner corner)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidCorner(corner));
|
dbg_assert(IsValidCorner(corner));
|
||||||
return (Foundation)(FOUNDATION_RAIL_W + corner);
|
return (Foundation)(FOUNDATION_RAIL_W + corner);
|
||||||
@@ -412,7 +412,7 @@ static inline Foundation SpecialRailFoundation(Corner corner)
|
|||||||
* @param s The #Slope to get the offset for.
|
* @param s The #Slope to get the offset for.
|
||||||
* @return The sprite offset for this #Slope.
|
* @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];
|
extern const byte _slope_to_sprite_offset[32];
|
||||||
return _slope_to_sprite_offset[s];
|
return _slope_to_sprite_offset[s];
|
||||||
|
@@ -47,7 +47,7 @@ struct AndOr {
|
|||||||
uint32 mand;
|
uint32 mand;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
|
inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
|
||||||
{
|
{
|
||||||
return (colour & mask->mand) | mask->mor;
|
return (colour & mask->mand) | mask->mor;
|
||||||
}
|
}
|
||||||
|
16
src/sprite.h
16
src/sprite.h
@@ -86,7 +86,7 @@ void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig
|
|||||||
* @param total_offset Spriteoffset from normal rail to current railtype.
|
* @param total_offset Spriteoffset from normal rail to current railtype.
|
||||||
* @param newgrf_offset Startsprite of the Action1 to use.
|
* @param newgrf_offset Startsprite of the Action1 to use.
|
||||||
*/
|
*/
|
||||||
static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
|
inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, total_offset, newgrf_offset, default_palette, false);
|
DrawCommonTileSeq(ti, dts, to, total_offset, newgrf_offset, default_palette, false);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSpri
|
|||||||
* @param total_offset Spriteoffset from normal rail to current railtype.
|
* @param total_offset Spriteoffset from normal rail to current railtype.
|
||||||
* @param newgrf_offset Startsprite of the Action1 to use.
|
* @param newgrf_offset Startsprite of the Action1 to use.
|
||||||
*/
|
*/
|
||||||
static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
|
inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeqInGUI(x, y, dts, total_offset, newgrf_offset, default_palette, false);
|
DrawCommonTileSeqInGUI(x, y, dts, total_offset, newgrf_offset, default_palette, false);
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts
|
|||||||
/**
|
/**
|
||||||
* Draw TTD sprite sequence on tile.
|
* Draw TTD sprite sequence on tile.
|
||||||
*/
|
*/
|
||||||
static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, PaletteID default_palette)
|
inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, 0, 0, default_palette, false);
|
DrawCommonTileSeq(ti, dts, to, 0, 0, default_palette, false);
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSpri
|
|||||||
/**
|
/**
|
||||||
* Draw TTD sprite sequence in GUI.
|
* Draw TTD sprite sequence in GUI.
|
||||||
*/
|
*/
|
||||||
static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
|
inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeqInGUI(x, y, dts, 0, 0, default_palette, false);
|
DrawCommonTileSeqInGUI(x, y, dts, 0, 0, default_palette, false);
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts
|
|||||||
* Draw NewGRF industrytile or house sprite layout
|
* Draw NewGRF industrytile or house sprite layout
|
||||||
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
||||||
*/
|
*/
|
||||||
static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32 stage, PaletteID default_palette)
|
inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32_t stage, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, 0, stage, default_palette, true);
|
DrawCommonTileSeq(ti, dts, to, 0, stage, default_palette, true);
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSp
|
|||||||
* Draw NewGRF object in GUI
|
* Draw NewGRF object in GUI
|
||||||
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
||||||
*/
|
*/
|
||||||
static inline void DrawNewGRFTileSeqInGUI(int x, int y, const DrawTileSprites *dts, uint32 stage, PaletteID default_palette)
|
inline void DrawNewGRFTileSeqInGUI(int x, int y, const DrawTileSprites *dts, uint32_t stage, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeqInGUI(x, y, dts, 0, stage, default_palette, true);
|
DrawCommonTileSeqInGUI(x, y, dts, 0, stage, default_palette, true);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ static inline void DrawNewGRFTileSeqInGUI(int x, int y, const DrawTileSprites *d
|
|||||||
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
||||||
* @return The palette to use
|
* @return The palette to use
|
||||||
*/
|
*/
|
||||||
static inline PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
inline PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
||||||
{
|
{
|
||||||
if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
||||||
return (pal != 0 ? pal : default_pal);
|
return (pal != 0 ? pal : default_pal);
|
||||||
@@ -165,7 +165,7 @@ static inline PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID p
|
|||||||
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
||||||
* @return The palette to use
|
* @return The palette to use
|
||||||
*/
|
*/
|
||||||
static inline PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
inline PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
||||||
{
|
{
|
||||||
if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
||||||
return (pal != 0 ? pal : default_pal);
|
return (pal != 0 ? pal : default_pal);
|
||||||
|
@@ -52,13 +52,13 @@ uint32 GetSpriteLocalID(SpriteID sprite);
|
|||||||
uint GetSpriteCountForFile(const std::string &filename, SpriteID begin, SpriteID end);
|
uint GetSpriteCountForFile(const std::string &filename, SpriteID begin, SpriteID end);
|
||||||
uint GetMaxSpriteID();
|
uint GetMaxSpriteID();
|
||||||
|
|
||||||
static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type, uint8 zoom_levels)
|
inline const Sprite *GetSprite(SpriteID sprite, SpriteType type, uint8 zoom_levels)
|
||||||
{
|
{
|
||||||
dbg_assert(type != SpriteType::Recolour);
|
dbg_assert(type != SpriteType::Recolour);
|
||||||
return (Sprite*)GetRawSprite(sprite, type, zoom_levels);
|
return (Sprite*)GetRawSprite(sprite, type, zoom_levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
|
inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
|
||||||
{
|
{
|
||||||
dbg_assert(type == SpriteType::Recolour);
|
dbg_assert(type == SpriteType::Recolour);
|
||||||
return (byte*)GetRawSprite(sprite, type, UINT8_MAX);
|
return (byte*)GetRawSprite(sprite, type, UINT8_MAX);
|
||||||
|
@@ -192,7 +192,7 @@ public:
|
|||||||
SpriteCache& operator=(SpriteCache &&other) = default;
|
SpriteCache& operator=(SpriteCache &&other) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool IsMapgenSpriteID(SpriteID sprite)
|
inline bool IsMapgenSpriteID(SpriteID sprite)
|
||||||
{
|
{
|
||||||
return IsInsideMM(sprite, SPR_MAPGEN_BEGIN, SPR_MAPGEN_END);
|
return IsInsideMM(sprite, SPR_MAPGEN_BEGIN, SPR_MAPGEN_END);
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ void FreeTrainStationPlatformReservation(const Train *v);
|
|||||||
* @param num Number of station tiles.
|
* @param num Number of station tiles.
|
||||||
* @return Total cost.
|
* @return Total cost.
|
||||||
*/
|
*/
|
||||||
static inline Money StationMaintenanceCost(uint32 num)
|
inline Money StationMaintenanceCost(uint32_t num)
|
||||||
{
|
{
|
||||||
return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
|
return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling.
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ typedef byte StationGfx; ///< Index of station graphics. @see _station_display_d
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return Station ID of the station at \a t
|
* @return Station ID of the station at \a t
|
||||||
*/
|
*/
|
||||||
static inline StationID GetStationIndex(TileIndex t)
|
inline StationID GetStationIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return (StationID)_m[t].m2;
|
return (StationID)_m[t].m2;
|
||||||
@@ -41,7 +41,7 @@ static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4; ///< The offset for the
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return the station type
|
* @return the station type
|
||||||
*/
|
*/
|
||||||
static inline StationType GetStationType(TileIndex t)
|
inline StationType GetStationType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return (StationType)GB(_me[t].m6, 3, 4);
|
return (StationType)GB(_me[t].m6, 3, 4);
|
||||||
@@ -53,7 +53,7 @@ static inline StationType GetStationType(TileIndex t)
|
|||||||
* @pre GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS
|
* @pre GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS
|
||||||
* @return the road stop type
|
* @return the road stop type
|
||||||
*/
|
*/
|
||||||
static inline RoadStopType GetRoadStopType(TileIndex t)
|
inline RoadStopType GetRoadStopType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS, t);
|
dbg_assert_tile(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS, t);
|
||||||
return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
||||||
@@ -65,7 +65,7 @@ static inline RoadStopType GetRoadStopType(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return the station graphics
|
* @return the station graphics
|
||||||
*/
|
*/
|
||||||
static inline StationGfx GetStationGfx(TileIndex t)
|
inline StationGfx GetStationGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return _m[t].m5;
|
return _m[t].m5;
|
||||||
@@ -77,7 +77,7 @@ static inline StationGfx GetStationGfx(TileIndex t)
|
|||||||
* @param gfx the new graphics
|
* @param gfx the new graphics
|
||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
*/
|
*/
|
||||||
static inline void SetStationGfx(TileIndex t, StationGfx gfx)
|
inline void SetStationGfx(TileIndex t, StationGfx gfx)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
_m[t].m5 = gfx;
|
_m[t].m5 = gfx;
|
||||||
@@ -89,7 +89,7 @@ static inline void SetStationGfx(TileIndex t, StationGfx gfx)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return true if and only if the tile is a rail station
|
* @return true if and only if the tile is a rail station
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailStation(TileIndex t)
|
inline bool IsRailStation(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_RAIL;
|
return GetStationType(t) == STATION_RAIL;
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ static inline bool IsRailStation(TileIndex t)
|
|||||||
* @param t the tile to get the information from
|
* @param t the tile to get the information from
|
||||||
* @return true if and only if the tile is a rail station
|
* @return true if and only if the tile is a rail station
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailStationTile(TileIndex t)
|
inline bool IsRailStationTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsRailStation(t);
|
return IsTileType(t, MP_STATION) && IsRailStation(t);
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ static inline bool IsRailStationTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return true if and only if the tile is a rail waypoint
|
* @return true if and only if the tile is a rail waypoint
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailWaypoint(TileIndex t)
|
inline bool IsRailWaypoint(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_WAYPOINT;
|
return GetStationType(t) == STATION_WAYPOINT;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ static inline bool IsRailWaypoint(TileIndex t)
|
|||||||
* @param t the tile to get the information from
|
* @param t the tile to get the information from
|
||||||
* @return true if and only if the tile is a rail waypoint
|
* @return true if and only if the tile is a rail waypoint
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailWaypointTile(TileIndex t)
|
inline bool IsRailWaypointTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsRailWaypoint(t);
|
return IsTileType(t, MP_STATION) && IsRailWaypoint(t);
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ static inline bool IsRailWaypointTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return true if and only if the tile has rail
|
* @return true if and only if the tile has rail
|
||||||
*/
|
*/
|
||||||
static inline bool HasStationRail(TileIndex t)
|
inline bool HasStationRail(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsRailStation(t) || IsRailWaypoint(t);
|
return IsRailStation(t) || IsRailWaypoint(t);
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ static inline bool HasStationRail(TileIndex t)
|
|||||||
* @param t the tile to check
|
* @param t the tile to check
|
||||||
* @return true if and only if the tile is a station tile and has rail
|
* @return true if and only if the tile is a station tile and has rail
|
||||||
*/
|
*/
|
||||||
static inline bool HasStationTileRail(TileIndex t)
|
inline bool HasStationTileRail(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && HasStationRail(t);
|
return IsTileType(t, MP_STATION) && HasStationRail(t);
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ static inline bool HasStationTileRail(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return true if and only if the tile is an airport
|
* @return true if and only if the tile is an airport
|
||||||
*/
|
*/
|
||||||
static inline bool IsAirport(TileIndex t)
|
inline bool IsAirport(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_AIRPORT;
|
return GetStationType(t) == STATION_AIRPORT;
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ static inline bool IsAirport(TileIndex t)
|
|||||||
* @param t the tile to get the information from
|
* @param t the tile to get the information from
|
||||||
* @return true if and only if the tile is an airport
|
* @return true if and only if the tile is an airport
|
||||||
*/
|
*/
|
||||||
static inline bool IsAirportTile(TileIndex t)
|
inline bool IsAirportTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsAirport(t);
|
return IsTileType(t, MP_STATION) && IsAirport(t);
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ bool IsHangar(TileIndex t);
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if station is a truck stop, \c false otherwise
|
* @return \c true if station is a truck stop, \c false otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool IsTruckStop(TileIndex t)
|
inline bool IsTruckStop(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_TRUCK;
|
return GetStationType(t) == STATION_TRUCK;
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ static inline bool IsTruckStop(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if station is a bus stop, \c false otherwise
|
* @return \c true if station is a bus stop, \c false otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool IsBusStop(TileIndex t)
|
inline bool IsBusStop(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_BUS;
|
return GetStationType(t) == STATION_BUS;
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ static inline bool IsBusStop(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if station is a road waypoint, \c false otherwise
|
* @return \c true if station is a road waypoint, \c false otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadWaypoint(TileIndex t)
|
inline bool IsRoadWaypoint(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_ROADWAYPOINT;
|
return GetStationType(t) == STATION_ROADWAYPOINT;
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ static inline bool IsRoadWaypoint(TileIndex t)
|
|||||||
* @param t the tile to get the information from
|
* @param t the tile to get the information from
|
||||||
* @return true if and only if the tile is a road waypoint
|
* @return true if and only if the tile is a road waypoint
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadWaypointTile(TileIndex t)
|
inline bool IsRoadWaypointTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsRoadWaypoint(t);
|
return IsTileType(t, MP_STATION) && IsRoadWaypoint(t);
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ static inline bool IsRoadWaypointTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if station at the tile is a bus stop, truck stop \c false otherwise
|
* @return \c true if station at the tile is a bus stop, truck stop \c false otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool IsStationRoadStop(TileIndex t)
|
inline bool IsStationRoadStop(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return IsTruckStop(t) || IsBusStop(t);
|
return IsTruckStop(t) || IsBusStop(t);
|
||||||
@@ -231,7 +231,7 @@ static inline bool IsStationRoadStop(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a station tile and a road stop
|
* @return \c true if the tile is a station tile and a road stop
|
||||||
*/
|
*/
|
||||||
static inline bool IsStationRoadStopTile(TileIndex t)
|
inline bool IsStationRoadStopTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsStationRoadStop(t);
|
return IsTileType(t, MP_STATION) && IsStationRoadStop(t);
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ static inline bool IsStationRoadStopTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if station at the tile is a bus stop, truck stop or road waypoint, \c false otherwise
|
* @return \c true if station at the tile is a bus stop, truck stop or road waypoint, \c false otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool IsAnyRoadStop(TileIndex t)
|
inline bool IsAnyRoadStop(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return IsTruckStop(t) || IsBusStop(t) || IsRoadWaypoint(t);
|
return IsTruckStop(t) || IsBusStop(t) || IsRoadWaypoint(t);
|
||||||
@@ -253,7 +253,7 @@ static inline bool IsAnyRoadStop(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a station tile and a road stop
|
* @return \c true if the tile is a station tile and a road stop
|
||||||
*/
|
*/
|
||||||
static inline bool IsAnyRoadStopTile(TileIndex t)
|
inline bool IsAnyRoadStopTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsAnyRoadStop(t);
|
return IsTileType(t, MP_STATION) && IsAnyRoadStop(t);
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ static inline bool IsAnyRoadStopTile(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a station tile and a bay road stop
|
* @return \c true if the tile is a station tile and a bay road stop
|
||||||
*/
|
*/
|
||||||
static inline bool IsBayRoadStopTile(TileIndex t)
|
inline bool IsBayRoadStopTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsAnyRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
|
return IsAnyRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ static inline bool IsBayRoadStopTile(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a station tile and a drive through road stop
|
* @return \c true if the tile is a station tile and a drive through road stop
|
||||||
*/
|
*/
|
||||||
static inline bool IsDriveThroughStopTile(TileIndex t)
|
inline bool IsDriveThroughStopTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsAnyRoadStopTile(t) && GetStationGfx(t) >= GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
|
return IsAnyRoadStopTile(t) && GetStationGfx(t) >= GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ static inline bool IsDriveThroughStopTile(TileIndex t)
|
|||||||
* @param t the tile to get the directions from
|
* @param t the tile to get the directions from
|
||||||
* @return the disallowed directions
|
* @return the disallowed directions
|
||||||
*/
|
*/
|
||||||
static inline DisallowedRoadDirections GetDriveThroughStopDisallowedRoadDirections(TileIndex t)
|
inline DisallowedRoadDirections GetDriveThroughStopDisallowedRoadDirections(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsDriveThroughStopTile(t), t);
|
dbg_assert_tile(IsDriveThroughStopTile(t), t);
|
||||||
return (DisallowedRoadDirections)GB(_m[t].m3, 0, 2);
|
return (DisallowedRoadDirections)GB(_m[t].m3, 0, 2);
|
||||||
@@ -294,7 +294,7 @@ static inline DisallowedRoadDirections GetDriveThroughStopDisallowedRoadDirectio
|
|||||||
* @param t the tile to set the directions for
|
* @param t the tile to set the directions for
|
||||||
* @param drd the disallowed directions
|
* @param drd the disallowed directions
|
||||||
*/
|
*/
|
||||||
static inline void SetDriveThroughStopDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
inline void SetDriveThroughStopDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsDriveThroughStopTile(t), t);
|
dbg_assert_tile(IsDriveThroughStopTile(t), t);
|
||||||
dbg_assert(drd < DRD_END);
|
dbg_assert(drd < DRD_END);
|
||||||
@@ -306,7 +306,7 @@ static inline void SetDriveThroughStopDisallowedRoadDirections(TileIndex t, Disa
|
|||||||
* @param tile The tile to query.
|
* @param tile The tile to query.
|
||||||
* @return The road decoration of the tile.
|
* @return The road decoration of the tile.
|
||||||
*/
|
*/
|
||||||
static inline Roadside GetRoadWaypointRoadside(TileIndex tile)
|
inline Roadside GetRoadWaypointRoadside(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRoadWaypointTile(tile), tile);
|
dbg_assert_tile(IsRoadWaypointTile(tile), tile);
|
||||||
return (Roadside)GB(_m[tile].m3, 2, 2);
|
return (Roadside)GB(_m[tile].m3, 2, 2);
|
||||||
@@ -317,7 +317,7 @@ static inline Roadside GetRoadWaypointRoadside(TileIndex tile)
|
|||||||
* @param tile The tile to change.
|
* @param tile The tile to change.
|
||||||
* @param s The new road decoration of the tile.
|
* @param s The new road decoration of the tile.
|
||||||
*/
|
*/
|
||||||
static inline void SetRoadWaypointRoadside(TileIndex tile, Roadside s)
|
inline void SetRoadWaypointRoadside(TileIndex tile, Roadside s)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRoadWaypointTile(tile), tile);
|
dbg_assert_tile(IsRoadWaypointTile(tile), tile);
|
||||||
SB(_m[tile].m3, 2, 2, s);
|
SB(_m[tile].m3, 2, 2, s);
|
||||||
@@ -328,7 +328,7 @@ static inline void SetRoadWaypointRoadside(TileIndex tile, Roadside s)
|
|||||||
* @param t The tile to query.
|
* @param t The tile to query.
|
||||||
* @return True if the tile has snow/desert.
|
* @return True if the tile has snow/desert.
|
||||||
*/
|
*/
|
||||||
static inline bool IsRoadWaypointOnSnowOrDesert(TileIndex t)
|
inline bool IsRoadWaypointOnSnowOrDesert(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRoadWaypointTile(t), t);
|
dbg_assert_tile(IsRoadWaypointTile(t), t);
|
||||||
return HasBit(_me[t].m8, 15);
|
return HasBit(_me[t].m8, 15);
|
||||||
@@ -338,7 +338,7 @@ static inline bool IsRoadWaypointOnSnowOrDesert(TileIndex t)
|
|||||||
* Toggle the snow/desert state of a road waypoint tile.
|
* Toggle the snow/desert state of a road waypoint tile.
|
||||||
* @param t The tile to change.
|
* @param t The tile to change.
|
||||||
*/
|
*/
|
||||||
static inline void ToggleRoadWaypointOnSnowOrDesert(TileIndex t)
|
inline void ToggleRoadWaypointOnSnowOrDesert(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRoadWaypointTile(t), t);
|
dbg_assert_tile(IsRoadWaypointTile(t), t);
|
||||||
ToggleBit(_me[t].m8, 15);
|
ToggleBit(_me[t].m8, 15);
|
||||||
@@ -352,7 +352,7 @@ StationGfx GetTranslatedAirportTileID(StationGfx gfx);
|
|||||||
* @pre IsAirport(t)
|
* @pre IsAirport(t)
|
||||||
* @return the station graphics
|
* @return the station graphics
|
||||||
*/
|
*/
|
||||||
static inline StationGfx GetAirportGfx(TileIndex t)
|
inline StationGfx GetAirportGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsAirport(t), t);
|
dbg_assert_tile(IsAirport(t), t);
|
||||||
return GetTranslatedAirportTileID(GetStationGfx(t));
|
return GetTranslatedAirportTileID(GetStationGfx(t));
|
||||||
@@ -364,7 +364,7 @@ static inline StationGfx GetAirportGfx(TileIndex t)
|
|||||||
* @pre IsAnyRoadStopTile(t)
|
* @pre IsAnyRoadStopTile(t)
|
||||||
* @return the direction of the entrance
|
* @return the direction of the entrance
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection GetRoadStopDir(TileIndex t)
|
inline DiagDirection GetRoadStopDir(TileIndex t)
|
||||||
{
|
{
|
||||||
StationGfx gfx = GetStationGfx(t);
|
StationGfx gfx = GetStationGfx(t);
|
||||||
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
||||||
@@ -381,7 +381,7 @@ static inline DiagDirection GetRoadStopDir(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if the tile is an oilrig tile
|
* @return \c true if the tile is an oilrig tile
|
||||||
*/
|
*/
|
||||||
static inline bool IsOilRig(TileIndex t)
|
inline bool IsOilRig(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_OILRIG;
|
return GetStationType(t) == STATION_OILRIG;
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ static inline bool IsOilRig(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if the tile is a dock
|
* @return \c true if the tile is a dock
|
||||||
*/
|
*/
|
||||||
static inline bool IsDock(TileIndex t)
|
inline bool IsDock(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_DOCK;
|
return GetStationType(t) == STATION_DOCK;
|
||||||
}
|
}
|
||||||
@@ -402,7 +402,7 @@ static inline bool IsDock(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a dock
|
* @return \c true if the tile is a dock
|
||||||
*/
|
*/
|
||||||
static inline bool IsDockTile(TileIndex t)
|
inline bool IsDockTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && GetStationType(t) == STATION_DOCK;
|
return IsTileType(t, MP_STATION) && GetStationType(t) == STATION_DOCK;
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ static inline bool IsDockTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return \c true if the tile is a buoy
|
* @return \c true if the tile is a buoy
|
||||||
*/
|
*/
|
||||||
static inline bool IsBuoy(TileIndex t)
|
inline bool IsBuoy(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_BUOY;
|
return GetStationType(t) == STATION_BUOY;
|
||||||
}
|
}
|
||||||
@@ -423,7 +423,7 @@ static inline bool IsBuoy(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is a buoy
|
* @return \c true if the tile is a buoy
|
||||||
*/
|
*/
|
||||||
static inline bool IsBuoyTile(TileIndex t)
|
inline bool IsBuoyTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsBuoy(t);
|
return IsTileType(t, MP_STATION) && IsBuoy(t);
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ static inline bool IsBuoyTile(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is an hangar
|
* @return \c true if the tile is an hangar
|
||||||
*/
|
*/
|
||||||
static inline bool IsHangarTile(TileIndex t)
|
inline bool IsHangarTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STATION) && IsHangar(t);
|
return IsTileType(t, MP_STATION) && IsHangar(t);
|
||||||
}
|
}
|
||||||
@@ -444,7 +444,7 @@ static inline bool IsHangarTile(TileIndex t)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile is blocked
|
* @return \c true if the tile is blocked
|
||||||
*/
|
*/
|
||||||
static inline bool IsStationTileBlocked(TileIndex t)
|
inline bool IsStationTileBlocked(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
return HasBit(_me[t].m6, 0);
|
return HasBit(_me[t].m6, 0);
|
||||||
@@ -456,7 +456,7 @@ static inline bool IsStationTileBlocked(TileIndex t)
|
|||||||
* @param t the station tile
|
* @param t the station tile
|
||||||
* @param b the blocked state
|
* @param b the blocked state
|
||||||
*/
|
*/
|
||||||
static inline void SetStationTileBlocked(TileIndex t, bool b)
|
inline void SetStationTileBlocked(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
SB(_me[t].m6, 0, 1, b ? 1 : 0);
|
SB(_me[t].m6, 0, 1, b ? 1 : 0);
|
||||||
@@ -468,7 +468,7 @@ static inline void SetStationTileBlocked(TileIndex t, bool b)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile can have catenary wires
|
* @return \c true if the tile can have catenary wires
|
||||||
*/
|
*/
|
||||||
static inline bool CanStationTileHaveWires(TileIndex t)
|
inline bool CanStationTileHaveWires(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
return HasBit(_me[t].m6, 1);
|
return HasBit(_me[t].m6, 1);
|
||||||
@@ -480,7 +480,7 @@ static inline bool CanStationTileHaveWires(TileIndex t)
|
|||||||
* @param t the station tile
|
* @param t the station tile
|
||||||
* @param b the catenary wires state
|
* @param b the catenary wires state
|
||||||
*/
|
*/
|
||||||
static inline void SetStationTileHaveWires(TileIndex t, bool b)
|
inline void SetStationTileHaveWires(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
SB(_me[t].m6, 1, 1, b ? 1 : 0);
|
SB(_me[t].m6, 1, 1, b ? 1 : 0);
|
||||||
@@ -492,7 +492,7 @@ static inline void SetStationTileHaveWires(TileIndex t, bool b)
|
|||||||
* @param t Tile to check
|
* @param t Tile to check
|
||||||
* @return \c true if the tile can have catenary pylons
|
* @return \c true if the tile can have catenary pylons
|
||||||
*/
|
*/
|
||||||
static inline bool CanStationTileHavePylons(TileIndex t)
|
inline bool CanStationTileHavePylons(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
return HasBit(_me[t].m6, 7);
|
return HasBit(_me[t].m6, 7);
|
||||||
@@ -504,7 +504,7 @@ static inline bool CanStationTileHavePylons(TileIndex t)
|
|||||||
* @param t the station tile
|
* @param t the station tile
|
||||||
* @param b the catenary pylons state
|
* @param b the catenary pylons state
|
||||||
*/
|
*/
|
||||||
static inline void SetStationTileHavePylons(TileIndex t, bool b)
|
inline void SetStationTileHavePylons(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert(HasStationRail(t));
|
||||||
SB(_me[t].m6, 7, 1, b ? 1 : 0);
|
SB(_me[t].m6, 7, 1, b ? 1 : 0);
|
||||||
@@ -516,7 +516,7 @@ static inline void SetStationTileHavePylons(TileIndex t, bool b)
|
|||||||
* @pre HasStationRail(t)
|
* @pre HasStationRail(t)
|
||||||
* @return The direction of the rails on tile \a t.
|
* @return The direction of the rails on tile \a t.
|
||||||
*/
|
*/
|
||||||
static inline Axis GetRailStationAxis(TileIndex t)
|
inline Axis GetRailStationAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationRail(t), t);
|
dbg_assert_tile(HasStationRail(t), t);
|
||||||
return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
|
return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
|
||||||
@@ -528,7 +528,7 @@ static inline Axis GetRailStationAxis(TileIndex t)
|
|||||||
* @pre HasStationRail(t)
|
* @pre HasStationRail(t)
|
||||||
* @return The rail track of the rails on tile \a t.
|
* @return The rail track of the rails on tile \a t.
|
||||||
*/
|
*/
|
||||||
static inline Track GetRailStationTrack(TileIndex t)
|
inline Track GetRailStationTrack(TileIndex t)
|
||||||
{
|
{
|
||||||
return AxisToTrack(GetRailStationAxis(t));
|
return AxisToTrack(GetRailStationAxis(t));
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ static inline Track GetRailStationTrack(TileIndex t)
|
|||||||
* @pre HasStationRail(t)
|
* @pre HasStationRail(t)
|
||||||
* @return The trackbits of the rails on tile \a t.
|
* @return The trackbits of the rails on tile \a t.
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetRailStationTrackBits(TileIndex t)
|
inline TrackBits GetRailStationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return AxisToTrackBits(GetRailStationAxis(t));
|
return AxisToTrackBits(GetRailStationAxis(t));
|
||||||
}
|
}
|
||||||
@@ -557,7 +557,7 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t)
|
|||||||
* @pre IsRailStationTile(station_tile)
|
* @pre IsRailStationTile(station_tile)
|
||||||
* @return true if the two tiles are compatible
|
* @return true if the two tiles are compatible
|
||||||
*/
|
*/
|
||||||
static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
|
inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRailStationTile(station_tile), station_tile);
|
dbg_assert_tile(IsRailStationTile(station_tile), station_tile);
|
||||||
return IsRailStationTile(test_tile) && !IsStationTileBlocked(test_tile) &&
|
return IsRailStationTile(test_tile) && !IsStationTileBlocked(test_tile) &&
|
||||||
@@ -572,7 +572,7 @@ static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex s
|
|||||||
* @param t the station tile
|
* @param t the station tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool HasStationReservation(TileIndex t)
|
inline bool HasStationReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationRail(t), t);
|
dbg_assert_tile(HasStationRail(t), t);
|
||||||
return HasBit(_me[t].m6, 2);
|
return HasBit(_me[t].m6, 2);
|
||||||
@@ -584,7 +584,7 @@ static inline bool HasStationReservation(TileIndex t)
|
|||||||
* @param t the station tile
|
* @param t the station tile
|
||||||
* @param b the reservation state
|
* @param b the reservation state
|
||||||
*/
|
*/
|
||||||
static inline void SetRailStationReservation(TileIndex t, bool b)
|
inline void SetRailStationReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationRail(t), t);
|
dbg_assert_tile(HasStationRail(t), t);
|
||||||
SB(_me[t].m6, 2, 1, b ? 1 : 0);
|
SB(_me[t].m6, 2, 1, b ? 1 : 0);
|
||||||
@@ -596,7 +596,7 @@ static inline void SetRailStationReservation(TileIndex t, bool b)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetStationReservationTrackBits(TileIndex t)
|
inline TrackBits GetStationReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE;
|
return HasStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
@@ -608,7 +608,7 @@ static inline TrackBits GetStationReservationTrackBits(TileIndex t)
|
|||||||
* @pre \a t is the land part of the dock
|
* @pre \a t is the land part of the dock
|
||||||
* @return The direction of the dock on tile \a t.
|
* @return The direction of the dock on tile \a t.
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection GetDockDirection(TileIndex t)
|
inline DiagDirection GetDockDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
StationGfx gfx = GetStationGfx(t);
|
StationGfx gfx = GetStationGfx(t);
|
||||||
dbg_assert_tile(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART, t);
|
dbg_assert_tile(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART, t);
|
||||||
@@ -618,7 +618,7 @@ static inline DiagDirection GetDockDirection(TileIndex t)
|
|||||||
/**
|
/**
|
||||||
* Check whether a dock tile is the tile on water.
|
* Check whether a dock tile is the tile on water.
|
||||||
*/
|
*/
|
||||||
static inline bool IsDockWaterPart(TileIndex t)
|
inline bool IsDockWaterPart(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsDockTile(t));
|
assert(IsDockTile(t));
|
||||||
StationGfx gfx = GetStationGfx(t);
|
StationGfx gfx = GetStationGfx(t);
|
||||||
@@ -631,7 +631,7 @@ static inline bool IsDockWaterPart(TileIndex t)
|
|||||||
* @pre HasStationTileRail(t)
|
* @pre HasStationTileRail(t)
|
||||||
* @return True if this station is part of a newgrf station.
|
* @return True if this station is part of a newgrf station.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCustomStationSpecIndex(TileIndex t)
|
inline bool IsCustomStationSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationTileRail(t), t);
|
dbg_assert_tile(HasStationTileRail(t), t);
|
||||||
return _m[t].m4 != 0;
|
return _m[t].m4 != 0;
|
||||||
@@ -643,7 +643,7 @@ static inline bool IsCustomStationSpecIndex(TileIndex t)
|
|||||||
* @param specindex The new spec.
|
* @param specindex The new spec.
|
||||||
* @pre HasStationTileRail(t)
|
* @pre HasStationTileRail(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationTileRail(t), t);
|
dbg_assert_tile(HasStationTileRail(t), t);
|
||||||
_m[t].m4 = specindex;
|
_m[t].m4 = specindex;
|
||||||
@@ -655,7 +655,7 @@ static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
|||||||
* @pre HasStationTileRail(t)
|
* @pre HasStationTileRail(t)
|
||||||
* @return The custom station spec of this tile.
|
* @return The custom station spec of this tile.
|
||||||
*/
|
*/
|
||||||
static inline uint GetCustomStationSpecIndex(TileIndex t)
|
inline uint GetCustomStationSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(HasStationTileRail(t), t);
|
dbg_assert_tile(HasStationTileRail(t), t);
|
||||||
return _m[t].m4;
|
return _m[t].m4;
|
||||||
@@ -667,7 +667,7 @@ static inline uint GetCustomStationSpecIndex(TileIndex t)
|
|||||||
* @pre IsAnyRoadStopTile(t)
|
* @pre IsAnyRoadStopTile(t)
|
||||||
* @return True if this station is part of a newgrf station.
|
* @return True if this station is part of a newgrf station.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCustomRoadStopSpecIndex(TileIndex t)
|
inline bool IsCustomRoadStopSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
||||||
return GB(_me[t].m8, 0, 6) != 0;
|
return GB(_me[t].m8, 0, 6) != 0;
|
||||||
@@ -679,7 +679,7 @@ static inline bool IsCustomRoadStopSpecIndex(TileIndex t)
|
|||||||
* @param specindex The new spec.
|
* @param specindex The new spec.
|
||||||
* @pre IsAnyRoadStopTile(t)
|
* @pre IsAnyRoadStopTile(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetCustomRoadStopSpecIndex(TileIndex t, byte specindex)
|
inline void SetCustomRoadStopSpecIndex(TileIndex t, byte specindex)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
||||||
SB(_me[t].m8, 0, 6, specindex);
|
SB(_me[t].m8, 0, 6, specindex);
|
||||||
@@ -691,7 +691,7 @@ static inline void SetCustomRoadStopSpecIndex(TileIndex t, byte specindex)
|
|||||||
* @pre IsAnyRoadStopTile(t)
|
* @pre IsAnyRoadStopTile(t)
|
||||||
* @return The custom station spec of this tile.
|
* @return The custom station spec of this tile.
|
||||||
*/
|
*/
|
||||||
static inline uint GetCustomRoadStopSpecIndex(TileIndex t)
|
inline uint GetCustomRoadStopSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
dbg_assert_tile(IsAnyRoadStopTile(t), t);
|
||||||
return GB(_me[t].m8, 0, 6);
|
return GB(_me[t].m8, 0, 6);
|
||||||
@@ -703,7 +703,7 @@ static inline uint GetCustomRoadStopSpecIndex(TileIndex t)
|
|||||||
* @param random_bits The random bits.
|
* @param random_bits The random bits.
|
||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
*/
|
*/
|
||||||
static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
SB(_m[t].m3, 4, 4, random_bits);
|
SB(_m[t].m3, 4, 4, random_bits);
|
||||||
@@ -715,7 +715,7 @@ static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
|||||||
* @pre IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_STATION)
|
||||||
* @return The random bits for this station tile.
|
* @return The random bits for this station tile.
|
||||||
*/
|
*/
|
||||||
static inline byte GetStationTileRandomBits(TileIndex t)
|
inline byte GetStationTileRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
dbg_assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return GB(_m[t].m3, 4, 4);
|
return GB(_m[t].m3, 4, 4);
|
||||||
@@ -730,7 +730,7 @@ static inline byte GetStationTileRandomBits(TileIndex t)
|
|||||||
* @param section the StationGfx to be used for this tile
|
* @param section the StationGfx to be used for this tile
|
||||||
* @param wc The water class of the station
|
* @param wc The water class of the station
|
||||||
*/
|
*/
|
||||||
static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section, WaterClass wc = WATER_CLASS_INVALID)
|
inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section, WaterClass wc = WATER_CLASS_INVALID)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_STATION);
|
SetTileType(t, MP_STATION);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
@@ -755,7 +755,7 @@ static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType
|
|||||||
* @param section the StationGfx to be used for this tile
|
* @param section the StationGfx to be used for this tile
|
||||||
* @param rt the railtype of this tile
|
* @param rt the railtype of this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
|
inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
|
||||||
{
|
{
|
||||||
MakeStation(t, o, sid, STATION_RAIL, section + a);
|
MakeStation(t, o, sid, STATION_RAIL, section + a);
|
||||||
SetRailType(t, rt);
|
SetRailType(t, rt);
|
||||||
@@ -771,7 +771,7 @@ static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a,
|
|||||||
* @param section the StationGfx to be used for this tile
|
* @param section the StationGfx to be used for this tile
|
||||||
* @param rt the railtype of this tile
|
* @param rt the railtype of this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
|
inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
|
||||||
{
|
{
|
||||||
MakeStation(t, o, sid, STATION_WAYPOINT, section + a);
|
MakeStation(t, o, sid, STATION_WAYPOINT, section + a);
|
||||||
SetRailType(t, rt);
|
SetRailType(t, rt);
|
||||||
@@ -788,7 +788,7 @@ static inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a,
|
|||||||
* @param tram_rt the tram roadtype on this tile
|
* @param tram_rt the tram roadtype on this tile
|
||||||
* @param d the direction of the roadstop
|
* @param d the direction of the roadstop
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadType road_rt, RoadType tram_rt, DiagDirection d)
|
inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadType road_rt, RoadType tram_rt, DiagDirection d)
|
||||||
{
|
{
|
||||||
MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d);
|
MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d);
|
||||||
SetRoadTypes(t, road_rt, tram_rt);
|
SetRoadTypes(t, road_rt, tram_rt);
|
||||||
@@ -808,7 +808,7 @@ static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopTyp
|
|||||||
* @param tram_rt the tram roadtype on this tile
|
* @param tram_rt the tram roadtype on this tile
|
||||||
* @param a the direction of the roadstop
|
* @param a the direction of the roadstop
|
||||||
*/
|
*/
|
||||||
static inline void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner road, Owner tram, StationID sid, StationType rst, RoadType road_rt, RoadType tram_rt, Axis a)
|
inline void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner road, Owner tram, StationID sid, StationType rst, RoadType road_rt, RoadType tram_rt, Axis a)
|
||||||
{
|
{
|
||||||
MakeStation(t, station, sid, rst, GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
|
MakeStation(t, station, sid, rst, GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
|
||||||
SetRoadTypes(t, road_rt, tram_rt);
|
SetRoadTypes(t, road_rt, tram_rt);
|
||||||
@@ -824,7 +824,7 @@ static inline void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner ro
|
|||||||
* @param section the StationGfx to be used for this tile
|
* @param section the StationGfx to be used for this tile
|
||||||
* @param wc the type of water on this tile
|
* @param wc the type of water on this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc)
|
inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc)
|
||||||
{
|
{
|
||||||
MakeStation(t, o, sid, STATION_AIRPORT, section, wc);
|
MakeStation(t, o, sid, STATION_AIRPORT, section, wc);
|
||||||
}
|
}
|
||||||
@@ -835,7 +835,7 @@ static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section
|
|||||||
* @param sid the station to which this tile belongs
|
* @param sid the station to which this tile belongs
|
||||||
* @param wc the type of water on this tile
|
* @param wc the type of water on this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc)
|
inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc)
|
||||||
{
|
{
|
||||||
/* Make the owner of the buoy tile the same as the current owner of the
|
/* Make the owner of the buoy tile the same as the current owner of the
|
||||||
* water tile. In this way, we can reset the owner of the water to its
|
* water tile. In this way, we can reset the owner of the water to its
|
||||||
@@ -851,7 +851,7 @@ static inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc)
|
|||||||
* @param d the direction of the dock
|
* @param d the direction of the dock
|
||||||
* @param wc the type of water on this tile
|
* @param wc the type of water on this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
|
inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
|
||||||
{
|
{
|
||||||
MakeStation(t, o, sid, STATION_DOCK, d);
|
MakeStation(t, o, sid, STATION_DOCK, d);
|
||||||
MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
|
MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
|
||||||
@@ -863,7 +863,7 @@ static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d
|
|||||||
* @param sid the station to which this tile belongs
|
* @param sid the station to which this tile belongs
|
||||||
* @param wc the type of water on this tile
|
* @param wc the type of water on this tile
|
||||||
*/
|
*/
|
||||||
static inline void MakeOilrig(TileIndex t, StationID sid, WaterClass wc)
|
inline void MakeOilrig(TileIndex t, StationID sid, WaterClass wc)
|
||||||
{
|
{
|
||||||
MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0, wc);
|
MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0, wc);
|
||||||
}
|
}
|
||||||
|
@@ -490,7 +490,7 @@ const char *assert_tile_info(uint32 tile);
|
|||||||
* Version of the standard free that accepts const pointers.
|
* Version of the standard free that accepts const pointers.
|
||||||
* @param ptr The data to free.
|
* @param ptr The data to free.
|
||||||
*/
|
*/
|
||||||
static inline void free(const void *ptr)
|
inline void free(const void *ptr)
|
||||||
{
|
{
|
||||||
free(const_cast<void *>(ptr));
|
free(const_cast<void *>(ptr));
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,7 @@ struct CaseInsensitiveComparator {
|
|||||||
* @return true if the buffer starts with the terminating null-character or
|
* @return true if the buffer starts with the terminating null-character or
|
||||||
* if the given pointer points to nullptr else return false
|
* if the given pointer points to nullptr else return false
|
||||||
*/
|
*/
|
||||||
static inline bool StrEmpty(const char *s)
|
inline bool StrEmpty(const char *s)
|
||||||
{
|
{
|
||||||
return s == nullptr || s[0] == '\0';
|
return s == nullptr || s[0] == '\0';
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ static inline bool StrEmpty(const char *s)
|
|||||||
* @param maxlen The maximum size of the buffer
|
* @param maxlen The maximum size of the buffer
|
||||||
* @return The length of the string
|
* @return The length of the string
|
||||||
*/
|
*/
|
||||||
static inline size_t ttd_strnlen(const char *str, size_t maxlen)
|
inline size_t ttd_strnlen(const char *str, size_t maxlen)
|
||||||
{
|
{
|
||||||
const char *t;
|
const char *t;
|
||||||
for (t = str; (size_t)(t - str) < maxlen && *t != '\0'; t++) {}
|
for (t = str; (size_t)(t - str) < maxlen && *t != '\0'; t++) {}
|
||||||
@@ -124,7 +124,7 @@ size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, char32_t c);
|
|||||||
size_t Utf8TrimString(char *s, size_t maxlen);
|
size_t Utf8TrimString(char *s, size_t maxlen);
|
||||||
|
|
||||||
|
|
||||||
static inline char32_t Utf8Consume(const char **s)
|
inline char32_t Utf8Consume(const char **s)
|
||||||
{
|
{
|
||||||
char32_t c;
|
char32_t c;
|
||||||
*s += Utf8Decode(&c, *s);
|
*s += Utf8Decode(&c, *s);
|
||||||
@@ -132,7 +132,7 @@ static inline char32_t Utf8Consume(const char **s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Titr>
|
template <class Titr>
|
||||||
static inline char32_t Utf8Consume(Titr &s)
|
inline char32_t Utf8Consume(Titr &s)
|
||||||
{
|
{
|
||||||
char32_t c;
|
char32_t c;
|
||||||
s += Utf8Decode(&c, &*s);
|
s += Utf8Decode(&c, &*s);
|
||||||
@@ -144,7 +144,7 @@ static inline char32_t Utf8Consume(Titr &s)
|
|||||||
* @param c Unicode character.
|
* @param c Unicode character.
|
||||||
* @return Length of UTF-8 encoding for character.
|
* @return Length of UTF-8 encoding for character.
|
||||||
*/
|
*/
|
||||||
static inline int8_t Utf8CharLen(char32_t c)
|
inline int8_t Utf8CharLen(char32_t c)
|
||||||
{
|
{
|
||||||
if (c < 0x80) return 1;
|
if (c < 0x80) return 1;
|
||||||
if (c < 0x800) return 2;
|
if (c < 0x800) return 2;
|
||||||
@@ -163,7 +163,7 @@ static inline int8_t Utf8CharLen(char32_t c)
|
|||||||
* @param c char to query length of
|
* @param c char to query length of
|
||||||
* @return requested size
|
* @return requested size
|
||||||
*/
|
*/
|
||||||
static inline int8_t Utf8EncodedCharLen(char c)
|
inline int8_t Utf8EncodedCharLen(char c)
|
||||||
{
|
{
|
||||||
if (GB(c, 3, 5) == 0x1E) return 4;
|
if (GB(c, 3, 5) == 0x1E) return 4;
|
||||||
if (GB(c, 4, 4) == 0x0E) return 3;
|
if (GB(c, 4, 4) == 0x0E) return 3;
|
||||||
@@ -176,7 +176,7 @@ static inline int8_t Utf8EncodedCharLen(char c)
|
|||||||
|
|
||||||
|
|
||||||
/* Check if the given character is part of a UTF8 sequence */
|
/* Check if the given character is part of a UTF8 sequence */
|
||||||
static inline bool IsUtf8Part(char c)
|
inline bool IsUtf8Part(char c)
|
||||||
{
|
{
|
||||||
return GB(c, 6, 2) == 2;
|
return GB(c, 6, 2) == 2;
|
||||||
}
|
}
|
||||||
@@ -188,14 +188,14 @@ static inline bool IsUtf8Part(char c)
|
|||||||
* @note The function should not be used to determine the length of the previous
|
* @note The function should not be used to determine the length of the previous
|
||||||
* encoded char because it might be an invalid/corrupt start-sequence
|
* encoded char because it might be an invalid/corrupt start-sequence
|
||||||
*/
|
*/
|
||||||
static inline char *Utf8PrevChar(char *s)
|
inline char *Utf8PrevChar(char *s)
|
||||||
{
|
{
|
||||||
char *ret = s;
|
char *ret = s;
|
||||||
while (IsUtf8Part(*--ret)) {}
|
while (IsUtf8Part(*--ret)) {}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *Utf8PrevChar(const char *s)
|
inline const char *Utf8PrevChar(const char *s)
|
||||||
{
|
{
|
||||||
const char *ret = s;
|
const char *ret = s;
|
||||||
while (IsUtf8Part(*--ret)) {}
|
while (IsUtf8Part(*--ret)) {}
|
||||||
@@ -210,7 +210,7 @@ size_t Utf8StringLength(const std::string &str);
|
|||||||
* @param c The character to test.
|
* @param c The character to test.
|
||||||
* @return True if the character is a lead surrogate code point.
|
* @return True if the character is a lead surrogate code point.
|
||||||
*/
|
*/
|
||||||
static inline bool Utf16IsLeadSurrogate(uint c)
|
inline bool Utf16IsLeadSurrogate(uint c)
|
||||||
{
|
{
|
||||||
return c >= 0xD800 && c <= 0xDBFF;
|
return c >= 0xD800 && c <= 0xDBFF;
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ static inline bool Utf16IsLeadSurrogate(uint c)
|
|||||||
* @param c The character to test.
|
* @param c The character to test.
|
||||||
* @return True if the character is a lead surrogate code point.
|
* @return True if the character is a lead surrogate code point.
|
||||||
*/
|
*/
|
||||||
static inline bool Utf16IsTrailSurrogate(uint c)
|
inline bool Utf16IsTrailSurrogate(uint c)
|
||||||
{
|
{
|
||||||
return c >= 0xDC00 && c <= 0xDFFF;
|
return c >= 0xDC00 && c <= 0xDFFF;
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ static inline bool Utf16IsTrailSurrogate(uint c)
|
|||||||
* @param trail Trail surrogate code point.
|
* @param trail Trail surrogate code point.
|
||||||
* @return Decoded Unicode character.
|
* @return Decoded Unicode character.
|
||||||
*/
|
*/
|
||||||
static inline char32_t Utf16DecodeSurrogate(uint lead, uint trail)
|
inline char32_t Utf16DecodeSurrogate(uint lead, uint trail)
|
||||||
{
|
{
|
||||||
return 0x10000 + (((lead - 0xD800) << 10) | (trail - 0xDC00));
|
return 0x10000 + (((lead - 0xD800) << 10) | (trail - 0xDC00));
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ static inline char32_t Utf16DecodeSurrogate(uint lead, uint trail)
|
|||||||
* @param c Pointer to one or two UTF-16 code points.
|
* @param c Pointer to one or two UTF-16 code points.
|
||||||
* @return Decoded Unicode character.
|
* @return Decoded Unicode character.
|
||||||
*/
|
*/
|
||||||
static inline char32_t Utf16DecodeChar(const uint16_t *c)
|
inline char32_t Utf16DecodeChar(const uint16_t *c)
|
||||||
{
|
{
|
||||||
if (Utf16IsLeadSurrogate(c[0])) {
|
if (Utf16IsLeadSurrogate(c[0])) {
|
||||||
return Utf16DecodeSurrogate(c[0], c[1]);
|
return Utf16DecodeSurrogate(c[0], c[1]);
|
||||||
@@ -256,7 +256,7 @@ static inline char32_t Utf16DecodeChar(const uint16_t *c)
|
|||||||
* @return true iff the character is used to influence
|
* @return true iff the character is used to influence
|
||||||
* the text direction.
|
* the text direction.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTextDirectionChar(char32_t c)
|
inline bool IsTextDirectionChar(char32_t c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case CHAR_TD_LRM:
|
case CHAR_TD_LRM:
|
||||||
@@ -273,7 +273,7 @@ static inline bool IsTextDirectionChar(char32_t c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPrintable(char32_t c)
|
inline bool IsPrintable(char32_t c)
|
||||||
{
|
{
|
||||||
if (c < 0x20) return false;
|
if (c < 0x20) return false;
|
||||||
if (c < 0xE000) return true;
|
if (c < 0xE000) return true;
|
||||||
@@ -288,7 +288,7 @@ static inline bool IsPrintable(char32_t c)
|
|||||||
* @return a boolean value whether 'c' is a whitespace character or not
|
* @return a boolean value whether 'c' is a whitespace character or not
|
||||||
* @see http://www.fileformat.info/info/unicode/category/Zs/list.htm
|
* @see http://www.fileformat.info/info/unicode/category/Zs/list.htm
|
||||||
*/
|
*/
|
||||||
static inline bool IsWhitespace(char32_t c)
|
inline bool IsWhitespace(char32_t c)
|
||||||
{
|
{
|
||||||
return c == 0x0020 /* SPACE */ || c == 0x3000; /* IDEOGRAPHIC SPACE */
|
return c == 0x0020 /* SPACE */ || c == 0x3000; /* IDEOGRAPHIC SPACE */
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
static inline void StrMakeValidInPlace(std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK)
|
inline void StrMakeValidInPlace(std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK)
|
||||||
{
|
{
|
||||||
if (str.empty()) return;
|
if (str.empty()) return;
|
||||||
char *buf = str.data();
|
char *buf = str.data();
|
||||||
|
@@ -28,7 +28,7 @@ extern ArrayStringParameters<20> _global_string_params;
|
|||||||
* @param str String identifier
|
* @param str String identifier
|
||||||
* @return StringTab from \a str
|
* @return StringTab from \a str
|
||||||
*/
|
*/
|
||||||
static inline StringTab GetStringTab(StringID str)
|
inline StringTab GetStringTab(StringID str)
|
||||||
{
|
{
|
||||||
StringTab result = (StringTab)(str >> TAB_SIZE_BITS);
|
StringTab result = (StringTab)(str >> TAB_SIZE_BITS);
|
||||||
if (result >= TEXT_TAB_NEWGRF_START) return TEXT_TAB_NEWGRF_START;
|
if (result >= TEXT_TAB_NEWGRF_START) return TEXT_TAB_NEWGRF_START;
|
||||||
@@ -41,7 +41,7 @@ static inline StringTab GetStringTab(StringID str)
|
|||||||
* @param str String identifier
|
* @param str String identifier
|
||||||
* @return StringIndex from \a str
|
* @return StringIndex from \a str
|
||||||
*/
|
*/
|
||||||
static inline uint GetStringIndex(StringID str)
|
inline uint GetStringIndex(StringID str)
|
||||||
{
|
{
|
||||||
return str - (GetStringTab(str) << TAB_SIZE_BITS);
|
return str - (GetStringTab(str) << TAB_SIZE_BITS);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ static inline uint GetStringIndex(StringID str)
|
|||||||
* @param index StringIndex
|
* @param index StringIndex
|
||||||
* @return StringID composed from \a tab and \a index
|
* @return StringID composed from \a tab and \a index
|
||||||
*/
|
*/
|
||||||
static inline StringID MakeStringID(StringTab tab, uint index)
|
inline StringID MakeStringID(StringTab tab, uint index)
|
||||||
{
|
{
|
||||||
if (tab == TEXT_TAB_NEWGRF_START) {
|
if (tab == TEXT_TAB_NEWGRF_START) {
|
||||||
assert(index < TAB_SIZE_NEWGRF);
|
assert(index < TAB_SIZE_NEWGRF);
|
||||||
@@ -78,7 +78,7 @@ uint ConvertDisplaySpeedToKmhishSpeed(uint speed, VehicleType type);
|
|||||||
* @param type Type of vehicle for parameter.
|
* @param type Type of vehicle for parameter.
|
||||||
* @return Bit-packed velocity and vehicle type, for use with SetDParam().
|
* @return Bit-packed velocity and vehicle type, for use with SetDParam().
|
||||||
*/
|
*/
|
||||||
static inline int64 PackVelocity(uint speed, VehicleType type)
|
inline int64_t PackVelocity(uint speed, VehicleType type)
|
||||||
{
|
{
|
||||||
/* Vehicle type is a byte, so packed into the top 8 bits of the 64-bit
|
/* Vehicle type is a byte, so packed into the top 8 bits of the 64-bit
|
||||||
* parameter, although only values from 0-3 are relevant. */
|
* parameter, although only values from 0-3 are relevant. */
|
||||||
@@ -93,7 +93,7 @@ WChar GetDecimalSeparatorChar();
|
|||||||
* @param v Value of the string parameter.
|
* @param v Value of the string parameter.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline void SetDParam(size_t n, T &&v) {
|
inline void SetDParam(size_t n, T &&v) {
|
||||||
_global_string_params.SetParam(n, std::forward<T>(v));
|
_global_string_params.SetParam(n, std::forward<T>(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ bool HaveDParamChanged(const std::vector<StringParameterBackup> &backup);
|
|||||||
* @param n Index of the string parameter.
|
* @param n Index of the string parameter.
|
||||||
* @return Value of the requested string parameter.
|
* @return Value of the requested string parameter.
|
||||||
*/
|
*/
|
||||||
static inline uint64 GetDParam(size_t n)
|
inline uint64 GetDParam(size_t n)
|
||||||
{
|
{
|
||||||
return _global_string_params.GetParam(n);
|
return _global_string_params.GetParam(n);
|
||||||
}
|
}
|
||||||
|
@@ -199,7 +199,7 @@ VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y
|
|||||||
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
|
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
|
||||||
void GetTileDesc(TileIndex tile, TileDesc *td);
|
void GetTileDesc(TileIndex tile, TileDesc *td);
|
||||||
|
|
||||||
static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, CargoTypes *always_accepted)
|
inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, CargoTypes *always_accepted)
|
||||||
{
|
{
|
||||||
AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc;
|
AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc;
|
||||||
if (proc == nullptr) return;
|
if (proc == nullptr) return;
|
||||||
@@ -207,14 +207,14 @@ static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, Carg
|
|||||||
proc(tile, acceptance, always_accepted == nullptr ? &dummy : always_accepted);
|
proc(tile, acceptance, always_accepted == nullptr ? &dummy : always_accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AddProducedCargo(TileIndex tile, CargoArray &produced)
|
inline void AddProducedCargo(TileIndex tile, CargoArray &produced)
|
||||||
{
|
{
|
||||||
AddProducedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_produced_cargo_proc;
|
AddProducedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_produced_cargo_proc;
|
||||||
if (proc == nullptr) return;
|
if (proc == nullptr) return;
|
||||||
proc(tile, produced);
|
proc(tile, produced);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool ClickTile(TileIndex tile)
|
inline bool ClickTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
ClickTileProc *proc = _tile_type_procs[GetTileType(tile)]->click_tile_proc;
|
ClickTileProc *proc = _tile_type_procs[GetTileType(tile)]->click_tile_proc;
|
||||||
if (proc == nullptr) return false;
|
if (proc == nullptr) return false;
|
||||||
|
@@ -42,7 +42,7 @@ debug_inline static uint TileHeight(TileIndex tile)
|
|||||||
* @param y Y coordinate of the tile, may be outside the map.
|
* @param y Y coordinate of the tile, may be outside the map.
|
||||||
* @return The height in the same unit as TileHeight.
|
* @return The height in the same unit as TileHeight.
|
||||||
*/
|
*/
|
||||||
static inline uint TileHeightOutsideMap(int x, int y)
|
inline uint TileHeightOutsideMap(int x, int y)
|
||||||
{
|
{
|
||||||
return TileHeight(TileXY(Clamp(x, 0, MapMaxX()), Clamp(y, 0, MapMaxY())));
|
return TileHeight(TileXY(Clamp(x, 0, MapMaxX()), Clamp(y, 0, MapMaxY())));
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ static inline uint TileHeightOutsideMap(int x, int y)
|
|||||||
* @pre tile < MapSize()
|
* @pre tile < MapSize()
|
||||||
* @pre height <= MAX_TILE_HEIGHT
|
* @pre height <= MAX_TILE_HEIGHT
|
||||||
*/
|
*/
|
||||||
static inline void SetTileHeight(TileIndex tile, uint height)
|
inline void SetTileHeight(TileIndex tile, uint height)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
||||||
dbg_assert(height <= MAX_TILE_HEIGHT);
|
dbg_assert(height <= MAX_TILE_HEIGHT);
|
||||||
@@ -72,7 +72,7 @@ static inline void SetTileHeight(TileIndex tile, uint height)
|
|||||||
* @param tile The tile to get the height
|
* @param tile The tile to get the height
|
||||||
* @return The height of the tile in pixel
|
* @return The height of the tile in pixel
|
||||||
*/
|
*/
|
||||||
static inline uint TilePixelHeight(TileIndex tile)
|
inline uint TilePixelHeight(TileIndex tile)
|
||||||
{
|
{
|
||||||
return TileHeight(tile) * TILE_HEIGHT;
|
return TileHeight(tile) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ static inline uint TilePixelHeight(TileIndex tile)
|
|||||||
* @param y Y coordinate of the tile, may be outside the map.
|
* @param y Y coordinate of the tile, may be outside the map.
|
||||||
* @return The height in pixels in the same unit as TilePixelHeight.
|
* @return The height in pixels in the same unit as TilePixelHeight.
|
||||||
*/
|
*/
|
||||||
static inline uint TilePixelHeightOutsideMap(int x, int y)
|
inline uint TilePixelHeightOutsideMap(int x, int y)
|
||||||
{
|
{
|
||||||
return TileHeightOutsideMap(x, y) * TILE_HEIGHT;
|
return TileHeightOutsideMap(x, y) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ debug_inline static TileType GetTileType(TileIndex tile)
|
|||||||
* @return Whether the tile is in the interior of the map
|
* @return Whether the tile is in the interior of the map
|
||||||
* @pre tile < MapSize()
|
* @pre tile < MapSize()
|
||||||
*/
|
*/
|
||||||
static inline bool IsInnerTile(TileIndex tile)
|
inline bool IsInnerTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ static inline bool IsInnerTile(TileIndex tile)
|
|||||||
* @pre tile < MapSize()
|
* @pre tile < MapSize()
|
||||||
* @pre type MP_VOID <=> tile is on the south-east or south-west edge.
|
* @pre type MP_VOID <=> tile is on the south-east or south-west edge.
|
||||||
*/
|
*/
|
||||||
static inline void SetTileType(TileIndex tile, TileType type)
|
inline void SetTileType(TileIndex tile, TileType type)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X, type: %d", tile, MapSize(), type);
|
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X, type: %d", tile, MapSize(), type);
|
||||||
/* VOID tiles (and no others) are exactly allowed at the lower left and right
|
/* VOID tiles (and no others) are exactly allowed at the lower left and right
|
||||||
@@ -164,7 +164,7 @@ debug_inline static bool IsTileType(TileIndex tile, TileType type)
|
|||||||
* @param tile The tile to check
|
* @param tile The tile to check
|
||||||
* @return True if the tile is on the map and not one of MP_VOID.
|
* @return True if the tile is on the map and not one of MP_VOID.
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidTile(TileIndex tile)
|
inline bool IsValidTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
return tile < MapSize() && !IsTileType(tile, MP_VOID);
|
return tile < MapSize() && !IsTileType(tile, MP_VOID);
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ static inline bool IsValidTile(TileIndex tile)
|
|||||||
* @pre IsValidTile(tile)
|
* @pre IsValidTile(tile)
|
||||||
* @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY
|
* @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY
|
||||||
*/
|
*/
|
||||||
static inline Owner GetTileOwner(TileIndex tile)
|
inline Owner GetTileOwner(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(IsValidTile(tile), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
dbg_assert_msg(IsValidTile(tile), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
||||||
dbg_assert_msg(!IsTileType(tile, MP_HOUSE) && !IsTileType(tile, MP_INDUSTRY), "tile: 0x%X (%d)", tile, GetTileType(tile));
|
dbg_assert_msg(!IsTileType(tile, MP_HOUSE) && !IsTileType(tile, MP_INDUSTRY), "tile: 0x%X (%d)", tile, GetTileType(tile));
|
||||||
@@ -200,7 +200,7 @@ static inline Owner GetTileOwner(TileIndex tile)
|
|||||||
* @pre IsValidTile(tile)
|
* @pre IsValidTile(tile)
|
||||||
* @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY
|
* @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY
|
||||||
*/
|
*/
|
||||||
static inline void SetTileOwner(TileIndex tile, Owner owner)
|
inline void SetTileOwner(TileIndex tile, Owner owner)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(IsValidTile(tile), "tile: 0x%X, size: 0x%X, owner: %d", tile, MapSize(), owner);
|
dbg_assert_msg(IsValidTile(tile), "tile: 0x%X, size: 0x%X, owner: %d", tile, MapSize(), owner);
|
||||||
dbg_assert_msg(!IsTileType(tile, MP_HOUSE) && !IsTileType(tile, MP_INDUSTRY), "tile: 0x%X (%d), owner: %d", tile, GetTileType(tile), owner);
|
dbg_assert_msg(!IsTileType(tile, MP_HOUSE) && !IsTileType(tile, MP_INDUSTRY), "tile: 0x%X (%d), owner: %d", tile, GetTileType(tile), owner);
|
||||||
@@ -215,7 +215,7 @@ static inline void SetTileOwner(TileIndex tile, Owner owner)
|
|||||||
* @param owner The owner to check against
|
* @param owner The owner to check against
|
||||||
* @return True if a tile belongs the the given owner
|
* @return True if a tile belongs the the given owner
|
||||||
*/
|
*/
|
||||||
static inline bool IsTileOwner(TileIndex tile, Owner owner)
|
inline bool IsTileOwner(TileIndex tile, Owner owner)
|
||||||
{
|
{
|
||||||
return GetTileOwner(tile) == owner;
|
return GetTileOwner(tile) == owner;
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ static inline bool IsTileOwner(TileIndex tile, Owner owner)
|
|||||||
* @param type the new type
|
* @param type the new type
|
||||||
* @pre tile < MapSize()
|
* @pre tile < MapSize()
|
||||||
*/
|
*/
|
||||||
static inline void SetTropicZone(TileIndex tile, TropicZone type)
|
inline void SetTropicZone(TileIndex tile, TropicZone type)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X, type: %d", tile, MapSize(), type);
|
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X, type: %d", tile, MapSize(), type);
|
||||||
dbg_assert_msg(!IsTileType(tile, MP_VOID) || type == TROPICZONE_NORMAL, "tile: 0x%X (%d), type: %d", tile, GetTileType(tile), type);
|
dbg_assert_msg(!IsTileType(tile, MP_VOID) || type == TROPICZONE_NORMAL, "tile: 0x%X (%d), type: %d", tile, GetTileType(tile), type);
|
||||||
@@ -239,7 +239,7 @@ static inline void SetTropicZone(TileIndex tile, TropicZone type)
|
|||||||
* @pre tile < MapSize()
|
* @pre tile < MapSize()
|
||||||
* @return the zone type
|
* @return the zone type
|
||||||
*/
|
*/
|
||||||
static inline TropicZone GetTropicZone(TileIndex tile)
|
inline TropicZone GetTropicZone(TileIndex tile)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
dbg_assert_msg(tile < MapSize(), "tile: 0x%X, size: 0x%X", tile, MapSize());
|
||||||
return (TropicZone)GB(_m[tile].type, 0, 2);
|
return (TropicZone)GB(_m[tile].type, 0, 2);
|
||||||
@@ -251,7 +251,7 @@ static inline TropicZone GetTropicZone(TileIndex tile)
|
|||||||
* @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)
|
||||||
* @return frame number
|
* @return frame number
|
||||||
*/
|
*/
|
||||||
static inline byte GetAnimationFrame(TileIndex t)
|
inline byte GetAnimationFrame(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t));
|
dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t));
|
||||||
return _me[t].m7;
|
return _me[t].m7;
|
||||||
@@ -263,7 +263,7 @@ static inline byte GetAnimationFrame(TileIndex t)
|
|||||||
* @param frame the new frame number
|
* @param frame the new frame number
|
||||||
* @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)
|
* @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)
|
||||||
*/
|
*/
|
||||||
static inline void SetAnimationFrame(TileIndex t, byte frame)
|
inline void SetAnimationFrame(TileIndex t, byte frame)
|
||||||
{
|
{
|
||||||
dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t));
|
dbg_assert_msg(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION), "tile: 0x%X (%d)", t, GetTileType(t));
|
||||||
_me[t].m7 = frame;
|
_me[t].m7 = frame;
|
||||||
@@ -281,7 +281,7 @@ bool IsTileFlat(TileIndex tile, int *h = nullptr);
|
|||||||
* @param h If not \c nullptr, pointer to storage of z height
|
* @param h If not \c nullptr, pointer to storage of z height
|
||||||
* @return Slope of the tile, except for the HALFTILE part
|
* @return Slope of the tile, except for the HALFTILE part
|
||||||
*/
|
*/
|
||||||
static inline Slope GetTilePixelSlope(TileIndex tile, int *h)
|
inline Slope GetTilePixelSlope(TileIndex tile, int *h)
|
||||||
{
|
{
|
||||||
Slope s = GetTileSlope(tile, h);
|
Slope s = GetTileSlope(tile, h);
|
||||||
if (h != nullptr) *h *= TILE_HEIGHT;
|
if (h != nullptr) *h *= TILE_HEIGHT;
|
||||||
@@ -295,7 +295,7 @@ Slope GetTilePixelSlopeOutsideMap(int x, int y, int *h);
|
|||||||
* @param tile Tile to compute height of
|
* @param tile Tile to compute height of
|
||||||
* @return Minimum height of the tile
|
* @return Minimum height of the tile
|
||||||
*/
|
*/
|
||||||
static inline int GetTilePixelZ(TileIndex tile)
|
inline int GetTilePixelZ(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetTileZ(tile) * TILE_HEIGHT;
|
return GetTileZ(tile) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ static inline int GetTilePixelZ(TileIndex tile)
|
|||||||
* @param tile Tile to compute height of
|
* @param tile Tile to compute height of
|
||||||
* @return Maximum height of the tile
|
* @return Maximum height of the tile
|
||||||
*/
|
*/
|
||||||
static inline int GetTileMaxPixelZ(TileIndex tile)
|
inline int GetTileMaxPixelZ(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetTileMaxZ(tile) * TILE_HEIGHT;
|
return GetTileMaxZ(tile) * TILE_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ static inline int GetTileMaxPixelZ(TileIndex tile)
|
|||||||
* @param y The Y coordinate
|
* @param y The Y coordinate
|
||||||
* @return The hash of the tile
|
* @return The hash of the tile
|
||||||
*/
|
*/
|
||||||
static inline uint TileHash(uint x, uint y)
|
inline uint TileHash(uint x, uint y)
|
||||||
{
|
{
|
||||||
uint hash = x >> 4;
|
uint hash = x >> 4;
|
||||||
hash ^= x >> 6;
|
hash ^= x >> 6;
|
||||||
@@ -335,7 +335,7 @@ static inline uint TileHash(uint x, uint y)
|
|||||||
* @param y The Y coordinate
|
* @param y The Y coordinate
|
||||||
* @return The last two bits from hash of the tile
|
* @return The last two bits from hash of the tile
|
||||||
*/
|
*/
|
||||||
static inline uint TileHash2Bit(uint x, uint y)
|
inline uint TileHash2Bit(uint x, uint y)
|
||||||
{
|
{
|
||||||
return GB(TileHash(x, y), 0, 2);
|
return GB(TileHash(x, y), 0, 2);
|
||||||
}
|
}
|
||||||
|
@@ -89,6 +89,6 @@ typedef uint32 TileIndex;
|
|||||||
/**
|
/**
|
||||||
* The very nice invalid tile marker
|
* The very nice invalid tile marker
|
||||||
*/
|
*/
|
||||||
static const TileIndex INVALID_TILE = (TileIndex)-1;
|
inline constexpr TileIndex INVALID_TILE = (TileIndex)-1;
|
||||||
|
|
||||||
#endif /* TILE_TYPE_H */
|
#endif /* TILE_TYPE_H */
|
||||||
|
@@ -366,7 +366,7 @@ void MakeDefaultName(T *obj)
|
|||||||
* Converts original town ticks counters to plain game ticks. Note that
|
* Converts original town ticks counters to plain game ticks. Note that
|
||||||
* tick 0 is a valid tick so actual amount is one more than the counter value.
|
* tick 0 is a valid tick so actual amount is one more than the counter value.
|
||||||
*/
|
*/
|
||||||
static inline uint16 TownTicksToGameTicks(uint16 ticks)
|
inline uint16_t TownTicksToGameTicks(uint16_t ticks)
|
||||||
{
|
{
|
||||||
return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1;
|
return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot
|
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot
|
||||||
* @return TownID
|
* @return TownID
|
||||||
*/
|
*/
|
||||||
static inline TownID GetTownIndex(TileIndex t)
|
inline TownID GetTownIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
@@ -31,7 +31,7 @@ static inline TownID GetTownIndex(TileIndex t)
|
|||||||
* @param index the index of the town
|
* @param index the index of the town
|
||||||
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot
|
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD) but not a road depot
|
||||||
*/
|
*/
|
||||||
static inline void SetTownIndex(TileIndex t, TownID index)
|
inline void SetTownIndex(TileIndex t, TownID index)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
||||||
_m[t].m2 = index;
|
_m[t].m2 = index;
|
||||||
@@ -44,7 +44,7 @@ static inline void SetTownIndex(TileIndex t, TownID index)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return house type
|
* @return house type
|
||||||
*/
|
*/
|
||||||
static inline HouseID GetCleanHouseType(TileIndex t)
|
inline HouseID GetCleanHouseType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return _m[t].m4 | (GB(_m[t].m3, 5, 2) << 8);
|
return _m[t].m4 | (GB(_m[t].m3, 5, 2) << 8);
|
||||||
@@ -56,7 +56,7 @@ static inline HouseID GetCleanHouseType(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return house type
|
* @return house type
|
||||||
*/
|
*/
|
||||||
static inline HouseID GetHouseType(TileIndex t)
|
inline HouseID GetHouseType(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetTranslatedHouseID(GetCleanHouseType(t));
|
return GetTranslatedHouseID(GetCleanHouseType(t));
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ static inline HouseID GetHouseType(TileIndex t)
|
|||||||
* @param house_id the new house type
|
* @param house_id the new house type
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void SetHouseType(TileIndex t, HouseID house_id)
|
inline void SetHouseType(TileIndex t, HouseID house_id)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_m[t].m4 = GB(house_id, 0, 8);
|
_m[t].m4 = GB(house_id, 0, 8);
|
||||||
@@ -79,7 +79,7 @@ static inline void SetHouseType(TileIndex t, HouseID house_id)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return has destination
|
* @return has destination
|
||||||
*/
|
*/
|
||||||
static inline bool LiftHasDestination(TileIndex t)
|
inline bool LiftHasDestination(TileIndex t)
|
||||||
{
|
{
|
||||||
return HasBit(_me[t].m7, 0);
|
return HasBit(_me[t].m7, 0);
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ static inline bool LiftHasDestination(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @param dest new destination
|
* @param dest new destination
|
||||||
*/
|
*/
|
||||||
static inline void SetLiftDestination(TileIndex t, byte dest)
|
inline void SetLiftDestination(TileIndex t, byte dest)
|
||||||
{
|
{
|
||||||
SetBit(_me[t].m7, 0);
|
SetBit(_me[t].m7, 0);
|
||||||
SB(_me[t].m7, 1, 3, dest);
|
SB(_me[t].m7, 1, 3, dest);
|
||||||
@@ -101,7 +101,7 @@ static inline void SetLiftDestination(TileIndex t, byte dest)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return destination
|
* @return destination
|
||||||
*/
|
*/
|
||||||
static inline byte GetLiftDestination(TileIndex t)
|
inline byte GetLiftDestination(TileIndex t)
|
||||||
{
|
{
|
||||||
return GB(_me[t].m7, 1, 3);
|
return GB(_me[t].m7, 1, 3);
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ static inline byte GetLiftDestination(TileIndex t)
|
|||||||
* and the destination.
|
* and the destination.
|
||||||
* @param t the tile
|
* @param t the tile
|
||||||
*/
|
*/
|
||||||
static inline void HaltLift(TileIndex t)
|
inline void HaltLift(TileIndex t)
|
||||||
{
|
{
|
||||||
SB(_me[t].m7, 0, 4, 0);
|
SB(_me[t].m7, 0, 4, 0);
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ static inline void HaltLift(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return position, from 0 to 36
|
* @return position, from 0 to 36
|
||||||
*/
|
*/
|
||||||
static inline byte GetLiftPosition(TileIndex t)
|
inline byte GetLiftPosition(TileIndex t)
|
||||||
{
|
{
|
||||||
return GB(_me[t].m6, 2, 6);
|
return GB(_me[t].m6, 2, 6);
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ static inline byte GetLiftPosition(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @param pos position, from 0 to 36
|
* @param pos position, from 0 to 36
|
||||||
*/
|
*/
|
||||||
static inline void SetLiftPosition(TileIndex t, byte pos)
|
inline void SetLiftPosition(TileIndex t, byte pos)
|
||||||
{
|
{
|
||||||
SB(_me[t].m6, 2, 6, pos);
|
SB(_me[t].m6, 2, 6, pos);
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ static inline void SetLiftPosition(TileIndex t, byte pos)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return true if it is, false if it is not
|
* @return true if it is, false if it is not
|
||||||
*/
|
*/
|
||||||
static inline bool IsHouseCompleted(TileIndex t)
|
inline bool IsHouseCompleted(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return HasBit(_m[t].m3, 7);
|
return HasBit(_m[t].m3, 7);
|
||||||
@@ -153,7 +153,7 @@ static inline bool IsHouseCompleted(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
static inline void SetHouseCompleted(TileIndex t, bool status)
|
inline void SetHouseCompleted(TileIndex t, bool status)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_m[t].m3, 7, 1, !!status);
|
SB(_m[t].m3, 7, 1, !!status);
|
||||||
@@ -180,7 +180,7 @@ static inline void SetHouseCompleted(TileIndex t, bool status)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return the building stage of the house
|
* @return the building stage of the house
|
||||||
*/
|
*/
|
||||||
static inline byte GetHouseBuildingStage(TileIndex t)
|
inline byte GetHouseBuildingStage(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2);
|
return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2);
|
||||||
@@ -192,7 +192,7 @@ static inline byte GetHouseBuildingStage(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return the construction stage of the house
|
* @return the construction stage of the house
|
||||||
*/
|
*/
|
||||||
static inline byte GetHouseConstructionTick(TileIndex t)
|
inline byte GetHouseConstructionTick(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3);
|
return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3);
|
||||||
@@ -205,7 +205,7 @@ static inline byte GetHouseConstructionTick(TileIndex t)
|
|||||||
* @param t the tile of the house to increment the construction stage of
|
* @param t the tile of the house to increment the construction stage of
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void IncHouseConstructionTick(TileIndex t)
|
inline void IncHouseConstructionTick(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
AB(_m[t].m5, 0, 5, 1);
|
AB(_m[t].m5, 0, 5, 1);
|
||||||
@@ -223,7 +223,7 @@ static inline void IncHouseConstructionTick(TileIndex t)
|
|||||||
* @param t the tile of this house
|
* @param t the tile of this house
|
||||||
* @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)
|
* @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)
|
||||||
*/
|
*/
|
||||||
static inline void ResetHouseAge(TileIndex t)
|
inline void ResetHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t), t);
|
||||||
_m[t].m5 = 0;
|
_m[t].m5 = 0;
|
||||||
@@ -234,7 +234,7 @@ static inline void ResetHouseAge(TileIndex t)
|
|||||||
* @param t the tile of this house
|
* @param t the tile of this house
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void IncrementHouseAge(TileIndex t)
|
inline void IncrementHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
if (IsHouseCompleted(t) && _m[t].m5 < 0xFF) _m[t].m5++;
|
if (IsHouseCompleted(t) && _m[t].m5 < 0xFF) _m[t].m5++;
|
||||||
@@ -246,7 +246,7 @@ static inline void IncrementHouseAge(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return year
|
* @return year
|
||||||
*/
|
*/
|
||||||
static inline Year GetHouseAge(TileIndex t)
|
inline Year GetHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? _m[t].m5 : 0;
|
return IsHouseCompleted(t) ? _m[t].m5 : 0;
|
||||||
@@ -259,7 +259,7 @@ static inline Year GetHouseAge(TileIndex t)
|
|||||||
* @param random the new random bits
|
* @param random the new random bits
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void SetHouseRandomBits(TileIndex t, byte random)
|
inline void SetHouseRandomBits(TileIndex t, byte random)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_m[t].m1 = random;
|
_m[t].m1 = random;
|
||||||
@@ -272,7 +272,7 @@ static inline void SetHouseRandomBits(TileIndex t, byte random)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return random bits
|
* @return random bits
|
||||||
*/
|
*/
|
||||||
static inline byte GetHouseRandomBits(TileIndex t)
|
inline byte GetHouseRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return _m[t].m1;
|
return _m[t].m1;
|
||||||
@@ -285,7 +285,7 @@ static inline byte GetHouseRandomBits(TileIndex t)
|
|||||||
* @param triggers the activated triggers
|
* @param triggers the activated triggers
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void SetHouseTriggers(TileIndex t, byte triggers)
|
inline void SetHouseTriggers(TileIndex t, byte triggers)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_m[t].m3, 0, 5, triggers);
|
SB(_m[t].m3, 0, 5, triggers);
|
||||||
@@ -298,7 +298,7 @@ static inline void SetHouseTriggers(TileIndex t, byte triggers)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return triggers
|
* @return triggers
|
||||||
*/
|
*/
|
||||||
static inline byte GetHouseTriggers(TileIndex t)
|
inline byte GetHouseTriggers(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return GB(_m[t].m3, 0, 5);
|
return GB(_m[t].m3, 0, 5);
|
||||||
@@ -310,7 +310,7 @@ static inline byte GetHouseTriggers(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
* @return time remaining
|
* @return time remaining
|
||||||
*/
|
*/
|
||||||
static inline byte GetHouseProcessingTime(TileIndex t)
|
inline byte GetHouseProcessingTime(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return GB(_me[t].m6, 2, 6);
|
return GB(_me[t].m6, 2, 6);
|
||||||
@@ -322,7 +322,7 @@ static inline byte GetHouseProcessingTime(TileIndex t)
|
|||||||
* @param time the time to be set
|
* @param time the time to be set
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void SetHouseProcessingTime(TileIndex t, byte time)
|
inline void SetHouseProcessingTime(TileIndex t, byte time)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_me[t].m6, 2, 6, time);
|
SB(_me[t].m6, 2, 6, time);
|
||||||
@@ -333,7 +333,7 @@ static inline void SetHouseProcessingTime(TileIndex t, byte time)
|
|||||||
* @param t the house tile
|
* @param t the house tile
|
||||||
* @pre IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void DecHouseProcessingTime(TileIndex t)
|
inline void DecHouseProcessingTime(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
dbg_assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_me[t].m6 -= 1 << 2;
|
_me[t].m6 -= 1 << 2;
|
||||||
@@ -349,7 +349,7 @@ static inline void DecHouseProcessingTime(TileIndex t)
|
|||||||
* @param random_bits required for newgrf houses
|
* @param random_bits required for newgrf houses
|
||||||
* @pre IsTileType(t, MP_CLEAR)
|
* @pre IsTileType(t, MP_CLEAR)
|
||||||
*/
|
*/
|
||||||
static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
|
inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
|
|
||||||
|
@@ -611,79 +611,79 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Get TraceRestrictItem type field */
|
/** Get TraceRestrictItem type field */
|
||||||
static inline TraceRestrictItemType GetTraceRestrictType(TraceRestrictItem item)
|
inline TraceRestrictItemType GetTraceRestrictType(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return static_cast<TraceRestrictItemType>(GB(item, TRIFA_TYPE_OFFSET, TRIFA_TYPE_COUNT));
|
return static_cast<TraceRestrictItemType>(GB(item, TRIFA_TYPE_OFFSET, TRIFA_TYPE_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get TraceRestrictItem condition flags field */
|
/** Get TraceRestrictItem condition flags field */
|
||||||
static inline TraceRestrictCondFlags GetTraceRestrictCondFlags(TraceRestrictItem item)
|
inline TraceRestrictCondFlags GetTraceRestrictCondFlags(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return static_cast<TraceRestrictCondFlags>(GB(item, TRIFA_COND_FLAGS_OFFSET, TRIFA_COND_FLAGS_COUNT));
|
return static_cast<TraceRestrictCondFlags>(GB(item, TRIFA_COND_FLAGS_OFFSET, TRIFA_COND_FLAGS_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get TraceRestrictItem condition operator field */
|
/** Get TraceRestrictItem condition operator field */
|
||||||
static inline TraceRestrictCondOp GetTraceRestrictCondOp(TraceRestrictItem item)
|
inline TraceRestrictCondOp GetTraceRestrictCondOp(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return static_cast<TraceRestrictCondOp>(GB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT));
|
return static_cast<TraceRestrictCondOp>(GB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get TraceRestrictItem auxiliary field */
|
/** Get TraceRestrictItem auxiliary field */
|
||||||
static inline uint8 GetTraceRestrictAuxField(TraceRestrictItem item)
|
inline uint8 GetTraceRestrictAuxField(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return GB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT);
|
return GB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get TraceRestrictItem value field */
|
/** Get TraceRestrictItem value field */
|
||||||
static inline uint16 GetTraceRestrictValue(TraceRestrictItem item)
|
inline uint16 GetTraceRestrictValue(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return static_cast<uint16>(GB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT));
|
return static_cast<uint16>(GB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set TraceRestrictItem type field */
|
/** Set TraceRestrictItem type field */
|
||||||
static inline void SetTraceRestrictType(TraceRestrictItem &item, TraceRestrictItemType type)
|
inline void SetTraceRestrictType(TraceRestrictItem &item, TraceRestrictItemType type)
|
||||||
{
|
{
|
||||||
SB(item, TRIFA_TYPE_OFFSET, TRIFA_TYPE_COUNT, type);
|
SB(item, TRIFA_TYPE_OFFSET, TRIFA_TYPE_COUNT, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set TraceRestrictItem condition operator field */
|
/** Set TraceRestrictItem condition operator field */
|
||||||
static inline void SetTraceRestrictCondOp(TraceRestrictItem &item, TraceRestrictCondOp condop)
|
inline void SetTraceRestrictCondOp(TraceRestrictItem &item, TraceRestrictCondOp condop)
|
||||||
{
|
{
|
||||||
SB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT, condop);
|
SB(item, TRIFA_COND_OP_OFFSET, TRIFA_COND_OP_COUNT, condop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set TraceRestrictItem condition flags field */
|
/** Set TraceRestrictItem condition flags field */
|
||||||
static inline void SetTraceRestrictCondFlags(TraceRestrictItem &item, TraceRestrictCondFlags condflags)
|
inline void SetTraceRestrictCondFlags(TraceRestrictItem &item, TraceRestrictCondFlags condflags)
|
||||||
{
|
{
|
||||||
SB(item, TRIFA_COND_FLAGS_OFFSET, TRIFA_COND_FLAGS_COUNT, condflags);
|
SB(item, TRIFA_COND_FLAGS_OFFSET, TRIFA_COND_FLAGS_COUNT, condflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set TraceRestrictItem auxiliary field */
|
/** Set TraceRestrictItem auxiliary field */
|
||||||
static inline void SetTraceRestrictAuxField(TraceRestrictItem &item, uint8 data)
|
inline void SetTraceRestrictAuxField(TraceRestrictItem &item, uint8 data)
|
||||||
{
|
{
|
||||||
SB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT, data);
|
SB(item, TRIFA_AUX_FIELD_OFFSET, TRIFA_AUX_FIELD_COUNT, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set TraceRestrictItem value field */
|
/** Set TraceRestrictItem value field */
|
||||||
static inline void SetTraceRestrictValue(TraceRestrictItem &item, uint16 value)
|
inline void SetTraceRestrictValue(TraceRestrictItem &item, uint16 value)
|
||||||
{
|
{
|
||||||
SB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT, value);
|
SB(item, TRIFA_VALUE_OFFSET, TRIFA_VALUE_COUNT, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is TraceRestrictItemType a conditional type? */
|
/** Is TraceRestrictItemType a conditional type? */
|
||||||
static inline bool IsTraceRestrictTypeConditional(TraceRestrictItemType type)
|
inline bool IsTraceRestrictTypeConditional(TraceRestrictItemType type)
|
||||||
{
|
{
|
||||||
return type >= TRIT_COND_BEGIN && type < TRIT_COND_END;
|
return type >= TRIT_COND_BEGIN && type < TRIT_COND_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is TraceRestrictItem type field a conditional type? */
|
/** Is TraceRestrictItem type field a conditional type? */
|
||||||
static inline bool IsTraceRestrictConditional(TraceRestrictItem item)
|
inline bool IsTraceRestrictConditional(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
return IsTraceRestrictTypeConditional(GetTraceRestrictType(item));
|
return IsTraceRestrictTypeConditional(GetTraceRestrictType(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Is TraceRestrictItem a double-item type? */
|
/** Is TraceRestrictItem a double-item type? */
|
||||||
static inline bool IsTraceRestrictDoubleItem(TraceRestrictItem item)
|
inline bool IsTraceRestrictDoubleItem(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
const TraceRestrictItemType type = GetTraceRestrictType(item);
|
const TraceRestrictItemType type = GetTraceRestrictType(item);
|
||||||
return type == TRIT_COND_PBS_ENTRY_SIGNAL || type == TRIT_COND_SLOT_OCCUPANCY || type == TRIT_COUNTER ||
|
return type == TRIT_COND_PBS_ENTRY_SIGNAL || type == TRIT_COND_SLOT_OCCUPANCY || type == TRIT_COUNTER ||
|
||||||
@@ -755,7 +755,7 @@ void SetTraceRestrictTypeAndNormalise(TraceRestrictItem &item, TraceRestrictItem
|
|||||||
/**
|
/**
|
||||||
* Get TraceRestrictTypePropertySet for a given instruction, only looks at value field
|
* Get TraceRestrictTypePropertySet for a given instruction, only looks at value field
|
||||||
*/
|
*/
|
||||||
static inline TraceRestrictTypePropertySet GetTraceRestrictTypeProperties(TraceRestrictItem item)
|
inline TraceRestrictTypePropertySet GetTraceRestrictTypeProperties(TraceRestrictItem item)
|
||||||
{
|
{
|
||||||
TraceRestrictTypePropertySet out;
|
TraceRestrictTypePropertySet out;
|
||||||
|
|
||||||
@@ -968,7 +968,7 @@ static inline TraceRestrictTypePropertySet GetTraceRestrictTypeProperties(TraceR
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Is the aux field for this TraceRestrictItemType used as a subtype which changes the type of the value field? */
|
/** Is the aux field for this TraceRestrictItemType used as a subtype which changes the type of the value field? */
|
||||||
static inline bool IsTraceRestrictTypeAuxSubtype(TraceRestrictItemType type)
|
inline bool IsTraceRestrictTypeAuxSubtype(TraceRestrictItemType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TRIT_COND_PHYS_PROP:
|
case TRIT_COND_PHYS_PROP:
|
||||||
@@ -984,7 +984,7 @@ static inline bool IsTraceRestrictTypeAuxSubtype(TraceRestrictItemType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** May this TraceRestrictItemType take a slot of a different (non-train) vehicle type */
|
/** May this TraceRestrictItemType take a slot of a different (non-train) vehicle type */
|
||||||
static inline bool IsTraceRestrictTypeNonMatchingVehicleTypeSlot(TraceRestrictItemType type)
|
inline bool IsTraceRestrictTypeNonMatchingVehicleTypeSlot(TraceRestrictItemType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TRIT_COND_SLOT_OCCUPANCY:
|
case TRIT_COND_SLOT_OCCUPANCY:
|
||||||
@@ -996,19 +996,19 @@ static inline bool IsTraceRestrictTypeNonMatchingVehicleTypeSlot(TraceRestrictIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get mapping ref ID from tile and track */
|
/** Get mapping ref ID from tile and track */
|
||||||
static inline TraceRestrictRefId MakeTraceRestrictRefId(TileIndex t, Track track)
|
inline TraceRestrictRefId MakeTraceRestrictRefId(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
return (t << 3) | track;
|
return (t << 3) | track;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get tile from mapping ref ID */
|
/** Get tile from mapping ref ID */
|
||||||
static inline TileIndex GetTraceRestrictRefIdTileIndex(TraceRestrictRefId ref)
|
inline TileIndex GetTraceRestrictRefIdTileIndex(TraceRestrictRefId ref)
|
||||||
{
|
{
|
||||||
return static_cast<TileIndex>(ref >> 3);
|
return static_cast<TileIndex>(ref >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get track from mapping ref ID */
|
/** Get track from mapping ref ID */
|
||||||
static inline Track GetTraceRestrictRefIdTrack(TraceRestrictRefId ref)
|
inline Track GetTraceRestrictRefIdTrack(TraceRestrictRefId ref)
|
||||||
{
|
{
|
||||||
return static_cast<Track>(ref & 7);
|
return static_cast<Track>(ref & 7);
|
||||||
}
|
}
|
||||||
@@ -1021,7 +1021,7 @@ TraceRestrictProgram *GetTraceRestrictProgram(TraceRestrictRefId ref, bool creat
|
|||||||
|
|
||||||
void TraceRestrictNotifySignalRemoval(TileIndex tile, Track track);
|
void TraceRestrictNotifySignalRemoval(TileIndex tile, Track track);
|
||||||
|
|
||||||
static inline bool IsRestrictedSignalTile(TileIndex t)
|
inline bool IsRestrictedSignalTile(TileIndex t)
|
||||||
{
|
{
|
||||||
switch (GetTileType(t)) {
|
switch (GetTileType(t)) {
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
@@ -1036,7 +1036,7 @@ static inline bool IsRestrictedSignalTile(TileIndex t)
|
|||||||
/**
|
/**
|
||||||
* Gets the existing signal program for the tile identified by @p t and @p track, or nullptr
|
* Gets the existing signal program for the tile identified by @p t and @p track, or nullptr
|
||||||
*/
|
*/
|
||||||
static inline const TraceRestrictProgram *GetExistingTraceRestrictProgram(TileIndex t, Track track)
|
inline const TraceRestrictProgram *GetExistingTraceRestrictProgram(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
if (IsRestrictedSignalTile(t)) {
|
if (IsRestrictedSignalTile(t)) {
|
||||||
return GetTraceRestrictProgram(MakeTraceRestrictRefId(t, track), false);
|
return GetTraceRestrictProgram(MakeTraceRestrictRefId(t, track), false);
|
||||||
|
@@ -24,7 +24,7 @@ using SetTrackBitIterator = SetBitIterator<Track, TrackBits>;
|
|||||||
* @return true if the given value is a valid track.
|
* @return true if the given value is a valid track.
|
||||||
* @note Use this in an dbg_assert()
|
* @note Use this in an dbg_assert()
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidTrack(Track track)
|
inline bool IsValidTrack(Track track)
|
||||||
{
|
{
|
||||||
return track < TRACK_END;
|
return track < TRACK_END;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ static inline bool IsValidTrack(Track track)
|
|||||||
* @return true if the given value is a valid Trackdir
|
* @return true if the given value is a valid Trackdir
|
||||||
* @note Use this in an dbg_assert()
|
* @note Use this in an dbg_assert()
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidTrackdirForRoadVehicle(Trackdir trackdir)
|
inline bool IsValidTrackdirForRoadVehicle(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
return trackdir < TRACKDIR_END;
|
return trackdir < TRACKDIR_END;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ static inline bool IsValidTrackdirForRoadVehicle(Trackdir trackdir)
|
|||||||
* @return true if the given value is a valid Trackdir
|
* @return true if the given value is a valid Trackdir
|
||||||
* @note Use this in an dbg_assert()
|
* @note Use this in an dbg_assert()
|
||||||
*/
|
*/
|
||||||
static inline bool IsValidTrackdir(Trackdir trackdir)
|
inline bool IsValidTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
return trackdir < TRACKDIR_END && ((1 << trackdir & TRACKDIR_BIT_MASK) != TRACKDIR_BIT_NONE);
|
return trackdir < TRACKDIR_END && ((1 << trackdir & TRACKDIR_BIT_MASK) != TRACKDIR_BIT_NONE);
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ static inline bool IsValidTrackdir(Trackdir trackdir)
|
|||||||
* @param a the axis to convert
|
* @param a the axis to convert
|
||||||
* @return the track corresponding to the axis
|
* @return the track corresponding to the axis
|
||||||
*/
|
*/
|
||||||
static inline Track AxisToTrack(Axis a)
|
inline Track AxisToTrack(Axis a)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidAxis(a));
|
dbg_assert(IsValidAxis(a));
|
||||||
return (Track)a;
|
return (Track)a;
|
||||||
@@ -73,7 +73,7 @@ static inline Track AxisToTrack(Axis a)
|
|||||||
* @param track the track to convert
|
* @param track the track to convert
|
||||||
* @return the converted TrackBits value of the track
|
* @return the converted TrackBits value of the track
|
||||||
*/
|
*/
|
||||||
static inline TrackBits TrackToTrackBits(Track track)
|
inline TrackBits TrackToTrackBits(Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
return (TrackBits)(1 << track);
|
return (TrackBits)(1 << track);
|
||||||
@@ -84,7 +84,7 @@ static inline TrackBits TrackToTrackBits(Track track)
|
|||||||
* @param a the axis to convert
|
* @param a the axis to convert
|
||||||
* @return the converted TrackBits value of the axis
|
* @return the converted TrackBits value of the axis
|
||||||
*/
|
*/
|
||||||
static inline TrackBits AxisToTrackBits(Axis a)
|
inline TrackBits AxisToTrackBits(Axis a)
|
||||||
{
|
{
|
||||||
return TrackToTrackBits(AxisToTrack(a));
|
return TrackToTrackBits(AxisToTrack(a));
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ static inline TrackBits AxisToTrackBits(Axis a)
|
|||||||
* @param corner The corner of a tile.
|
* @param corner The corner of a tile.
|
||||||
* @return The TrackBits of the track in the corner.
|
* @return The TrackBits of the track in the corner.
|
||||||
*/
|
*/
|
||||||
static inline TrackBits CornerToTrackBits(Corner corner)
|
inline TrackBits CornerToTrackBits(Corner corner)
|
||||||
{
|
{
|
||||||
extern const TrackBits _corner_to_trackbits[];
|
extern const TrackBits _corner_to_trackbits[];
|
||||||
dbg_assert(IsValidCorner(corner));
|
dbg_assert(IsValidCorner(corner));
|
||||||
@@ -107,7 +107,7 @@ static inline TrackBits CornerToTrackBits(Corner corner)
|
|||||||
* @param trackdir the track direction to convert
|
* @param trackdir the track direction to convert
|
||||||
* @return the converted TrackdirBits value
|
* @return the converted TrackdirBits value
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir)
|
inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
return (TrackdirBits)(1 << trackdir);
|
return (TrackdirBits)(1 << trackdir);
|
||||||
@@ -127,7 +127,7 @@ static inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir)
|
|||||||
* @return The first Track from the TrackBits value
|
* @return The first Track from the TrackBits value
|
||||||
* @see FindFirstTrack
|
* @see FindFirstTrack
|
||||||
*/
|
*/
|
||||||
static inline Track RemoveFirstTrack(TrackBits *tracks)
|
inline Track RemoveFirstTrack(TrackBits *tracks)
|
||||||
{
|
{
|
||||||
if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) {
|
if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) {
|
||||||
dbg_assert((*tracks & ~TRACK_BIT_MASK) == TRACK_BIT_NONE);
|
dbg_assert((*tracks & ~TRACK_BIT_MASK) == TRACK_BIT_NONE);
|
||||||
@@ -152,7 +152,7 @@ static inline Track RemoveFirstTrack(TrackBits *tracks)
|
|||||||
* @return The first Trackdir from the TrackdirBits value
|
* @return The first Trackdir from the TrackdirBits value
|
||||||
* @see FindFirstTrackdir
|
* @see FindFirstTrackdir
|
||||||
*/
|
*/
|
||||||
static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
|
inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
|
||||||
{
|
{
|
||||||
if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) {
|
if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) {
|
||||||
dbg_assert((*trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
|
dbg_assert((*trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
|
||||||
@@ -173,7 +173,7 @@ static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
|
|||||||
* @return The first Track found or INVALID_TRACK
|
* @return The first Track found or INVALID_TRACK
|
||||||
* @see RemoveFirstTrack
|
* @see RemoveFirstTrack
|
||||||
*/
|
*/
|
||||||
static inline Track FindFirstTrack(TrackBits tracks)
|
inline Track FindFirstTrack(TrackBits tracks)
|
||||||
{
|
{
|
||||||
return (tracks != TRACK_BIT_NONE && tracks != INVALID_TRACK_BIT) ? (Track)FIND_FIRST_BIT(tracks) : INVALID_TRACK;
|
return (tracks != TRACK_BIT_NONE && tracks != INVALID_TRACK_BIT) ? (Track)FIND_FIRST_BIT(tracks) : INVALID_TRACK;
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ static inline Track FindFirstTrack(TrackBits tracks)
|
|||||||
* @return The Track from the value or INVALID_TRACK
|
* @return The Track from the value or INVALID_TRACK
|
||||||
* @pre tracks must contains only one Track or be INVALID_TRACK_BIT
|
* @pre tracks must contains only one Track or be INVALID_TRACK_BIT
|
||||||
*/
|
*/
|
||||||
static inline Track TrackBitsToTrack(TrackBits tracks)
|
inline Track TrackBitsToTrack(TrackBits tracks)
|
||||||
{
|
{
|
||||||
dbg_assert(tracks == INVALID_TRACK_BIT || (tracks != TRACK_BIT_NONE && KillFirstBit(tracks & TRACK_BIT_MASK) == TRACK_BIT_NONE));
|
dbg_assert(tracks == INVALID_TRACK_BIT || (tracks != TRACK_BIT_NONE && KillFirstBit(tracks & TRACK_BIT_MASK) == TRACK_BIT_NONE));
|
||||||
return tracks != INVALID_TRACK_BIT ? (Track)FIND_FIRST_BIT(tracks & TRACK_BIT_MASK) : INVALID_TRACK;
|
return tracks != INVALID_TRACK_BIT ? (Track)FIND_FIRST_BIT(tracks & TRACK_BIT_MASK) : INVALID_TRACK;
|
||||||
@@ -207,7 +207,7 @@ static inline Track TrackBitsToTrack(TrackBits tracks)
|
|||||||
* @pre trackdirs must not be INVALID_TRACKDIR_BIT
|
* @pre trackdirs must not be INVALID_TRACKDIR_BIT
|
||||||
* @see RemoveFirstTrackdir
|
* @see RemoveFirstTrackdir
|
||||||
*/
|
*/
|
||||||
static inline Trackdir FindFirstTrackdir(TrackdirBits trackdirs)
|
inline Trackdir FindFirstTrackdir(TrackdirBits trackdirs)
|
||||||
{
|
{
|
||||||
dbg_assert((trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
|
dbg_assert((trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
|
||||||
return (trackdirs != TRACKDIR_BIT_NONE) ? (Trackdir)FindFirstBit2x64(trackdirs) : INVALID_TRACKDIR;
|
return (trackdirs != TRACKDIR_BIT_NONE) ? (Trackdir)FindFirstBit2x64(trackdirs) : INVALID_TRACKDIR;
|
||||||
@@ -227,7 +227,7 @@ static inline Trackdir FindFirstTrackdir(TrackdirBits trackdirs)
|
|||||||
* @param t the track to convert
|
* @param t the track to convert
|
||||||
* @return the opposite track
|
* @return the opposite track
|
||||||
*/
|
*/
|
||||||
static inline Track TrackToOppositeTrack(Track t)
|
inline Track TrackToOppositeTrack(Track t)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(t));
|
dbg_assert(IsValidTrack(t));
|
||||||
return (Track)(t ^ 1);
|
return (Track)(t ^ 1);
|
||||||
@@ -243,7 +243,7 @@ static inline Track TrackToOppositeTrack(Track t)
|
|||||||
* @return The reverse trackdir
|
* @return The reverse trackdir
|
||||||
* @pre trackdir must not be INVALID_TRACKDIR
|
* @pre trackdir must not be INVALID_TRACKDIR
|
||||||
*/
|
*/
|
||||||
static inline Trackdir ReverseTrackdir(Trackdir trackdir)
|
inline Trackdir ReverseTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
||||||
return (Trackdir)(trackdir ^ 8);
|
return (Trackdir)(trackdir ^ 8);
|
||||||
@@ -258,7 +258,7 @@ static inline Trackdir ReverseTrackdir(Trackdir trackdir)
|
|||||||
* @param trackdir The trackdir value
|
* @param trackdir The trackdir value
|
||||||
* @return The Track which is used in the value
|
* @return The Track which is used in the value
|
||||||
*/
|
*/
|
||||||
static inline Track TrackdirToTrack(Trackdir trackdir)
|
inline Track TrackdirToTrack(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
return (Track)(trackdir & 0x7);
|
return (Track)(trackdir & 0x7);
|
||||||
@@ -275,7 +275,7 @@ static inline Track TrackdirToTrack(Trackdir trackdir)
|
|||||||
* @param track The given Track
|
* @param track The given Track
|
||||||
* @return The Trackdir from the given Track
|
* @return The Trackdir from the given Track
|
||||||
*/
|
*/
|
||||||
static inline Trackdir TrackToTrackdir(Track track)
|
inline Trackdir TrackToTrackdir(Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
return (Trackdir)track;
|
return (Trackdir)track;
|
||||||
@@ -290,7 +290,7 @@ static inline Trackdir TrackToTrackdir(Track track)
|
|||||||
* @param track The track to get the TrackdirBits from
|
* @param track The track to get the TrackdirBits from
|
||||||
* @return The TrackdirBits which the selected tracks
|
* @return The TrackdirBits which the selected tracks
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackToTrackdirBits(Track track)
|
inline TrackdirBits TrackToTrackdirBits(Track track)
|
||||||
{
|
{
|
||||||
Trackdir td = TrackToTrackdir(track);
|
Trackdir td = TrackToTrackdir(track);
|
||||||
return (TrackdirBits)(TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td)));
|
return (TrackdirBits)(TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td)));
|
||||||
@@ -304,7 +304,7 @@ static inline TrackdirBits TrackToTrackdirBits(Track track)
|
|||||||
* @param bits The TrackdirBits to get the TrackBits from
|
* @param bits The TrackdirBits to get the TrackBits from
|
||||||
* @return The TrackBits
|
* @return The TrackBits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits)
|
inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits)
|
||||||
{
|
{
|
||||||
return (TrackBits)((bits | (bits >> 8)) & TRACK_BIT_MASK);
|
return (TrackBits)((bits | (bits >> 8)) & TRACK_BIT_MASK);
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits)
|
|||||||
* @param bits The TrackBits
|
* @param bits The TrackBits
|
||||||
* @return The TrackdirBits containing of bits in both directions.
|
* @return The TrackdirBits containing of bits in both directions.
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
|
inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
|
||||||
{
|
{
|
||||||
return (TrackdirBits)(bits * 0x101);
|
return (TrackdirBits)(bits * 0x101);
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
|
|||||||
* @param tracks The track bits.
|
* @param tracks The track bits.
|
||||||
* @param track The track to check.
|
* @param track The track to check.
|
||||||
*/
|
*/
|
||||||
static inline bool HasTrack(TrackBits tracks, Track track)
|
inline bool HasTrack(TrackBits tracks, Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
return HasBit(tracks, track);
|
return HasBit(tracks, track);
|
||||||
@@ -336,7 +336,7 @@ static inline bool HasTrack(TrackBits tracks, Track track)
|
|||||||
* @param trackdirs The trackdir bits.
|
* @param trackdirs The trackdir bits.
|
||||||
* @param trackdir The trackdir to check.
|
* @param trackdir The trackdir to check.
|
||||||
*/
|
*/
|
||||||
static inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir)
|
inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
return HasBit(trackdirs, trackdir);
|
return HasBit(trackdirs, trackdir);
|
||||||
@@ -348,7 +348,7 @@ static inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir)
|
|||||||
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
||||||
* @return the present trackdirs
|
* @return the present trackdirs
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts)
|
inline TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts)
|
||||||
{
|
{
|
||||||
return (TrackdirBits)(ts & TRACKDIR_BIT_MASK);
|
return (TrackdirBits)(ts & TRACKDIR_BIT_MASK);
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ static inline TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts)
|
|||||||
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
||||||
* @return the present tracks
|
* @return the present tracks
|
||||||
*/
|
*/
|
||||||
static inline TrackBits TrackStatusToTrackBits(TrackStatus ts)
|
inline TrackBits TrackStatusToTrackBits(TrackStatus ts)
|
||||||
{
|
{
|
||||||
return TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(ts));
|
return TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(ts));
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ static inline TrackBits TrackStatusToTrackBits(TrackStatus ts)
|
|||||||
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
* @param ts The TrackStatus returned by GetTileTrackStatus()
|
||||||
* @return the The trackdirs that are blocked by red-signals
|
* @return the The trackdirs that are blocked by red-signals
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackStatusToRedSignals(TrackStatus ts)
|
inline TrackdirBits TrackStatusToRedSignals(TrackStatus ts)
|
||||||
{
|
{
|
||||||
return (TrackdirBits)((ts >> 16) & TRACKDIR_BIT_MASK);
|
return (TrackdirBits)((ts >> 16) & TRACKDIR_BIT_MASK);
|
||||||
}
|
}
|
||||||
@@ -384,7 +384,7 @@ static inline TrackdirBits TrackStatusToRedSignals(TrackStatus ts)
|
|||||||
* @param red_signals red signals
|
* @param red_signals red signals
|
||||||
* @return the TrackStatus representing the given information
|
* @return the TrackStatus representing the given information
|
||||||
*/
|
*/
|
||||||
static inline TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
|
inline TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
|
||||||
{
|
{
|
||||||
return (TrackStatus)(trackdirbits | (red_signals << 16));
|
return (TrackStatus)(trackdirbits | (red_signals << 16));
|
||||||
}
|
}
|
||||||
@@ -399,7 +399,7 @@ static inline TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, Trackdir
|
|||||||
* @param trackdir The given trackdir
|
* @param trackdir The given trackdir
|
||||||
* @return The next Trackdir value of the next tile.
|
* @return The next Trackdir value of the next tile.
|
||||||
*/
|
*/
|
||||||
static inline Trackdir NextTrackdir(Trackdir trackdir)
|
inline Trackdir NextTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
extern const Trackdir _next_trackdir[TRACKDIR_END];
|
extern const Trackdir _next_trackdir[TRACKDIR_END];
|
||||||
@@ -416,7 +416,7 @@ static inline Trackdir NextTrackdir(Trackdir trackdir)
|
|||||||
* @param track The given track
|
* @param track The given track
|
||||||
* @return The TrackBits with the tracks marked which cross the given track by 90 deg.
|
* @return The TrackBits with the tracks marked which cross the given track by 90 deg.
|
||||||
*/
|
*/
|
||||||
static inline TrackBits TrackCrossesTracks(Track track)
|
inline TrackBits TrackCrossesTracks(Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
extern const TrackBits _track_crosses_tracks[TRACK_END];
|
extern const TrackBits _track_crosses_tracks[TRACK_END];
|
||||||
@@ -435,7 +435,7 @@ static inline TrackBits TrackCrossesTracks(Track track)
|
|||||||
* @param trackdir The given track direction
|
* @param trackdir The given track direction
|
||||||
* @return The direction which points to the resulting tile if following the Trackdir
|
* @return The direction which points to the resulting tile if following the Trackdir
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection TrackdirToExitdir(Trackdir trackdir)
|
inline DiagDirection TrackdirToExitdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
||||||
extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END];
|
extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END];
|
||||||
@@ -457,7 +457,7 @@ static inline DiagDirection TrackdirToExitdir(Trackdir trackdir)
|
|||||||
* @param diagdir The DiagDirection to apply on
|
* @param diagdir The DiagDirection to apply on
|
||||||
* @return The resulting track direction or INVALID_TRACKDIR if not possible.
|
* @return The resulting track direction or INVALID_TRACKDIR if not possible.
|
||||||
*/
|
*/
|
||||||
static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir)
|
inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
@@ -482,7 +482,7 @@ static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir
|
|||||||
* @param diagdir The direction to "come from"
|
* @param diagdir The direction to "come from"
|
||||||
* @return the resulting Trackdir or INVALID_TRACKDIR if not possible.
|
* @return the resulting Trackdir or INVALID_TRACKDIR if not possible.
|
||||||
*/
|
*/
|
||||||
static inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir)
|
inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
@@ -494,7 +494,7 @@ static inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdi
|
|||||||
* Maps a track and a full (8-way) direction to the trackdir that represents
|
* Maps a track and a full (8-way) direction to the trackdir that represents
|
||||||
* the track running in the given direction.
|
* the track running in the given direction.
|
||||||
*/
|
*/
|
||||||
static inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir)
|
inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
dbg_assert(IsValidDirection(dir));
|
dbg_assert(IsValidDirection(dir));
|
||||||
@@ -508,7 +508,7 @@ static inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir)
|
|||||||
* @param diagdir The direction
|
* @param diagdir The direction
|
||||||
* @return The resulting Track
|
* @return The resulting Track
|
||||||
*/
|
*/
|
||||||
static inline Track DiagDirToDiagTrack(DiagDirection diagdir)
|
inline Track DiagDirToDiagTrack(DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
return (Track)(diagdir & 1);
|
return (Track)(diagdir & 1);
|
||||||
@@ -520,7 +520,7 @@ static inline Track DiagDirToDiagTrack(DiagDirection diagdir)
|
|||||||
* @param diagdir The direction
|
* @param diagdir The direction
|
||||||
* @return The resulting TrackBits
|
* @return The resulting TrackBits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
|
inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
return TrackToTrackBits(DiagDirToDiagTrack(diagdir));
|
return TrackToTrackBits(DiagDirToDiagTrack(diagdir));
|
||||||
@@ -533,7 +533,7 @@ static inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
|
|||||||
* @param diagdir The direction
|
* @param diagdir The direction
|
||||||
* @return The resulting Trackdir direction
|
* @return The resulting Trackdir direction
|
||||||
*/
|
*/
|
||||||
static inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
|
inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
extern const Trackdir _dir_to_diag_trackdir[DIAGDIR_END];
|
extern const Trackdir _dir_to_diag_trackdir[DIAGDIR_END];
|
||||||
@@ -551,7 +551,7 @@ static inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
|
|||||||
* @return The TrackdirBits which can be used from the given direction
|
* @return The TrackdirBits which can be used from the given direction
|
||||||
* @see DiagdirReachesTracks
|
* @see DiagdirReachesTracks
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits DiagdirReachesTrackdirs(DiagDirection diagdir)
|
inline TrackdirBits DiagdirReachesTrackdirs(DiagDirection diagdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidDiagDirection(diagdir));
|
dbg_assert(IsValidDiagDirection(diagdir));
|
||||||
extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
|
extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
|
||||||
@@ -569,7 +569,7 @@ static inline TrackdirBits DiagdirReachesTrackdirs(DiagDirection diagdir)
|
|||||||
* @return The tracks which can be used
|
* @return The tracks which can be used
|
||||||
* @see DiagdirReachesTrackdirs
|
* @see DiagdirReachesTrackdirs
|
||||||
*/
|
*/
|
||||||
static inline TrackBits DiagdirReachesTracks(DiagDirection diagdir) { return TrackdirBitsToTrackBits(DiagdirReachesTrackdirs(diagdir)); }
|
inline TrackBits DiagdirReachesTracks(DiagDirection diagdir) { return TrackdirBitsToTrackBits(DiagdirReachesTrackdirs(diagdir)); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a trackdir to the trackdirs that can be reached from it (ie, when
|
* Maps a trackdir to the trackdirs that can be reached from it (ie, when
|
||||||
@@ -580,7 +580,7 @@ static inline TrackBits DiagdirReachesTracks(DiagDirection diagdir) { return Tra
|
|||||||
* @param trackdir The track direction which will be leaved
|
* @param trackdir The track direction which will be leaved
|
||||||
* @return The track directions which can be used from this direction (in the next tile)
|
* @return The track directions which can be used from this direction (in the next tile)
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir)
|
inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
|
extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
|
||||||
@@ -602,7 +602,7 @@ static inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir)
|
|||||||
* @param trackdir The track direction
|
* @param trackdir The track direction
|
||||||
* @return The TrackdirBits which are (more or less) 90 deg turns.
|
* @return The TrackdirBits which are (more or less) 90 deg turns.
|
||||||
*/
|
*/
|
||||||
static inline TrackdirBits TrackdirCrossesTrackdirs(Trackdir trackdir)
|
inline TrackdirBits TrackdirCrossesTrackdirs(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(trackdir));
|
||||||
extern const TrackdirBits _track_crosses_trackdirs[TRACK_END];
|
extern const TrackdirBits _track_crosses_trackdirs[TRACK_END];
|
||||||
@@ -615,7 +615,7 @@ static inline TrackdirBits TrackdirCrossesTrackdirs(Trackdir trackdir)
|
|||||||
* @param track The given track to check
|
* @param track The given track to check
|
||||||
* @return true if diagonal, else false
|
* @return true if diagonal, else false
|
||||||
*/
|
*/
|
||||||
static inline bool IsDiagonalTrack(Track track)
|
inline bool IsDiagonalTrack(Track track)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrack(track));
|
dbg_assert(IsValidTrack(track));
|
||||||
return (track == TRACK_X) || (track == TRACK_Y);
|
return (track == TRACK_X) || (track == TRACK_Y);
|
||||||
@@ -627,7 +627,7 @@ static inline bool IsDiagonalTrack(Track track)
|
|||||||
* @param trackdir The given trackdir
|
* @param trackdir The given trackdir
|
||||||
* @return true if the trackdir use a diagonal track
|
* @return true if the trackdir use a diagonal track
|
||||||
*/
|
*/
|
||||||
static inline bool IsDiagonalTrackdir(Trackdir trackdir)
|
inline bool IsDiagonalTrackdir(Trackdir trackdir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdir(trackdir));
|
dbg_assert(IsValidTrackdir(trackdir));
|
||||||
return IsDiagonalTrack(TrackdirToTrack(trackdir));
|
return IsDiagonalTrack(TrackdirToTrack(trackdir));
|
||||||
@@ -641,7 +641,7 @@ static inline bool IsDiagonalTrackdir(Trackdir trackdir)
|
|||||||
* @param bits The tracks present.
|
* @param bits The tracks present.
|
||||||
* @return Whether the tracks present overlap in any way.
|
* @return Whether the tracks present overlap in any way.
|
||||||
*/
|
*/
|
||||||
static inline bool TracksOverlap(TrackBits bits)
|
inline bool TracksOverlap(TrackBits bits)
|
||||||
{
|
{
|
||||||
/* With no, or only one track, there is no overlap */
|
/* With no, or only one track, there is no overlap */
|
||||||
if (bits == TRACK_BIT_NONE || KillFirstBit(bits) == TRACK_BIT_NONE) return false;
|
if (bits == TRACK_BIT_NONE || KillFirstBit(bits) == TRACK_BIT_NONE) return false;
|
||||||
@@ -658,7 +658,7 @@ static inline bool TracksOverlap(TrackBits bits)
|
|||||||
* @param track The track to test
|
* @param track The track to test
|
||||||
* @return true if the track is already in the tracks or overlaps the tracks.
|
* @return true if the track is already in the tracks or overlaps the tracks.
|
||||||
*/
|
*/
|
||||||
static inline bool TrackOverlapsTracks(TrackBits tracks, Track track)
|
inline bool TrackOverlapsTracks(TrackBits tracks, Track track)
|
||||||
{
|
{
|
||||||
if (HasBit(tracks, track)) return true;
|
if (HasBit(tracks, track)) return true;
|
||||||
return TracksOverlap(tracks | TrackToTrackBits(track));
|
return TracksOverlap(tracks | TrackToTrackBits(track));
|
||||||
@@ -669,7 +669,7 @@ static inline bool TrackOverlapsTracks(TrackBits tracks, Track track)
|
|||||||
* @param dir the trackdir to check
|
* @param dir the trackdir to check
|
||||||
* @return true if it is a reversing road trackdir
|
* @return true if it is a reversing road trackdir
|
||||||
*/
|
*/
|
||||||
static inline bool IsReversingRoadTrackdir(Trackdir dir)
|
inline bool IsReversingRoadTrackdir(Trackdir dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
||||||
return (dir & 0x07) >= 6;
|
return (dir & 0x07) >= 6;
|
||||||
@@ -680,7 +680,7 @@ static inline bool IsReversingRoadTrackdir(Trackdir dir)
|
|||||||
* @param dir the trackdir to check
|
* @param dir the trackdir to check
|
||||||
* @return true if it is a straight road trackdir
|
* @return true if it is a straight road trackdir
|
||||||
*/
|
*/
|
||||||
static inline bool IsStraightRoadTrackdir(Trackdir dir)
|
inline bool IsStraightRoadTrackdir(Trackdir dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
||||||
return (dir & 0x06) == 0;
|
return (dir & 0x06) == 0;
|
||||||
@@ -696,7 +696,7 @@ static inline bool IsStraightRoadTrackdir(Trackdir dir)
|
|||||||
* @param dir The trackdir of interest.
|
* @param dir The trackdir of interest.
|
||||||
* @return true iff the track goes upwards.
|
* @return true iff the track goes upwards.
|
||||||
*/
|
*/
|
||||||
static inline bool IsUphillTrackdir(Slope slope, Trackdir dir)
|
inline bool IsUphillTrackdir(Slope slope, Trackdir dir)
|
||||||
{
|
{
|
||||||
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
dbg_assert(IsValidTrackdirForRoadVehicle(dir));
|
||||||
extern const TrackdirBits _uphill_trackdirs[];
|
extern const TrackdirBits _uphill_trackdirs[];
|
||||||
@@ -710,7 +710,7 @@ static inline bool IsUphillTrackdir(Slope slope, Trackdir dir)
|
|||||||
* @param track vehicle track bits
|
* @param track vehicle track bits
|
||||||
* @return side of tile the vehicle will leave
|
* @return side of tile the vehicle will leave
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection VehicleExitDir(Direction direction, TrackBits track)
|
inline DiagDirection VehicleExitDir(Direction direction, TrackBits track)
|
||||||
{
|
{
|
||||||
static const TrackBits state_dir_table[DIAGDIR_END] = { TRACK_BIT_RIGHT, TRACK_BIT_LOWER, TRACK_BIT_LEFT, TRACK_BIT_UPPER };
|
static const TrackBits state_dir_table[DIAGDIR_END] = { TRACK_BIT_RIGHT, TRACK_BIT_LOWER, TRACK_BIT_LEFT, TRACK_BIT_UPPER };
|
||||||
|
|
||||||
@@ -730,7 +730,7 @@ static inline DiagDirection VehicleExitDir(Direction direction, TrackBits track)
|
|||||||
* @param td track direction
|
* @param td track direction
|
||||||
* @return direction
|
* @return direction
|
||||||
*/
|
*/
|
||||||
static inline Direction TrackdirToDirection(Trackdir td)
|
inline Direction TrackdirToDirection(Trackdir td)
|
||||||
{
|
{
|
||||||
switch (td) {
|
switch (td) {
|
||||||
case TRACKDIR_X_NE: return DIR_NE;
|
case TRACKDIR_X_NE: return DIR_NE;
|
||||||
|
@@ -54,7 +54,7 @@ void PostTransparencyOptionLoad();
|
|||||||
*
|
*
|
||||||
* @param to the structure which transparency option is ask for
|
* @param to the structure which transparency option is ask for
|
||||||
*/
|
*/
|
||||||
static inline bool IsTransparencySet(TransparencyOption to)
|
inline bool IsTransparencySet(TransparencyOption to)
|
||||||
{
|
{
|
||||||
return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
|
return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ static inline bool IsTransparencySet(TransparencyOption to)
|
|||||||
*
|
*
|
||||||
* @param to the structure which invisibility option is ask for
|
* @param to the structure which invisibility option is ask for
|
||||||
*/
|
*/
|
||||||
static inline bool IsInvisibilitySet(TransparencyOption to)
|
inline bool IsInvisibilitySet(TransparencyOption to)
|
||||||
{
|
{
|
||||||
return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
|
return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ static inline bool IsInvisibilitySet(TransparencyOption to)
|
|||||||
*
|
*
|
||||||
* @param to the transparency option to be toggled
|
* @param to the transparency option to be toggled
|
||||||
*/
|
*/
|
||||||
static inline void ToggleTransparency(TransparencyOption to)
|
inline void ToggleTransparency(TransparencyOption to)
|
||||||
{
|
{
|
||||||
ToggleBit(_transparency_opt, to);
|
ToggleBit(_transparency_opt, to);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ static inline void ToggleTransparency(TransparencyOption to)
|
|||||||
*
|
*
|
||||||
* @param to the structure which invisibility option is toggle
|
* @param to the structure which invisibility option is toggle
|
||||||
*/
|
*/
|
||||||
static inline void ToggleInvisibility(TransparencyOption to)
|
inline void ToggleInvisibility(TransparencyOption to)
|
||||||
{
|
{
|
||||||
ToggleBit(_invisibility_opt, to);
|
ToggleBit(_invisibility_opt, to);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ static inline void ToggleInvisibility(TransparencyOption to)
|
|||||||
*
|
*
|
||||||
* @param to the object type which invisibility option to toggle
|
* @param to the object type which invisibility option to toggle
|
||||||
*/
|
*/
|
||||||
static inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
|
inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
|
||||||
{
|
{
|
||||||
if (IsInvisibilitySet(to)) {
|
if (IsInvisibilitySet(to)) {
|
||||||
ClrBit(_invisibility_opt, to);
|
ClrBit(_invisibility_opt, to);
|
||||||
@@ -122,13 +122,13 @@ static inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
|
|||||||
*
|
*
|
||||||
* @param to the transparency option to be locked or unlocked
|
* @param to the transparency option to be locked or unlocked
|
||||||
*/
|
*/
|
||||||
static inline void ToggleTransparencyLock(TransparencyOption to)
|
inline void ToggleTransparencyLock(TransparencyOption to)
|
||||||
{
|
{
|
||||||
ToggleBit(_transparency_lock, to);
|
ToggleBit(_transparency_lock, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set or clear all non-locked transparency options */
|
/** Set or clear all non-locked transparency options */
|
||||||
static inline void ResetRestoreAllTransparency()
|
inline void ResetRestoreAllTransparency()
|
||||||
{
|
{
|
||||||
const TransparencyOptionBits old_transparency_opt = _transparency_opt;
|
const TransparencyOptionBits old_transparency_opt = _transparency_opt;
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@ enum TreeGround {
|
|||||||
* @return The treetype of the given tile with trees
|
* @return The treetype of the given tile with trees
|
||||||
* @pre Tile t must be of type MP_TREES
|
* @pre Tile t must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline TreeType GetTreeType(TileIndex t)
|
inline TreeType GetTreeType(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return (TreeType)_m[t].m3;
|
return (TreeType)_m[t].m3;
|
||||||
@@ -85,7 +85,7 @@ static inline TreeType GetTreeType(TileIndex t)
|
|||||||
* @return The groundtype of the tile
|
* @return The groundtype of the tile
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline TreeGround GetTreeGround(TileIndex t)
|
inline TreeGround GetTreeGround(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return (TreeGround)GB(_m[t].m2, 6, 3);
|
return (TreeGround)GB(_m[t].m2, 6, 3);
|
||||||
@@ -110,7 +110,7 @@ static inline TreeGround GetTreeGround(TileIndex t)
|
|||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
* @see GetTreeCount
|
* @see GetTreeCount
|
||||||
*/
|
*/
|
||||||
static inline uint GetTreeDensity(TileIndex t)
|
inline uint GetTreeDensity(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m2, 4, 2);
|
return GB(_m[t].m2, 4, 2);
|
||||||
@@ -127,7 +127,7 @@ static inline uint GetTreeDensity(TileIndex t)
|
|||||||
* @param d The density to save with
|
* @param d The density to save with
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
SB(_m[t].m2, 4, 2, d);
|
SB(_m[t].m2, 4, 2, d);
|
||||||
@@ -146,7 +146,7 @@ static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
|||||||
* @return The number of trees (1-4)
|
* @return The number of trees (1-4)
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline uint GetTreeCount(TileIndex t)
|
inline uint GetTreeCount(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m5, 6, 2) + 1;
|
return GB(_m[t].m5, 6, 2) + 1;
|
||||||
@@ -163,7 +163,7 @@ static inline uint GetTreeCount(TileIndex t)
|
|||||||
* @param c The value to add (or reduce) on the tree-count value
|
* @param c The value to add (or reduce) on the tree-count value
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline void AddTreeCount(TileIndex t, int c)
|
inline void AddTreeCount(TileIndex t, int c)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
_m[t].m5 += ((uint) c) << 6;
|
_m[t].m5 += ((uint) c) << 6;
|
||||||
@@ -178,7 +178,7 @@ static inline void AddTreeCount(TileIndex t, int c)
|
|||||||
* @return The tree growth status
|
* @return The tree growth status
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline uint GetTreeGrowth(TileIndex t)
|
inline uint GetTreeGrowth(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m5, 0, 3);
|
return GB(_m[t].m5, 0, 3);
|
||||||
@@ -193,7 +193,7 @@ static inline uint GetTreeGrowth(TileIndex t)
|
|||||||
* @param a The value to add on the tree growth status
|
* @param a The value to add on the tree growth status
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline void AddTreeGrowth(TileIndex t, int a)
|
inline void AddTreeGrowth(TileIndex t, int a)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
_m[t].m5 += a;
|
_m[t].m5 += a;
|
||||||
@@ -209,7 +209,7 @@ static inline void AddTreeGrowth(TileIndex t, int a)
|
|||||||
* @param g The new value
|
* @param g The new value
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline void SetTreeGrowth(TileIndex t, uint g)
|
inline void SetTreeGrowth(TileIndex t, uint g)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
dbg_assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
SB(_m[t].m5, 0, 3, g);
|
SB(_m[t].m5, 0, 3, g);
|
||||||
@@ -221,7 +221,7 @@ static inline void SetTreeGrowth(TileIndex t, uint g)
|
|||||||
* @param t The tile to clear the old tick counter
|
* @param t The tile to clear the old tick counter
|
||||||
* @pre Tile must be of type MP_TREES
|
* @pre Tile must be of type MP_TREES
|
||||||
*/
|
*/
|
||||||
static inline void ClearOldTreeCounter(TileIndex t)
|
inline void ClearOldTreeCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
dbg_assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
SB(_m[t].m2, 0, 4, 0);
|
SB(_m[t].m2, 0, 4, 0);
|
||||||
@@ -239,7 +239,7 @@ static inline void ClearOldTreeCounter(TileIndex t)
|
|||||||
* @param ground the ground type
|
* @param ground the ground type
|
||||||
* @param density the density (not the number of trees)
|
* @param density the density (not the number of trees)
|
||||||
*/
|
*/
|
||||||
static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density)
|
inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_TREES);
|
SetTileType(t, MP_TREES);
|
||||||
SetTileOwner(t, OWNER_NONE);
|
SetTileOwner(t, OWNER_NONE);
|
||||||
|
@@ -22,7 +22,7 @@ static const TunnelID TUNNEL_ID_MAP_LOOKUP = 0xFFFF; ///< Sentinel ID value to s
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel (entrance)
|
* @return true if and only if this tile is a tunnel (entrance)
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnel(TileIndex t)
|
inline bool IsTunnel(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
dbg_assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return !HasBit(_m[t].m5, 7);
|
return !HasBit(_m[t].m5, 7);
|
||||||
@@ -33,7 +33,7 @@ static inline bool IsTunnel(TileIndex t)
|
|||||||
* @param t the tile that might be a tunnel
|
* @param t the tile that might be a tunnel
|
||||||
* @return true if and only if this tile is a tunnel (entrance)
|
* @return true if and only if this tile is a tunnel (entrance)
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelTile(TileIndex t)
|
inline bool IsTunnelTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
|
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ static inline bool IsTunnelTile(TileIndex t)
|
|||||||
* @pre IsTunnelTile(t)
|
* @pre IsTunnelTile(t)
|
||||||
* @return TunnelID
|
* @return TunnelID
|
||||||
*/
|
*/
|
||||||
static inline TunnelID GetTunnelIndex(TileIndex t)
|
inline TunnelID GetTunnelIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
extern TunnelID GetTunnelIndexByLookup(TileIndex t);
|
extern TunnelID GetTunnelIndexByLookup(TileIndex t);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ static inline TunnelID GetTunnelIndex(TileIndex t)
|
|||||||
* @param t the tile that might be a rail tunnel
|
* @param t the tile that might be a rail tunnel
|
||||||
* @return true if it is a rail tunnel
|
* @return true if it is a rail tunnel
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailTunnelTile(TileIndex t)
|
inline bool IsRailTunnelTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTunnelTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_RAIL;
|
return IsTunnelTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_RAIL;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ static inline bool IsRailTunnelTile(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool HasTunnelReservation(TileIndex t)
|
inline bool HasTunnelReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRailTunnelTile(t), t);
|
dbg_assert_tile(IsRailTunnelTile(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
@@ -81,7 +81,7 @@ static inline bool HasTunnelReservation(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @param b the reservation state
|
* @param b the reservation state
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelReservation(TileIndex t, bool b)
|
inline void SetTunnelReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsRailTunnelTile(t), t);
|
dbg_assert_tile(IsRailTunnelTile(t), t);
|
||||||
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
||||||
@@ -105,7 +105,7 @@ bool IsTunnelInWay(TileIndex, int z, IsTunnelInWayFlags flags = ITIWF_NONE);
|
|||||||
* @param id the tunnel ID
|
* @param id the tunnel ID
|
||||||
* @pre IsTunnelTile(t)
|
* @pre IsTunnelTile(t)
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelIndex(TileIndex t, TunnelID id)
|
inline void SetTunnelIndex(TileIndex t, TunnelID id)
|
||||||
{
|
{
|
||||||
dbg_assert_tile(IsTunnelTile(t), t);
|
dbg_assert_tile(IsTunnelTile(t), t);
|
||||||
_m[t].m2 = (id >= TUNNEL_ID_MAP_LOOKUP) ? TUNNEL_ID_MAP_LOOKUP : id;
|
_m[t].m2 = (id >= TUNNEL_ID_MAP_LOOKUP) ? TUNNEL_ID_MAP_LOOKUP : id;
|
||||||
@@ -113,7 +113,7 @@ static inline void SetTunnelIndex(TileIndex t, TunnelID id)
|
|||||||
|
|
||||||
void SetTunnelSignalStyle(TileIndex t, TileIndex end, uint8 style);
|
void SetTunnelSignalStyle(TileIndex t, TileIndex end, uint8 style);
|
||||||
|
|
||||||
static inline uint8 GetTunnelSignalStyle(TileIndex t)
|
inline uint8 GetTunnelSignalStyle(TileIndex t)
|
||||||
{
|
{
|
||||||
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ static inline uint8 GetTunnelSignalStyle(TileIndex t)
|
|||||||
* @param d the direction facing out of the tunnel
|
* @param d the direction facing out of the tunnel
|
||||||
* @param r the road type used in the tunnel
|
* @param r the road type used in the tunnel
|
||||||
*/
|
*/
|
||||||
static inline void MakeRoadTunnel(TileIndex t, Owner o, TunnelID id, DiagDirection d, RoadType road_rt, RoadType tram_rt)
|
inline void MakeRoadTunnel(TileIndex t, Owner o, TunnelID id, DiagDirection d, RoadType road_rt, RoadType tram_rt)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_TUNNELBRIDGE);
|
SetTileType(t, MP_TUNNELBRIDGE);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
@@ -153,7 +153,7 @@ static inline void MakeRoadTunnel(TileIndex t, Owner o, TunnelID id, DiagDirecti
|
|||||||
* @param d the direction facing out of the tunnel
|
* @param d the direction facing out of the tunnel
|
||||||
* @param r the rail type used in the tunnel
|
* @param r the rail type used in the tunnel
|
||||||
*/
|
*/
|
||||||
static inline void MakeRailTunnel(TileIndex t, Owner o, TunnelID id, DiagDirection d, RailType r)
|
inline void MakeRailTunnel(TileIndex t, Owner o, TunnelID id, DiagDirection d, RailType r)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_TUNNELBRIDGE);
|
SetTileType(t, MP_TUNNELBRIDGE);
|
||||||
SetTileOwner(t, o);
|
SetTileOwner(t, o);
|
||||||
|
@@ -25,7 +25,7 @@ int GetTunnelBridgeSignalZ(TileIndex tile, bool exit);
|
|||||||
* @param end The end of the tunnel or bridge.
|
* @param end The end of the tunnel or bridge.
|
||||||
* @return length of bridge/tunnel middle
|
* @return length of bridge/tunnel middle
|
||||||
*/
|
*/
|
||||||
static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
|
inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
|
||||||
{
|
{
|
||||||
int x1 = TileX(begin);
|
int x1 = TileX(begin);
|
||||||
int y1 = TileY(begin);
|
int y1 = TileY(begin);
|
||||||
@@ -41,7 +41,7 @@ static inline uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
|
|||||||
* @param end The end of the tunnel or bridge.
|
* @param end The end of the tunnel or bridge.
|
||||||
* @param owner The new owner to set
|
* @param owner The new owner to set
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
|
inline void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
|
||||||
{
|
{
|
||||||
SetTileOwner(begin, owner);
|
SetTileOwner(begin, owner);
|
||||||
SetTileOwner(end, owner);
|
SetTileOwner(end, owner);
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return the above mentioned direction
|
* @return the above mentioned direction
|
||||||
*/
|
*/
|
||||||
static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
@@ -43,13 +43,13 @@ static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return the transport type in the tunnel/bridge
|
* @return the transport type in the tunnel/bridge
|
||||||
*/
|
*/
|
||||||
static inline TransportType GetTunnelBridgeTransportType(TileIndex t)
|
inline TransportType GetTunnelBridgeTransportType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return (TransportType)GB(_m[t].m5, 2, 2);
|
return (TransportType)GB(_m[t].m5, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetTunnelBridgeGroundBits(TileIndex t)
|
inline uint8 GetTunnelBridgeGroundBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return GB(_me[t].m7, 5, 3);
|
return GB(_me[t].m7, 5, 3);
|
||||||
@@ -62,7 +62,7 @@ static inline uint8 GetTunnelBridgeGroundBits(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if the tile is in a snowy/desert area
|
* @return true if and only if the tile is in a snowy/desert area
|
||||||
*/
|
*/
|
||||||
static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
|
inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetTunnelBridgeGroundBits(t) == 1;
|
return GetTunnelBridgeGroundBits(t) == 1;
|
||||||
}
|
}
|
||||||
@@ -72,12 +72,12 @@ static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
|
|||||||
* @param t the tile that might be a rail bridge or tunnel
|
* @param t the tile that might be a rail bridge or tunnel
|
||||||
* @return true if and only if this tile is a rail bridge or tunnel
|
* @return true if and only if this tile is a rail bridge or tunnel
|
||||||
*/
|
*/
|
||||||
static inline bool IsRailTunnelBridgeTile(TileIndex t)
|
inline bool IsRailTunnelBridgeTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && (Extract<TransportType, 2, 2>(_m[t].m5) == TRANSPORT_RAIL);
|
return IsTileType(t, MP_TUNNELBRIDGE) && (Extract<TransportType, 2, 2>(_m[t].m5) == TRANSPORT_RAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeGroundBits(TileIndex t, uint8 bits)
|
inline void SetTunnelBridgeGroundBits(TileIndex t, uint8 bits)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SB(_me[t].m7, 5, 3, bits);
|
SB(_me[t].m7, 5, 3, bits);
|
||||||
@@ -91,7 +91,7 @@ static inline void SetTunnelBridgeGroundBits(TileIndex t, uint8 bits)
|
|||||||
* not in snow and not in desert false
|
* not in snow and not in desert false
|
||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
||||||
{
|
{
|
||||||
SetTunnelBridgeGroundBits(t, snow_or_desert ? 1 : 0);
|
SetTunnelBridgeGroundBits(t, snow_or_desert ? 1 : 0);
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return other end
|
* @return other end
|
||||||
*/
|
*/
|
||||||
static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
|
inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
|
return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
|
||||||
@@ -114,7 +114,7 @@ static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetTunnelBridgeTrackBits(TileIndex t)
|
inline TrackBits GetTunnelBridgeTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
||||||
@@ -129,7 +129,7 @@ static inline TrackBits GetTunnelBridgeTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetPrimaryTunnelBridgeTrackBits(TileIndex t)
|
inline TrackBits GetPrimaryTunnelBridgeTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
||||||
@@ -149,7 +149,7 @@ static inline TrackBits GetPrimaryTunnelBridgeTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetSecondaryTunnelBridgeTrackBits(TileIndex t)
|
inline TrackBits GetSecondaryTunnelBridgeTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return TRACK_BIT_NONE;
|
return TRACK_BIT_NONE;
|
||||||
@@ -169,7 +169,7 @@ static inline TrackBits GetSecondaryTunnelBridgeTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetAcrossTunnelBridgeTrackBits(TileIndex t)
|
inline TrackBits GetAcrossTunnelBridgeTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
return DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t));
|
||||||
@@ -184,7 +184,7 @@ static inline TrackBits GetAcrossTunnelBridgeTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetTunnelBridgeReservationTrackBits(TileIndex t)
|
inline TrackBits GetTunnelBridgeReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return HasTunnelReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE;
|
return HasTunnelReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE;
|
||||||
@@ -199,7 +199,7 @@ static inline TrackBits GetTunnelBridgeReservationTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return reserved track bits
|
* @return reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline TrackBits GetAcrossTunnelBridgeReservationTrackBits(TileIndex t)
|
inline TrackBits GetAcrossTunnelBridgeReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return HasTunnelReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE;
|
return HasTunnelReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE;
|
||||||
@@ -214,7 +214,7 @@ static inline TrackBits GetAcrossTunnelBridgeReservationTrackBits(TileIndex t)
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return whether there are reserved track bits
|
* @return whether there are reserved track bits
|
||||||
*/
|
*/
|
||||||
static inline bool HasAcrossTunnelBridgeReservation(TileIndex t)
|
inline bool HasAcrossTunnelBridgeReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTunnel(t)) {
|
if (IsTunnel(t)) {
|
||||||
return HasTunnelReservation(t);
|
return HasTunnelReservation(t);
|
||||||
@@ -228,7 +228,7 @@ static inline bool HasAcrossTunnelBridgeReservation(TileIndex t)
|
|||||||
* @param bits the track bits
|
* @param bits the track bits
|
||||||
* @return rail infrastructure count
|
* @return rail infrastructure count
|
||||||
*/
|
*/
|
||||||
static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(TrackBits bits)
|
inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(TrackBits bits)
|
||||||
{
|
{
|
||||||
uint pieces = CountBits(bits);
|
uint pieces = CountBits(bits);
|
||||||
if (TracksOverlap(bits)) pieces *= pieces;
|
if (TracksOverlap(bits)) pieces *= pieces;
|
||||||
@@ -241,7 +241,7 @@ static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(T
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return rail infrastructure count
|
* @return rail infrastructure count
|
||||||
*/
|
*/
|
||||||
static inline uint GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(TileIndex t)
|
inline uint GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsBridge(t) ? GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(GetPrimaryTunnelBridgeTrackBits(t)) : TUNNELBRIDGE_TRACKBIT_FACTOR;
|
return IsBridge(t) ? GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(GetPrimaryTunnelBridgeTrackBits(t)) : TUNNELBRIDGE_TRACKBIT_FACTOR;
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ static inline uint GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(TileInd
|
|||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @return rail infrastructure count
|
* @return rail infrastructure count
|
||||||
*/
|
*/
|
||||||
static inline uint GetTunnelBridgeHeadOnlySecondaryRailInfrastructureCount(TileIndex t)
|
inline uint GetTunnelBridgeHeadOnlySecondaryRailInfrastructureCount(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsBridge(t) && GetSecondaryTunnelBridgeTrackBits(t) ? (TUNNELBRIDGE_TRACKBIT_FACTOR / 2) : 0;
|
return IsBridge(t) && GetSecondaryTunnelBridgeTrackBits(t) ? (TUNNELBRIDGE_TRACKBIT_FACTOR / 2) : 0;
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@ static inline uint GetTunnelBridgeHeadOnlySecondaryRailInfrastructureCount(TileI
|
|||||||
* @param td track direction
|
* @param td track direction
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
||||||
@@ -278,7 +278,7 @@ static inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
|||||||
* @param td track direction
|
* @param td track direction
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
||||||
@@ -292,7 +292,7 @@ static inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
|||||||
* @param t track
|
* @param t track
|
||||||
* @return reservation state
|
* @return reservation state
|
||||||
*/
|
*/
|
||||||
static inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
||||||
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
||||||
@@ -304,7 +304,7 @@ static inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
|||||||
* @pre IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL
|
* @pre IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL
|
||||||
* @param tile the tile
|
* @param tile the tile
|
||||||
*/
|
*/
|
||||||
static inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
||||||
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
||||||
@@ -319,7 +319,7 @@ static inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
|||||||
* Declare tunnel/bridge entrance with signal simulation.
|
* Declare tunnel/bridge entrance with signal simulation.
|
||||||
* @param t the tunnel/bridge tile.
|
* @param t the tunnel/bridge tile.
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SetBit(_m[t].m5, 5);
|
SetBit(_m[t].m5, 5);
|
||||||
@@ -329,7 +329,7 @@ static inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
* Remove tunnel/bridge entrance with signal simulation.
|
* Remove tunnel/bridge entrance with signal simulation.
|
||||||
* @param t the tunnel/bridge tile.
|
* @param t the tunnel/bridge tile.
|
||||||
*/
|
*/
|
||||||
static inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
ClrBit(_m[t].m5, 5);
|
ClrBit(_m[t].m5, 5);
|
||||||
@@ -339,7 +339,7 @@ static inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
* Declare tunnel/bridge exit with signal simulation.
|
* Declare tunnel/bridge exit with signal simulation.
|
||||||
* @param t the tunnel/bridge tile.
|
* @param t the tunnel/bridge tile.
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SetBit(_m[t].m5, 6);
|
SetBit(_m[t].m5, 6);
|
||||||
@@ -349,7 +349,7 @@ static inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
|||||||
* Remove tunnel/bridge exit with signal simulation.
|
* Remove tunnel/bridge exit with signal simulation.
|
||||||
* @param t the tunnel/bridge tile.
|
* @param t the tunnel/bridge tile.
|
||||||
*/
|
*/
|
||||||
static inline void ClrTunnelBridgeSignalSimulationExit(TileIndex t)
|
inline void ClrTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
ClrBit(_m[t].m5, 6);
|
ClrBit(_m[t].m5, 6);
|
||||||
@@ -361,7 +361,7 @@ static inline void ClrTunnelBridgeSignalSimulationExit(TileIndex t)
|
|||||||
* @param t the tile that might be a tunnel/bridge.
|
* @param t the tile that might be a tunnel/bridge.
|
||||||
* @return true if and only if this tile is a tunnel/bridge with signal simulation.
|
* @return true if and only if this tile is a tunnel/bridge with signal simulation.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeWithSignalSimulation(TileIndex t)
|
inline bool IsTunnelBridgeWithSignalSimulation(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && (HasBit(_m[t].m5, 5) || HasBit(_m[t].m5, 6));
|
return IsTileType(t, MP_TUNNELBRIDGE) && (HasBit(_m[t].m5, 5) || HasBit(_m[t].m5, 6));
|
||||||
}
|
}
|
||||||
@@ -373,7 +373,7 @@ static inline bool IsTunnelBridgeWithSignalSimulation(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel/bridge entrance.
|
* @return true if and only if this tile is a tunnel/bridge entrance.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 5);
|
return HasBit(_m[t].m5, 5);
|
||||||
@@ -385,7 +385,7 @@ static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
* @param t the tile that might be a tunnel/bridge.
|
* @param t the tile that might be a tunnel/bridge.
|
||||||
* @return true if and only if this tile is a tunnel/bridge entrance.
|
* @return true if and only if this tile is a tunnel/bridge entrance.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationEntranceTile(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationEntranceTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 5);
|
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 5);
|
||||||
}
|
}
|
||||||
@@ -396,7 +396,7 @@ static inline bool IsTunnelBridgeSignalSimulationEntranceTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel/bridge entrance only.
|
* @return true if and only if this tile is a tunnel/bridge entrance only.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationEntranceOnly(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationEntranceOnly(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 5) && !HasBit(_m[t].m5, 6);
|
return HasBit(_m[t].m5, 5) && !HasBit(_m[t].m5, 6);
|
||||||
@@ -408,7 +408,7 @@ static inline bool IsTunnelBridgeSignalSimulationEntranceOnly(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel/bridge exit.
|
* @return true if and only if this tile is a tunnel/bridge exit.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 6);
|
return HasBit(_m[t].m5, 6);
|
||||||
@@ -419,7 +419,7 @@ static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
|||||||
* @param t the tile that might be a tunnel/bridge.
|
* @param t the tile that might be a tunnel/bridge.
|
||||||
* @return true if and only if this tile is a tunnel/bridge exit.
|
* @return true if and only if this tile is a tunnel/bridge exit.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationExitTile(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationExitTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 6);
|
return IsTileType(t, MP_TUNNELBRIDGE) && HasBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
@@ -430,7 +430,7 @@ static inline bool IsTunnelBridgeSignalSimulationExitTile(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel/bridge exit only.
|
* @return true if and only if this tile is a tunnel/bridge exit only.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return !HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
return !HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
||||||
@@ -442,7 +442,7 @@ static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
|||||||
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
* @pre IsTileType(t, MP_TUNNELBRIDGE)
|
||||||
* @return true if and only if this tile is a tunnel/bridge entrance and exit.
|
* @return true if and only if this tile is a tunnel/bridge entrance and exit.
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
return HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
||||||
@@ -454,7 +454,7 @@ static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
|||||||
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
||||||
* @return signal state
|
* @return signal state
|
||||||
*/
|
*/
|
||||||
static inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
||||||
return HasBit(_me[t].m6, 0) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
return HasBit(_me[t].m6, 0) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
||||||
@@ -466,7 +466,7 @@ static inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
|||||||
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
||||||
* @return signal state
|
* @return signal state
|
||||||
*/
|
*/
|
||||||
static inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
||||||
return HasBit(_me[t].m6, 7) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
return HasBit(_me[t].m6, 7) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
||||||
@@ -478,7 +478,7 @@ static inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
|||||||
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
||||||
* @param state signal state
|
* @param state signal state
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState state)
|
inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState state)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
||||||
SB(_me[t].m6, 0, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
SB(_me[t].m6, 0, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
||||||
@@ -490,72 +490,72 @@ static inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState s
|
|||||||
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
* @pre IsTunnelBridgeWithSignalSimulation(t)
|
||||||
* @param state signal state
|
* @param state signal state
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeExitSignalState(TileIndex t, SignalState state)
|
inline void SetTunnelBridgeExitSignalState(TileIndex t, SignalState state)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
||||||
SB(_me[t].m6, 7, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
SB(_me[t].m6, 7, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTunnelBridgeSemaphore(TileIndex t)
|
inline bool IsTunnelBridgeSemaphore(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return HasBit(_me[t].m6, 1);
|
return HasBit(_me[t].m6, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeSemaphore(TileIndex t, bool is_semaphore)
|
inline void SetTunnelBridgeSemaphore(TileIndex t, bool is_semaphore)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_me[t].m6, 1, 1, is_semaphore ? 1 : 0);
|
SB(_me[t].m6, 1, 1, is_semaphore ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTunnelBridgePBS(TileIndex t)
|
inline bool IsTunnelBridgePBS(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return HasBit(_me[t].m6, 6);
|
return HasBit(_me[t].m6, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTunnelBridgeEffectivelyPBS(TileIndex t)
|
inline bool IsTunnelBridgeEffectivelyPBS(TileIndex t)
|
||||||
{
|
{
|
||||||
return _settings_game.vehicle.train_braking_model == TBM_REALISTIC || IsTunnelBridgePBS(t);
|
return _settings_game.vehicle.train_braking_model == TBM_REALISTIC || IsTunnelBridgePBS(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgePBS(TileIndex t, bool is_pbs)
|
inline void SetTunnelBridgePBS(TileIndex t, bool is_pbs)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_me[t].m6, 6, 1, is_pbs ? 1 : 0);
|
SB(_me[t].m6, 6, 1, is_pbs ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetTunnelBridgeEntranceSignalAspect(TileIndex t)
|
inline uint8 GetTunnelBridgeEntranceSignalAspect(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return GB(_m[t].m3, 0, 3);
|
return GB(_m[t].m3, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeEntranceSignalAspect(TileIndex t, uint8 aspect)
|
inline void SetTunnelBridgeEntranceSignalAspect(TileIndex t, uint8 aspect)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_m[t].m3, 0, 3, aspect);
|
SB(_m[t].m3, 0, 3, aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetTunnelBridgeExitSignalAspect(TileIndex t)
|
inline uint8 GetTunnelBridgeExitSignalAspect(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return GB(_m[t].m3, 3, 3);
|
return GB(_m[t].m3, 3, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeExitSignalAspect(TileIndex t, uint8 aspect)
|
inline void SetTunnelBridgeExitSignalAspect(TileIndex t, uint8 aspect)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_m[t].m3, 3, 3, aspect);
|
SB(_m[t].m3, 3, 3, aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint GetTunnelBridgeSignalSimulationSpacing(TileIndex t)
|
inline uint GetTunnelBridgeSignalSimulationSpacing(TileIndex t)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailTunnelBridgeTile(t), t);
|
assert_tile(IsRailTunnelBridgeTile(t), t);
|
||||||
return 1 + GB(_me[t].m8, 12, 4);
|
return 1 + GB(_me[t].m8, 12, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeSignalSimulationSpacing(TileIndex t, uint spacing)
|
inline void SetTunnelBridgeSignalSimulationSpacing(TileIndex t, uint spacing)
|
||||||
{
|
{
|
||||||
assert_tile(IsRailTunnelBridgeTile(t), t);
|
assert_tile(IsRailTunnelBridgeTile(t), t);
|
||||||
SB(_me[t].m8, 12, 4, spacing - 1);
|
SB(_me[t].m8, 12, 4, spacing - 1);
|
||||||
@@ -565,7 +565,7 @@ static inline void SetTunnelBridgeSignalSimulationSpacing(TileIndex t, uint spac
|
|||||||
* Does tunnel/bridge signal tile have "one or more trace restrict mappings present" bit set
|
* Does tunnel/bridge signal tile have "one or more trace restrict mappings present" bit set
|
||||||
* @param tile the tile to check
|
* @param tile the tile to check
|
||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeRestrictedSignal(TileIndex tile)
|
inline bool IsTunnelBridgeRestrictedSignal(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(tile), tile);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(tile), tile);
|
||||||
return (bool) GB(_m[tile].m3, 6, 1);
|
return (bool) GB(_m[tile].m3, 6, 1);
|
||||||
@@ -575,33 +575,33 @@ static inline bool IsTunnelBridgeRestrictedSignal(TileIndex tile)
|
|||||||
* Set tunnel/bridge signal tile "one or more trace restrict mappings present" bit
|
* Set tunnel/bridge signal tile "one or more trace restrict mappings present" bit
|
||||||
* @param tile the tile to set
|
* @param tile the tile to set
|
||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeRestrictedSignal(TileIndex tile, bool is_restricted)
|
inline void SetTunnelBridgeRestrictedSignal(TileIndex tile, bool is_restricted)
|
||||||
{
|
{
|
||||||
assert_tile(IsTunnelBridgeWithSignalSimulation(tile), tile);
|
assert_tile(IsTunnelBridgeWithSignalSimulation(tile), tile);
|
||||||
SB(_m[tile].m3, 6, 1, is_restricted);
|
SB(_m[tile].m3, 6, 1, is_restricted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Trackdir GetTunnelBridgeExitTrackdir(TileIndex t, DiagDirection tunnel_bridge_dir)
|
inline Trackdir GetTunnelBridgeExitTrackdir(TileIndex t, DiagDirection tunnel_bridge_dir)
|
||||||
{
|
{
|
||||||
return TrackEnterdirToTrackdir((Track)FIND_FIRST_BIT(GetAcrossTunnelBridgeTrackBits(t)), ReverseDiagDir(tunnel_bridge_dir));
|
return TrackEnterdirToTrackdir((Track)FIND_FIRST_BIT(GetAcrossTunnelBridgeTrackBits(t)), ReverseDiagDir(tunnel_bridge_dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Trackdir GetTunnelBridgeExitTrackdir(TileIndex t)
|
inline Trackdir GetTunnelBridgeExitTrackdir(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetTunnelBridgeExitTrackdir(t, GetTunnelBridgeDirection(t));
|
return GetTunnelBridgeExitTrackdir(t, GetTunnelBridgeDirection(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Trackdir GetTunnelBridgeEntranceTrackdir(TileIndex t, DiagDirection tunnel_bridge_dir)
|
inline Trackdir GetTunnelBridgeEntranceTrackdir(TileIndex t, DiagDirection tunnel_bridge_dir)
|
||||||
{
|
{
|
||||||
return TrackExitdirToTrackdir((Track)FIND_FIRST_BIT(GetAcrossTunnelBridgeTrackBits(t)), tunnel_bridge_dir);
|
return TrackExitdirToTrackdir((Track)FIND_FIRST_BIT(GetAcrossTunnelBridgeTrackBits(t)), tunnel_bridge_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Trackdir GetTunnelBridgeEntranceTrackdir(TileIndex t)
|
inline Trackdir GetTunnelBridgeEntranceTrackdir(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetTunnelBridgeEntranceTrackdir(t, GetTunnelBridgeDirection(t));
|
return GetTunnelBridgeEntranceTrackdir(t, GetTunnelBridgeDirection(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeSignalStyle(TileIndex t, TileIndex end, uint8 style)
|
inline void SetTunnelBridgeSignalStyle(TileIndex t, TileIndex end, uint8 style)
|
||||||
{
|
{
|
||||||
if (style == 0 && !HasBit(_m[t].m3, 7)) return;
|
if (style == 0 && !HasBit(_m[t].m3, 7)) return;
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ static inline void SetTunnelBridgeSignalStyle(TileIndex t, TileIndex end, uint8
|
|||||||
SetTunnelBridgeSignalStyleExtended(t, end, style);
|
SetTunnelBridgeSignalStyleExtended(t, end, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8 GetTunnelBridgeSignalStyle(TileIndex t)
|
inline uint8 GetTunnelBridgeSignalStyle(TileIndex t)
|
||||||
{
|
{
|
||||||
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
if (likely(!HasBit(_m[t].m3, 7))) return 0;
|
||||||
|
|
||||||
|
@@ -169,7 +169,7 @@ Direction GetDirectionTowards(const Vehicle *v, int x, int y);
|
|||||||
* @param type Vehicle type being queried.
|
* @param type Vehicle type being queried.
|
||||||
* @return Vehicle type is buildable by a company.
|
* @return Vehicle type is buildable by a company.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCompanyBuildableVehicleType(VehicleType type)
|
inline bool IsCompanyBuildableVehicleType(VehicleType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VEH_TRAIN:
|
case VEH_TRAIN:
|
||||||
@@ -187,7 +187,7 @@ static inline bool IsCompanyBuildableVehicleType(VehicleType type)
|
|||||||
* @param v Vehicle being queried.
|
* @param v Vehicle being queried.
|
||||||
* @return Vehicle is buildable by a company.
|
* @return Vehicle is buildable by a company.
|
||||||
*/
|
*/
|
||||||
static inline bool IsCompanyBuildableVehicleType(const BaseVehicle *v)
|
inline bool IsCompanyBuildableVehicleType(const BaseVehicle *v)
|
||||||
{
|
{
|
||||||
return IsCompanyBuildableVehicleType(v->type);
|
return IsCompanyBuildableVehicleType(v->type);
|
||||||
}
|
}
|
||||||
@@ -205,42 +205,42 @@ extern const uint32 _veh_refit_proc_table[];
|
|||||||
extern const uint32 _send_to_depot_proc_table[];
|
extern const uint32 _send_to_depot_proc_table[];
|
||||||
|
|
||||||
/* Functions to find the right command for certain vehicle type */
|
/* Functions to find the right command for certain vehicle type */
|
||||||
static inline uint32 GetCmdBuildVeh(VehicleType type)
|
inline uint32 GetCmdBuildVeh(VehicleType type)
|
||||||
{
|
{
|
||||||
return _veh_build_proc_table[type];
|
return _veh_build_proc_table[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdBuildVeh(const BaseVehicle *v)
|
inline uint32 GetCmdBuildVeh(const BaseVehicle *v)
|
||||||
{
|
{
|
||||||
return GetCmdBuildVeh(v->type);
|
return GetCmdBuildVeh(v->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdSellVeh(VehicleType type)
|
inline uint32 GetCmdSellVeh(VehicleType type)
|
||||||
{
|
{
|
||||||
return _veh_sell_proc_table[type];
|
return _veh_sell_proc_table[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdSellVeh(const BaseVehicle *v)
|
inline uint32 GetCmdSellVeh(const BaseVehicle *v)
|
||||||
{
|
{
|
||||||
return GetCmdSellVeh(v->type);
|
return GetCmdSellVeh(v->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdRefitVeh(VehicleType type)
|
inline uint32 GetCmdRefitVeh(VehicleType type)
|
||||||
{
|
{
|
||||||
return _veh_refit_proc_table[type];
|
return _veh_refit_proc_table[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdRefitVeh(const BaseVehicle *v)
|
inline uint32 GetCmdRefitVeh(const BaseVehicle *v)
|
||||||
{
|
{
|
||||||
return GetCmdRefitVeh(v->type);
|
return GetCmdRefitVeh(v->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdSendToDepot(VehicleType type)
|
inline uint32 GetCmdSendToDepot(VehicleType type)
|
||||||
{
|
{
|
||||||
return _send_to_depot_proc_table[type];
|
return _send_to_depot_proc_table[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 GetCmdSendToDepot(const BaseVehicle *v)
|
inline uint32 GetCmdSendToDepot(const BaseVehicle *v)
|
||||||
{
|
{
|
||||||
return GetCmdSendToDepot(v->type);
|
return GetCmdSendToDepot(v->type);
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ void DirtyVehicleListWindowForVehicle(const Vehicle *v);
|
|||||||
* @param type the vehicle type to look at
|
* @param type the vehicle type to look at
|
||||||
* @return the height
|
* @return the height
|
||||||
*/
|
*/
|
||||||
static inline uint GetVehicleHeight(VehicleType type)
|
inline uint GetVehicleHeight(VehicleType type)
|
||||||
{
|
{
|
||||||
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
|
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ VehicleCellSize GetVehicleImageCellSize(VehicleType type, EngineImageType image_
|
|||||||
* @return corresponding window class
|
* @return corresponding window class
|
||||||
* @note works only for company buildable vehicle types
|
* @note works only for company buildable vehicle types
|
||||||
*/
|
*/
|
||||||
static inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
|
inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
|
||||||
{
|
{
|
||||||
switch (vt) {
|
switch (vt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
@@ -128,7 +128,7 @@ void SetMouseCursorVehicle(const Vehicle *v, EngineImageType image_type);
|
|||||||
* @param ref_window The window to check against.
|
* @param ref_window The window to check against.
|
||||||
* @return True if the focused window is about specified vehicle.
|
* @return True if the focused window is about specified vehicle.
|
||||||
*/
|
*/
|
||||||
static inline bool HasFocusedVehicleChanged(const VehicleID vid, Window *ref_window)
|
inline bool HasFocusedVehicleChanged(const VehicleID vid, Window *ref_window)
|
||||||
{
|
{
|
||||||
if (ref_window) {
|
if (ref_window) {
|
||||||
WindowClass wc = ref_window->window_class;
|
WindowClass wc = ref_window->window_class;
|
||||||
|
@@ -65,7 +65,7 @@ void HandleZoomMessage(Window *w, const Viewport *vp, WidgetID widget_zoom_in, W
|
|||||||
* @param w Window owning the viewport.
|
* @param w Window owning the viewport.
|
||||||
* @pre \a how should not be #ZOOM_NONE.
|
* @pre \a how should not be #ZOOM_NONE.
|
||||||
*/
|
*/
|
||||||
static inline void MaxZoomInOut(ZoomStateChange how, Window *w)
|
inline void MaxZoomInOut(ZoomStateChange how, Window *w)
|
||||||
{
|
{
|
||||||
while (DoZoomInOutWindow(how, w)) {};
|
while (DoZoomInOutWindow(how, w)) {};
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ void MarkTileDirtyByTile(const TileIndex tile, ViewportMarkDirtyFlags flags, int
|
|||||||
* @param bridge_level_offset Height of bridge on tile to also mark dirty. (Height level relative to north corner.)
|
* @param bridge_level_offset Height of bridge on tile to also mark dirty. (Height level relative to north corner.)
|
||||||
* @ingroup dirty
|
* @ingroup dirty
|
||||||
*/
|
*/
|
||||||
static inline void MarkTileDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE, int bridge_level_offset = 0)
|
inline void MarkTileDirtyByTile(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE, int bridge_level_offset = 0)
|
||||||
{
|
{
|
||||||
MarkTileDirtyByTile(tile, flags, bridge_level_offset, TileHeight(tile));
|
MarkTileDirtyByTile(tile, flags, bridge_level_offset, TileHeight(tile));
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
* Make a nice void tile ;)
|
* Make a nice void tile ;)
|
||||||
* @param t the tile to make void
|
* @param t the tile to make void
|
||||||
*/
|
*/
|
||||||
static inline void MakeVoid(TileIndex t)
|
inline void MakeVoid(TileIndex t)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_VOID);
|
SetTileType(t, MP_VOID);
|
||||||
SetTileHeight(t, 0);
|
SetTileHeight(t, 0);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user