Merge branch 'master' into jgrpp
Remove the viewport sign cache as this is now superseded by the kd tree implementation # Conflicts: # src/crashlog.cpp # src/lang/english.txt # src/misc.cpp # src/pathfinder/follow_track.hpp # src/pbs.cpp # src/rail_cmd.cpp # src/saveload/vehicle_sl.cpp # src/settings.cpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/station.cpp # src/station_base.h # src/station_cmd.cpp # src/table/settings.ini # src/thread/thread_morphos.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/viewport.cpp # src/waypoint.cpp
This commit is contained in:
28
src/rail.h
28
src/rail.h
@@ -21,17 +21,24 @@
|
||||
#include "strings_type.h"
|
||||
#include "date_type.h"
|
||||
#include "signal_type.h"
|
||||
#include "settings_type.h"
|
||||
|
||||
/** Railtype flags. */
|
||||
enum RailTypeFlags {
|
||||
RTF_CATENARY = 0, ///< Bit number for drawing a catenary.
|
||||
RTF_NO_LEVEL_CROSSING = 1, ///< Bit number for disallowing level crossings.
|
||||
RTF_HIDDEN = 2, ///< Bit number for hiding from selection.
|
||||
RTF_NO_SPRITE_COMBINE = 3, ///< Bit number for using non-combined junctions.
|
||||
RTF_ALLOW_90DEG = 4, ///< Bit number for always allowed 90 degree turns, regardless of setting.
|
||||
RTF_DISALLOW_90DEG = 5, ///< Bit number for never allowed 90 degree turns, regardless of setting.
|
||||
|
||||
RTFB_NONE = 0, ///< All flags cleared.
|
||||
RTFB_CATENARY = 1 << RTF_CATENARY, ///< Value for drawing a catenary.
|
||||
RTFB_NO_LEVEL_CROSSING = 1 << RTF_NO_LEVEL_CROSSING, ///< Value for disallowing level crossings.
|
||||
RTFB_HIDDEN = 1 << RTF_HIDDEN, ///< Value for hiding from selection.
|
||||
RTFB_NO_SPRITE_COMBINE = 1 << RTF_NO_SPRITE_COMBINE, ///< Value for using non-combined junctions.
|
||||
RTFB_ALLOW_90DEG = 1 << RTF_ALLOW_90DEG, ///< Value for always allowed 90 degree turns, regardless of setting.
|
||||
RTFB_DISALLOW_90DEG = 1 << RTF_DISALLOW_90DEG, ///< Value for never allowed 90 degree turns, regardless of setting.
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(RailTypeFlags)
|
||||
|
||||
@@ -51,6 +58,7 @@ enum RailTypeSpriteGroup {
|
||||
RTSG_FENCES, ///< Fence images
|
||||
RTSG_TUNNEL_PORTAL, ///< Tunnel portal overlay
|
||||
RTSG_SIGNALS, ///< Signal images
|
||||
RTSG_GROUND_COMPLETE, ///< Complete ground images
|
||||
RTSG_END,
|
||||
};
|
||||
|
||||
@@ -338,6 +346,26 @@ static inline bool RailNoLevelCrossings(RailType rt)
|
||||
return HasBit(GetRailTypeInfo(rt)->flags, RTF_NO_LEVEL_CROSSING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if 90 degree turns are disallowed between two railtypes.
|
||||
* @param rt1 First railtype to test for.
|
||||
* @param rt2 Second railtype to test for.
|
||||
* @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.
|
||||
*/
|
||||
static inline bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def = _settings_game.pf.forbid_90_deg)
|
||||
{
|
||||
if (rt1 == INVALID_RAILTYPE || rt2 == INVALID_RAILTYPE) return def;
|
||||
|
||||
const RailtypeInfo *rti1 = GetRailTypeInfo(rt1);
|
||||
const RailtypeInfo *rti2 = GetRailTypeInfo(rt2);
|
||||
|
||||
bool rt1_90deg = HasBit(rti1->flags, RTF_DISALLOW_90DEG) || (!HasBit(rti1->flags, RTF_ALLOW_90DEG) && def);
|
||||
bool rt2_90deg = HasBit(rti2->flags, RTF_DISALLOW_90DEG) || (!HasBit(rti2->flags, RTF_ALLOW_90DEG) && def);
|
||||
|
||||
return rt1_90deg || rt2_90deg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cost of building the specified railtype.
|
||||
* @param railtype The railtype being built.
|
||||
|
Reference in New Issue
Block a user