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:
@@ -74,7 +74,7 @@ bool IsPossibleDockingTile(TileIndex t);
|
||||
* @param t Water tile to query.
|
||||
* @return Water tile type at the tile.
|
||||
*/
|
||||
static inline WaterTileType GetWaterTileType(TileIndex t)
|
||||
inline WaterTileType GetWaterTileType(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsTileType(t, MP_WATER), t);
|
||||
|
||||
@@ -92,7 +92,7 @@ static inline WaterTileType GetWaterTileType(TileIndex t)
|
||||
* @param t Tile to query.
|
||||
* @return True if the tiletype has a waterclass.
|
||||
*/
|
||||
static inline bool HasTileWaterClass(TileIndex t)
|
||||
inline bool HasTileWaterClass(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_TREES);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ static inline bool HasTileWaterClass(TileIndex t)
|
||||
* @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
|
||||
* @return Water class at the tile.
|
||||
*/
|
||||
static inline WaterClass GetWaterClass(TileIndex t)
|
||||
inline WaterClass GetWaterClass(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(HasTileWaterClass(t), t);
|
||||
return (WaterClass)GB(_m[t].m1, 5, 2);
|
||||
@@ -115,7 +115,7 @@ static inline WaterClass GetWaterClass(TileIndex t)
|
||||
* @param wc New water class.
|
||||
* @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
|
||||
*/
|
||||
static inline void SetWaterClass(TileIndex t, WaterClass wc)
|
||||
inline void SetWaterClass(TileIndex t, WaterClass wc)
|
||||
{
|
||||
dbg_assert_tile(HasTileWaterClass(t), t);
|
||||
SB(_m[t].m1, 5, 2, wc);
|
||||
@@ -127,7 +127,7 @@ static inline void SetWaterClass(TileIndex t, WaterClass wc)
|
||||
* @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
|
||||
* @return true iff on water
|
||||
*/
|
||||
static inline bool IsTileOnWater(TileIndex t)
|
||||
inline bool IsTileOnWater(TileIndex t)
|
||||
{
|
||||
return (GetWaterClass(t) != WATER_CLASS_INVALID);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ static inline bool IsTileOnWater(TileIndex t)
|
||||
* @return \c true if any type of clear water like ocean, river, or canal.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsWater(TileIndex t)
|
||||
inline bool IsWater(TileIndex t)
|
||||
{
|
||||
return GetWaterTileType(t) == WATER_TILE_CLEAR;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ static inline bool IsWater(TileIndex t)
|
||||
* @return \c true if it is a sea water tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsSea(TileIndex t)
|
||||
inline bool IsSea(TileIndex t)
|
||||
{
|
||||
return IsWater(t) && GetWaterClass(t) == WATER_CLASS_SEA;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ static inline bool IsSea(TileIndex t)
|
||||
* @return \c true if it is a canal tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsCanal(TileIndex t)
|
||||
inline bool IsCanal(TileIndex t)
|
||||
{
|
||||
return IsWater(t) && GetWaterClass(t) == WATER_CLASS_CANAL;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ static inline bool IsCanal(TileIndex t)
|
||||
* @return \c true if it is a river water tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsRiver(TileIndex t)
|
||||
inline bool IsRiver(TileIndex t)
|
||||
{
|
||||
return IsWater(t) && GetWaterClass(t) == WATER_CLASS_RIVER;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ static inline bool IsRiver(TileIndex t)
|
||||
* @param t Tile to query.
|
||||
* @return \c true if it is a plain water tile.
|
||||
*/
|
||||
static inline bool IsWaterTile(TileIndex t)
|
||||
inline bool IsWaterTile(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_WATER) && IsWater(t);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ static inline bool IsWaterTile(TileIndex t)
|
||||
* @return \c true if it is a sea water tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsCoast(TileIndex t)
|
||||
inline bool IsCoast(TileIndex t)
|
||||
{
|
||||
return GetWaterTileType(t) == WATER_TILE_COAST;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ static inline bool IsCoast(TileIndex t)
|
||||
* @param t Tile to query.
|
||||
* @return \c true if it is a coast.
|
||||
*/
|
||||
static inline bool IsCoastTile(TileIndex t)
|
||||
inline bool IsCoastTile(TileIndex t)
|
||||
{
|
||||
return (IsTileType(t, MP_WATER) && IsCoast(t)) || (IsTileType(t, MP_TREES) && GetWaterClass(t) != WATER_CLASS_INVALID);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ static inline bool IsCoastTile(TileIndex t)
|
||||
* @return \c true if it is a ship depot tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsShipDepot(TileIndex t)
|
||||
inline bool IsShipDepot(TileIndex t)
|
||||
{
|
||||
return GetWaterTileType(t) == WATER_TILE_DEPOT;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ static inline bool IsShipDepot(TileIndex t)
|
||||
* @param t Tile to query.
|
||||
* @return \c true if it is a ship depot tile.
|
||||
*/
|
||||
static inline bool IsShipDepotTile(TileIndex t)
|
||||
inline bool IsShipDepotTile(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_WATER) && IsShipDepot(t);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ static inline bool IsShipDepotTile(TileIndex t)
|
||||
* @return Axis of the depot.
|
||||
* @pre IsShipDepotTile(t)
|
||||
*/
|
||||
static inline Axis GetShipDepotAxis(TileIndex t)
|
||||
inline Axis GetShipDepotAxis(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsShipDepotTile(t), t);
|
||||
return (Axis)GB(_m[t].m5, WBL_DEPOT_AXIS, 1);
|
||||
@@ -246,7 +246,7 @@ static inline Axis GetShipDepotAxis(TileIndex t)
|
||||
* @return Part of the depot.
|
||||
* @pre IsShipDepotTile(t)
|
||||
*/
|
||||
static inline DepotPart GetShipDepotPart(TileIndex t)
|
||||
inline DepotPart GetShipDepotPart(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsShipDepotTile(t), t);
|
||||
return (DepotPart)GB(_m[t].m5, WBL_DEPOT_PART, 1);
|
||||
@@ -258,7 +258,7 @@ static inline DepotPart GetShipDepotPart(TileIndex t)
|
||||
* @return Direction of the depot.
|
||||
* @pre IsShipDepotTile(t)
|
||||
*/
|
||||
static inline DiagDirection GetShipDepotDirection(TileIndex t)
|
||||
inline DiagDirection GetShipDepotDirection(TileIndex t)
|
||||
{
|
||||
return XYNSToDiagDir(GetShipDepotAxis(t), GetShipDepotPart(t));
|
||||
}
|
||||
@@ -269,7 +269,7 @@ static inline DiagDirection GetShipDepotDirection(TileIndex t)
|
||||
* @return Tile containing the other section of the depot.
|
||||
* @pre IsShipDepotTile(t)
|
||||
*/
|
||||
static inline TileIndex GetOtherShipDepotTile(TileIndex t)
|
||||
inline TileIndex GetOtherShipDepotTile(TileIndex t)
|
||||
{
|
||||
return t + (GetShipDepotPart(t) != DEPOT_PART_NORTH ? -1 : 1) * (GetShipDepotAxis(t) != AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
|
||||
}
|
||||
@@ -280,7 +280,7 @@ static inline TileIndex GetOtherShipDepotTile(TileIndex t)
|
||||
* @return The northern tile of the depot.
|
||||
* @pre IsShipDepotTile(t)
|
||||
*/
|
||||
static inline TileIndex GetShipDepotNorthTile(TileIndex t)
|
||||
inline TileIndex GetShipDepotNorthTile(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsShipDepot(t), t);
|
||||
TileIndex tile2 = GetOtherShipDepotTile(t);
|
||||
@@ -294,7 +294,7 @@ static inline TileIndex GetShipDepotNorthTile(TileIndex t)
|
||||
* @return \c true if it is a water lock tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline bool IsLock(TileIndex t)
|
||||
inline bool IsLock(TileIndex t)
|
||||
{
|
||||
return GetWaterTileType(t) == WATER_TILE_LOCK;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static inline bool IsLock(TileIndex t)
|
||||
* @return Direction of the lock.
|
||||
* @pre IsTileType(t, MP_WATER) && IsLock(t)
|
||||
*/
|
||||
static inline DiagDirection GetLockDirection(TileIndex t)
|
||||
inline DiagDirection GetLockDirection(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsLock(t), t);
|
||||
return (DiagDirection)GB(_m[t].m5, WBL_LOCK_ORIENT_BEGIN, WBL_LOCK_ORIENT_COUNT);
|
||||
@@ -317,7 +317,7 @@ static inline DiagDirection GetLockDirection(TileIndex t)
|
||||
* @return The part.
|
||||
* @pre IsTileType(t, MP_WATER) && IsLock(t)
|
||||
*/
|
||||
static inline byte GetLockPart(TileIndex t)
|
||||
inline byte GetLockPart(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsLock(t), t);
|
||||
return GB(_m[t].m5, WBL_LOCK_PART_BEGIN, WBL_LOCK_PART_COUNT);
|
||||
@@ -329,7 +329,7 @@ static inline byte GetLockPart(TileIndex t)
|
||||
* @return Random bits of the tile.
|
||||
* @pre IsTileType(t, MP_WATER)
|
||||
*/
|
||||
static inline byte GetWaterTileRandomBits(TileIndex t)
|
||||
inline byte GetWaterTileRandomBits(TileIndex t)
|
||||
{
|
||||
dbg_assert_tile(IsTileType(t, MP_WATER), t);
|
||||
return _m[t].m4;
|
||||
@@ -341,7 +341,7 @@ static inline byte GetWaterTileRandomBits(TileIndex t)
|
||||
* @return true iff the tile has water at the ground.
|
||||
* @note Coast tiles are not considered waterish, even if there is water on a halftile.
|
||||
*/
|
||||
static inline bool HasTileWaterGround(TileIndex t)
|
||||
inline bool HasTileWaterGround(TileIndex t)
|
||||
{
|
||||
return HasTileWaterClass(t) && IsTileOnWater(t) && !IsCoastTile(t);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ static inline bool HasTileWaterGround(TileIndex t)
|
||||
* @param t the tile
|
||||
* @param b the docking tile state
|
||||
*/
|
||||
static inline void SetDockingTile(TileIndex t, bool b)
|
||||
inline void SetDockingTile(TileIndex t, bool b)
|
||||
{
|
||||
dbg_assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
|
||||
SB(_m[t].m1, 7, 1, b ? 1 : 0);
|
||||
@@ -362,7 +362,7 @@ static inline void SetDockingTile(TileIndex t, bool b)
|
||||
* Checks whether the tile is marked as a dockling tile.
|
||||
* @return true iff the tile is marked as a docking tile.
|
||||
*/
|
||||
static inline bool IsDockingTile(TileIndex t)
|
||||
inline bool IsDockingTile(TileIndex t)
|
||||
{
|
||||
return (IsTileType(t, MP_WATER) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)) && HasBit(_m[t].m1, 7);
|
||||
}
|
||||
@@ -372,7 +372,7 @@ static inline bool IsDockingTile(TileIndex t)
|
||||
* Helper function to make a coast tile.
|
||||
* @param t The tile to change into water
|
||||
*/
|
||||
static inline void MakeShore(TileIndex t)
|
||||
inline void MakeShore(TileIndex t)
|
||||
{
|
||||
SetTileType(t, MP_WATER);
|
||||
SetTileOwner(t, OWNER_WATER);
|
||||
@@ -393,7 +393,7 @@ static inline void MakeShore(TileIndex t)
|
||||
* @param wc The class of water the tile has to be
|
||||
* @param random_bits Eventual random bits to be set for this tile
|
||||
*/
|
||||
static inline void MakeWater(TileIndex t, Owner o, WaterClass wc, uint8 random_bits)
|
||||
inline void MakeWater(TileIndex t, Owner o, WaterClass wc, uint8 random_bits)
|
||||
{
|
||||
SetTileType(t, MP_WATER);
|
||||
SetTileOwner(t, o);
|
||||
@@ -411,7 +411,7 @@ static inline void MakeWater(TileIndex t, Owner o, WaterClass wc, uint8 random_b
|
||||
* Make a sea tile.
|
||||
* @param t The tile to change into sea
|
||||
*/
|
||||
static inline void MakeSea(TileIndex t)
|
||||
inline void MakeSea(TileIndex t)
|
||||
{
|
||||
MakeWater(t, OWNER_WATER, WATER_CLASS_SEA, 0);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ static inline void MakeSea(TileIndex t)
|
||||
* @param t The tile to change into river
|
||||
* @param random_bits Random bits to be set for this tile
|
||||
*/
|
||||
static inline void MakeRiver(TileIndex t, uint8 random_bits)
|
||||
inline void MakeRiver(TileIndex t, uint8 random_bits)
|
||||
{
|
||||
MakeWater(t, OWNER_WATER, WATER_CLASS_RIVER, random_bits);
|
||||
}
|
||||
@@ -432,7 +432,7 @@ static inline void MakeRiver(TileIndex t, uint8 random_bits)
|
||||
* @param o The owner of the canal
|
||||
* @param random_bits Random bits to be set for this tile
|
||||
*/
|
||||
static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
|
||||
inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
|
||||
{
|
||||
dbg_assert(o != OWNER_WATER);
|
||||
MakeWater(t, o, WATER_CLASS_CANAL, random_bits);
|
||||
@@ -447,7 +447,7 @@ static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
|
||||
* @param a Axis of the depot.
|
||||
* @param original_water_class Original water class.
|
||||
*/
|
||||
static inline void MakeShipDepot(TileIndex t, Owner o, DepotID did, DepotPart part, Axis a, WaterClass original_water_class)
|
||||
inline void MakeShipDepot(TileIndex t, Owner o, DepotID did, DepotPart part, Axis a, WaterClass original_water_class)
|
||||
{
|
||||
SetTileType(t, MP_WATER);
|
||||
SetTileOwner(t, o);
|
||||
@@ -470,7 +470,7 @@ static inline void MakeShipDepot(TileIndex t, Owner o, DepotID did, DepotPart pa
|
||||
* @param original_water_class Original water class.
|
||||
* @see MakeLock
|
||||
*/
|
||||
static inline void MakeLockTile(TileIndex t, Owner o, LockPart part, DiagDirection dir, WaterClass original_water_class)
|
||||
inline void MakeLockTile(TileIndex t, Owner o, LockPart part, DiagDirection dir, WaterClass original_water_class)
|
||||
{
|
||||
SetTileType(t, MP_WATER);
|
||||
SetTileOwner(t, o);
|
||||
@@ -493,7 +493,7 @@ static inline void MakeLockTile(TileIndex t, Owner o, LockPart part, DiagDirecti
|
||||
* @param wc_upper Original water class of the upper part.
|
||||
* @param wc_middle Original water class of the middle part.
|
||||
*/
|
||||
static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper, WaterClass wc_middle)
|
||||
inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper, WaterClass wc_middle)
|
||||
{
|
||||
TileIndexDiff delta = TileOffsByDiagDir(d);
|
||||
|
||||
@@ -510,7 +510,7 @@ static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc
|
||||
* @param t the tile
|
||||
* @param b the non-flooding water tile state
|
||||
*/
|
||||
static inline void SetNonFloodingWaterTile(TileIndex t, bool b)
|
||||
inline void SetNonFloodingWaterTile(TileIndex t, bool b)
|
||||
{
|
||||
dbg_assert(IsTileType(t, MP_WATER));
|
||||
SB(_m[t].m3, 0, 1, b ? 1 : 0);
|
||||
@@ -519,7 +519,7 @@ static inline void SetNonFloodingWaterTile(TileIndex t, bool b)
|
||||
* Checks whether the tile is marked as a non-flooding water tile.
|
||||
* @return true iff the tile is marked as a non-flooding water tile.
|
||||
*/
|
||||
static inline bool IsNonFloodingWaterTile(TileIndex t)
|
||||
inline bool IsNonFloodingWaterTile(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_WATER) && HasBit(_m[t].m3, 0);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ static inline bool IsNonFloodingWaterTile(TileIndex t)
|
||||
* Checks whether the tile type could have flooding behaviour
|
||||
* @return true iff the tile type is one where GetFloodingBehaviour could return a value other than FLOOD_NONE.
|
||||
*/
|
||||
static inline bool IsFloodingTypeTile(TileIndex t)
|
||||
inline bool IsFloodingTypeTile(TileIndex t)
|
||||
{
|
||||
static const uint16 mask = (1 << MP_WATER) | (1 << MP_STATION) | (1 << MP_INDUSTRY) | (1 << MP_RAILWAY) | (1 << MP_TREES) | (1 << MP_OBJECT) | (1 << MP_VOID);
|
||||
return HasBit(mask, GetTileType(t));
|
||||
|
||||
Reference in New Issue
Block a user