mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Don't use enums for non-enumerated values. (#13031)
In the past we have used enums to hold an arbitrary values. These values are not enumerated types, so make them constants instead.pull/13037/head
parent
a86f9dba0f
commit
e1697a6ad1
|
@ -17,12 +17,10 @@
|
|||
* Base values for flight levels above ground level for 'normal' flight and holding patterns.
|
||||
* Due to speed and direction, the actual flight level may be higher.
|
||||
*/
|
||||
enum AircraftFlyingAltitude {
|
||||
AIRCRAFT_MIN_FLYING_ALTITUDE = 120, ///< Minimum flying altitude above tile.
|
||||
AIRCRAFT_MAX_FLYING_ALTITUDE = 360, ///< Maximum flying altitude above tile.
|
||||
PLANE_HOLD_MAX_FLYING_ALTITUDE = 150, ///< holding flying altitude above tile of planes.
|
||||
HELICOPTER_HOLD_MAX_FLYING_ALTITUDE = 184 ///< holding flying altitude above tile of helicopters.
|
||||
};
|
||||
static constexpr int AIRCRAFT_MIN_FLYING_ALTITUDE = 120; ///< Minimum flying altitude above tile.
|
||||
static constexpr int AIRCRAFT_MAX_FLYING_ALTITUDE = 360; ///< Maximum flying altitude above tile.
|
||||
static constexpr int PLANE_HOLD_MAX_FLYING_ALTITUDE = 150; ///< holding flying altitude above tile of planes.
|
||||
static constexpr int HELICOPTER_HOLD_MAX_FLYING_ALTITUDE = 184; ///< holding flying altitude above tile of helicopters.
|
||||
|
||||
struct Aircraft;
|
||||
|
||||
|
|
|
@ -630,13 +630,11 @@ void UpdateAircraftCache(Aircraft *v, bool update_range)
|
|||
/**
|
||||
* Special velocities for aircraft
|
||||
*/
|
||||
enum AircraftSpeedLimits {
|
||||
SPEED_LIMIT_TAXI = 50, ///< Maximum speed of an aircraft while taxiing
|
||||
SPEED_LIMIT_APPROACH = 230, ///< Maximum speed of an aircraft on finals
|
||||
SPEED_LIMIT_BROKEN = 320, ///< Maximum speed of an aircraft that is broken
|
||||
SPEED_LIMIT_HOLD = 425, ///< Maximum speed of an aircraft that flies the holding pattern
|
||||
SPEED_LIMIT_NONE = 0xFFFF, ///< No environmental speed limit. Speed limit is type dependent
|
||||
};
|
||||
static constexpr uint16_t SPEED_LIMIT_TAXI = 50; ///< Maximum speed of an aircraft while taxiing
|
||||
static constexpr uint16_t SPEED_LIMIT_APPROACH = 230; ///< Maximum speed of an aircraft on finals
|
||||
static constexpr uint16_t SPEED_LIMIT_BROKEN = 320; ///< Maximum speed of an aircraft that is broken
|
||||
static constexpr uint16_t SPEED_LIMIT_HOLD = 425; ///< Maximum speed of an aircraft that flies the holding pattern
|
||||
static constexpr uint16_t SPEED_LIMIT_NONE = UINT16_MAX; ///< No environmental speed limit. Speed limit is type dependent
|
||||
|
||||
/**
|
||||
* Sets the new speed for an aircraft
|
||||
|
|
|
@ -35,17 +35,14 @@ extern CargoMonitorMap _cargo_pickups;
|
|||
extern CargoMonitorMap _cargo_deliveries;
|
||||
|
||||
|
||||
/** Constants for encoding and extracting cargo monitors. */
|
||||
enum CargoCompanyBits {
|
||||
CCB_TOWN_IND_NUMBER_START = 0, ///< Start bit of the town or industry number.
|
||||
CCB_TOWN_IND_NUMBER_LENGTH = 16, ///< Number of bits of the town or industry number.
|
||||
CCB_IS_INDUSTRY_BIT = 16, ///< Bit indicating the town/industry number is an industry.
|
||||
CCB_IS_INDUSTRY_BIT_VALUE = 1ul << CCB_IS_INDUSTRY_BIT, ///< Value of the #CCB_IS_INDUSTRY_BIT bit.
|
||||
CCB_CARGO_TYPE_START = 19, ///< Start bit of the cargo type field.
|
||||
CCB_CARGO_TYPE_LENGTH = 6, ///< Number of bits of the cargo type field.
|
||||
CCB_COMPANY_START = 25, ///< Start bit of the company field.
|
||||
CCB_COMPANY_LENGTH = 4, ///< Number of bits of the company field.
|
||||
};
|
||||
/* Constants for encoding and extracting cargo monitors. */
|
||||
constexpr uint8_t CCB_TOWN_IND_NUMBER_START = 0; ///< Start bit of the town or industry number.
|
||||
constexpr uint8_t CCB_TOWN_IND_NUMBER_LENGTH = 16; ///< Number of bits of the town or industry number.
|
||||
constexpr uint8_t CCB_IS_INDUSTRY_BIT = 16; ///< Bit indicating the town/industry number is an industry.
|
||||
constexpr uint8_t CCB_CARGO_TYPE_START = 19; ///< Start bit of the cargo type field.
|
||||
constexpr uint8_t CCB_CARGO_TYPE_LENGTH = 6; ///< Number of bits of the cargo type field.
|
||||
constexpr uint8_t CCB_COMPANY_START = 25; ///< Start bit of the company field.
|
||||
constexpr uint8_t CCB_COMPANY_LENGTH = 4; ///< Number of bits of the company field.
|
||||
|
||||
static_assert(NUM_CARGO <= (1 << CCB_CARGO_TYPE_LENGTH));
|
||||
static_assert(MAX_COMPANIES <= (1 << CCB_COMPANY_LENGTH));
|
||||
|
|
|
@ -289,11 +289,9 @@ enum TextColour {
|
|||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(TextColour)
|
||||
|
||||
/** Defines a few values that are related to animations using palette changes */
|
||||
enum PaletteAnimationSizes {
|
||||
PALETTE_ANIM_SIZE = 28, ///< number of animated colours
|
||||
PALETTE_ANIM_START = 227, ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
|
||||
};
|
||||
/* A few values that are related to animations using palette changes */
|
||||
static constexpr uint8_t PALETTE_ANIM_SIZE = 28; ///< number of animated colours
|
||||
static constexpr uint8_t PALETTE_ANIM_START = 227; ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
|
||||
|
||||
/** Define the operation GfxFillRect performs */
|
||||
enum FillRectMode {
|
||||
|
|
|
@ -25,17 +25,15 @@ extern IndustryPool _industry_pool;
|
|||
|
||||
static const TimerGameEconomy::Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS = 5; ///< If a processing industry doesn't produce for this many consecutive economy years, it may close.
|
||||
|
||||
/**
|
||||
/*
|
||||
* Production level maximum, minimum and default values.
|
||||
* It is not a value been really used in order to change, but rather an indicator
|
||||
* of how the industry is behaving.
|
||||
*/
|
||||
enum ProductionLevels {
|
||||
PRODLEVEL_CLOSURE = 0x00, ///< signal set to actually close the industry
|
||||
PRODLEVEL_MINIMUM = 0x04, ///< below this level, the industry is set to be closing
|
||||
PRODLEVEL_DEFAULT = 0x10, ///< default level set when the industry is created
|
||||
PRODLEVEL_MAXIMUM = 0x80, ///< the industry is running at full speed
|
||||
};
|
||||
static constexpr uint8_t PRODLEVEL_CLOSURE = 0x00; ///< signal set to actually close the industry
|
||||
static constexpr uint8_t PRODLEVEL_MINIMUM = 0x04; ///< below this level, the industry is set to be closing
|
||||
static constexpr uint8_t PRODLEVEL_DEFAULT = 0x10; ///< default level set when the industry is created
|
||||
static constexpr uint8_t PRODLEVEL_MAXIMUM = 0x80; ///< the industry is running at full speed
|
||||
|
||||
/**
|
||||
* Flags to control/override the behaviour of an industry.
|
||||
|
|
|
@ -1548,14 +1548,12 @@ static uint8_t CalculateDesertLine()
|
|||
|
||||
bool GenerateLandscape(uint8_t mode)
|
||||
{
|
||||
/** Number of steps of landscape generation */
|
||||
enum GenLandscapeSteps {
|
||||
GLS_HEIGHTMAP = 3, ///< Loading a heightmap
|
||||
GLS_TERRAGENESIS = 5, ///< Terragenesis generator
|
||||
GLS_ORIGINAL = 2, ///< Original generator
|
||||
GLS_TROPIC = 12, ///< Extra steps needed for tropic landscape
|
||||
GLS_OTHER = 0, ///< Extra steps for other landscapes
|
||||
};
|
||||
/* Number of steps of landscape generation */
|
||||
static constexpr uint GLS_HEIGHTMAP = 3; ///< Loading a heightmap
|
||||
static constexpr uint GLS_TERRAGENESIS = 5; ///< Terragenesis generator
|
||||
static constexpr uint GLS_ORIGINAL = 2; ///< Original generator
|
||||
static constexpr uint GLS_TROPIC = 12; ///< Extra steps needed for tropic landscape
|
||||
static constexpr uint GLS_OTHER = 0; ///< Extra steps for other landscapes
|
||||
uint steps = (_settings_game.game_creation.landscape == LT_TROPIC) ? GLS_TROPIC : GLS_OTHER;
|
||||
|
||||
if (mode == GWM_HEIGHTMAP) {
|
||||
|
|
|
@ -346,14 +346,12 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
/**
|
||||
/*
|
||||
* Some boundaries to clamp against in order to avoid integer overflows.
|
||||
*/
|
||||
enum PathCapacityBoundaries {
|
||||
PATH_CAP_MULTIPLIER = 16,
|
||||
PATH_CAP_MIN_FREE = (INT_MIN + 1) / PATH_CAP_MULTIPLIER,
|
||||
PATH_CAP_MAX_FREE = (INT_MAX - 1) / PATH_CAP_MULTIPLIER
|
||||
};
|
||||
static constexpr int PATH_CAP_MULTIPLIER = 16;
|
||||
static constexpr int PATH_CAP_MIN_FREE = (INT_MIN + 1) / PATH_CAP_MULTIPLIER;
|
||||
static constexpr int PATH_CAP_MAX_FREE = (INT_MAX - 1) / PATH_CAP_MULTIPLIER;
|
||||
|
||||
uint distance; ///< Sum(distance of all legs up to this one).
|
||||
uint capacity; ///< This capacity is min(capacity) fom all edges.
|
||||
|
|
|
@ -23,11 +23,12 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
|
|||
enum RoadStopStatusFlags {
|
||||
RSSFB_BAY0_FREE = 0, ///< Non-zero when bay 0 is free
|
||||
RSSFB_BAY1_FREE = 1, ///< Non-zero when bay 1 is free
|
||||
RSSFB_BAY_COUNT = 2, ///< Max. number of bays
|
||||
RSSFB_BASE_ENTRY = 6, ///< Non-zero when the entries on this road stop are the primary, i.e. the ones to delete
|
||||
RSSFB_ENTRY_BUSY = 7, ///< Non-zero when roadstop entry is busy
|
||||
};
|
||||
|
||||
static constexpr uint8_t BAY_COUNT = 2; ///< Max. number of bays
|
||||
|
||||
/** Container for each entry point of a drive through road stop */
|
||||
struct Entry {
|
||||
private:
|
||||
|
@ -70,7 +71,7 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
|
|||
|
||||
/** Initializes a RoadStop */
|
||||
inline RoadStop(TileIndex tile = INVALID_TILE) :
|
||||
status((1 << RSSFB_BAY_COUNT) - 1),
|
||||
status((1 << BAY_COUNT) - 1),
|
||||
xy(tile)
|
||||
{ }
|
||||
|
||||
|
@ -82,7 +83,7 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
|
|||
*/
|
||||
inline bool HasFreeBay() const
|
||||
{
|
||||
return GB(this->status, 0, RSSFB_BAY_COUNT) != 0;
|
||||
return GB(this->status, 0, BAY_COUNT) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +93,7 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
|
|||
*/
|
||||
inline bool IsFreeBay(uint nr) const
|
||||
{
|
||||
assert(nr < RSSFB_BAY_COUNT);
|
||||
assert(nr < BAY_COUNT);
|
||||
return HasBit(this->status, nr);
|
||||
}
|
||||
|
||||
|
@ -173,7 +174,7 @@ private:
|
|||
*/
|
||||
inline void AllocateDriveThroughBay(uint nr)
|
||||
{
|
||||
assert(nr < RSSFB_BAY_COUNT);
|
||||
assert(nr < BAY_COUNT);
|
||||
ClrBit(this->status, nr);
|
||||
}
|
||||
|
||||
|
@ -183,7 +184,7 @@ private:
|
|||
*/
|
||||
inline void FreeBay(uint nr)
|
||||
{
|
||||
assert(nr < RSSFB_BAY_COUNT);
|
||||
assert(nr < BAY_COUNT);
|
||||
SetBit(this->status, nr);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -661,7 +661,7 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id)
|
|||
|
||||
if (type == SpriteType::Invalid) return false;
|
||||
|
||||
if (load_index >= MAX_SPRITES) {
|
||||
if (static_cast<uint>(load_index) >= MAX_SPRITES) {
|
||||
UserError("Tried to load too many sprites (#{}; max {})", load_index, MAX_SPRITES);
|
||||
}
|
||||
|
||||
|
|
|
@ -1312,11 +1312,9 @@ struct StationViewWindow : public Window {
|
|||
int accepts_lines; ///< Number of lines in the accepted cargo view.
|
||||
Scrollbar *vscroll;
|
||||
|
||||
/** Height of the #WID_SV_ACCEPT_RATING_LIST widget for different views. */
|
||||
enum AcceptListHeight {
|
||||
ALH_RATING = 13, ///< Height of the cargo ratings view.
|
||||
ALH_ACCEPTS = 3, ///< Height of the accepted cargo view.
|
||||
};
|
||||
/* Height of the #WID_SV_ACCEPT_RATING_LIST widget for different views. */
|
||||
static constexpr uint RATING_LINES = 13; ///< Height in lines of the cargo ratings view.
|
||||
static constexpr uint ACCEPTS_LINES = 3; ///< Height in lines of the accepted cargo view.
|
||||
|
||||
/** Names of the sorting options in the dropdown. */
|
||||
static inline const StringID sort_names[] = {
|
||||
|
@ -1358,8 +1356,8 @@ struct StationViewWindow : public Window {
|
|||
StationViewWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc),
|
||||
scroll_to_row(INT_MAX), grouping_index(0)
|
||||
{
|
||||
this->rating_lines = ALH_RATING;
|
||||
this->accepts_lines = ALH_ACCEPTS;
|
||||
this->rating_lines = RATING_LINES;
|
||||
this->accepts_lines = ACCEPTS_LINES;
|
||||
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_SV_SCROLLBAR);
|
||||
|
|
|
@ -73,18 +73,16 @@ enum StationHadVehicleOfType : uint8_t {
|
|||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
|
||||
|
||||
/** The different catchment areas used */
|
||||
enum CatchmentArea {
|
||||
CA_NONE = 0, ///< Catchment when the station has no facilities
|
||||
CA_BUS = 3, ///< Catchment for bus stops with "modified catchment" enabled
|
||||
CA_TRUCK = 3, ///< Catchment for truck stops with "modified catchment" enabled
|
||||
CA_TRAIN = 4, ///< Catchment for train stations with "modified catchment" enabled
|
||||
CA_DOCK = 5, ///< Catchment for docks with "modified catchment" enabled
|
||||
/* The different catchment area sizes. */
|
||||
static constexpr uint CA_NONE = 0; ///< Catchment when the station has no facilities
|
||||
static constexpr uint CA_BUS = 3; ///< Catchment for bus stops with "modified catchment" enabled
|
||||
static constexpr uint CA_TRUCK = 3; ///< Catchment for truck stops with "modified catchment" enabled
|
||||
static constexpr uint CA_TRAIN = 4; ///< Catchment for train stations with "modified catchment" enabled
|
||||
static constexpr uint CA_DOCK = 5; ///< Catchment for docks with "modified catchment" enabled
|
||||
|
||||
CA_UNMODIFIED = 4, ///< Catchment for all stations with "modified catchment" disabled
|
||||
static constexpr uint CA_UNMODIFIED = 4; ///< Catchment for all stations with "modified catchment" disabled
|
||||
|
||||
MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
|
||||
};
|
||||
static constexpr uint MAX_CATCHMENT = 10; ///< Maximum catchment for airports with "modified catchment" enabled
|
||||
|
||||
static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0'
|
||||
|
||||
|
|
|
@ -1521,19 +1521,18 @@ static const CursorID ANIMCURSOR_BUILDSIGNALS = ANIMCURSOR_FLAG | 4; ///< 1292 -
|
|||
* <li> PALETTE_SPRITE_WIDTH and PALETTE_SPRITE_START determine the position and number of
|
||||
* bits used for the recolouring process. For transparency, it must be 0x322.</li></ul>
|
||||
*/
|
||||
enum SpriteSetup {
|
||||
/* These bits are applied to sprite ID */
|
||||
TRANSPARENT_BIT = 31, ///< toggles transparency in the sprite
|
||||
RECOLOUR_BIT = 30, ///< toggles recolouring in the sprite
|
||||
CUSTOM_BIT = 29,
|
||||
OPAQUE_BIT = 28,
|
||||
|
||||
/* This bit is applied to palette ID */
|
||||
PALETTE_TEXT_RECOLOUR = 31, ///< Set if palette is actually a magic text recolour
|
||||
/* These bits are applied to sprite ID */
|
||||
static constexpr uint8_t TRANSPARENT_BIT = 31; ///< toggles transparency in the sprite
|
||||
static constexpr uint8_t RECOLOUR_BIT = 30; ///< toggles recolouring in the sprite
|
||||
static constexpr uint8_t CUSTOM_BIT = 29;
|
||||
static constexpr uint8_t OPAQUE_BIT = 28;
|
||||
|
||||
PALETTE_WIDTH = 24, ///< number of bits of the sprite containing the recolour palette
|
||||
SPRITE_WIDTH = 24, ///< number of bits for the sprite number
|
||||
};
|
||||
/* This bit is applied to palette ID */
|
||||
static constexpr uint8_t PALETTE_TEXT_RECOLOUR = 31; ///< Set if palette is actually a magic text recolour
|
||||
|
||||
static constexpr uint8_t PALETTE_WIDTH = 24; ///< number of bits of the sprite containing the recolour palette
|
||||
static constexpr uint8_t SPRITE_WIDTH = 24; ///< number of bits for the sprite number
|
||||
|
||||
/**
|
||||
* these masks change the colours of the palette for a sprite.
|
||||
|
@ -1543,25 +1542,21 @@ enum SpriteSetup {
|
|||
* @note Do not modify this enum. Alter SpriteSetup instead
|
||||
* @see SpriteSetup
|
||||
*/
|
||||
enum Modifiers {
|
||||
SPRITE_MODIFIER_CUSTOM_SPRITE = CUSTOM_BIT, ///< Set when a sprite originates from an Action 1
|
||||
SPRITE_MODIFIER_OPAQUE = OPAQUE_BIT, ///< Set when a sprite must not ever be displayed transparently
|
||||
PALETTE_MODIFIER_TRANSPARENT = TRANSPARENT_BIT, ///< when a sprite is to be displayed transparently, this bit needs to be set.
|
||||
PALETTE_MODIFIER_COLOUR = RECOLOUR_BIT, ///< this bit is set when a recolouring process is in action
|
||||
};
|
||||
static constexpr uint8_t SPRITE_MODIFIER_CUSTOM_SPRITE = CUSTOM_BIT; ///< Set when a sprite originates from an Action 1
|
||||
static constexpr uint8_t SPRITE_MODIFIER_OPAQUE = OPAQUE_BIT; ///< Set when a sprite must not ever be displayed transparently
|
||||
static constexpr uint8_t PALETTE_MODIFIER_TRANSPARENT = TRANSPARENT_BIT; ///< when a sprite is to be displayed transparently, this bit needs to be set.
|
||||
static constexpr uint8_t PALETTE_MODIFIER_COLOUR = RECOLOUR_BIT; ///< this bit is set when a recolouring process is in action
|
||||
|
||||
/**
|
||||
* Masks needed for sprite operations.
|
||||
* @note Do not modify this enum. Alter SpriteSetup instead
|
||||
* @see SpriteSetup
|
||||
*/
|
||||
enum SpriteMasks {
|
||||
MAX_SPRITES = 1U << SPRITE_WIDTH, ///< Maximum number of sprites that can be loaded at a given time
|
||||
SPRITE_MASK = MAX_SPRITES - 1, ///< The mask to for the main sprite
|
||||
static constexpr uint32_t MAX_SPRITES = 1U << SPRITE_WIDTH; ///< Maximum number of sprites that can be loaded at a given time
|
||||
static constexpr uint32_t SPRITE_MASK = MAX_SPRITES - 1; ///< The mask to for the main sprite
|
||||
|
||||
MAX_PALETTES = 1U << PALETTE_WIDTH,
|
||||
PALETTE_MASK = MAX_PALETTES - 1, ///< The mask for the auxiliary sprite (the one that takes care of recolouring)
|
||||
};
|
||||
static constexpr uint32_t MAX_PALETTES = 1U << PALETTE_WIDTH;
|
||||
static constexpr uint32_t PALETTE_MASK = MAX_PALETTES - 1; ///< The mask for the auxiliary sprite (the one that takes care of recolouring)
|
||||
|
||||
static_assert( (1U << TRANSPARENT_BIT & SPRITE_MASK) == 0 );
|
||||
static_assert( (1U << RECOLOUR_BIT & SPRITE_MASK) == 0 );
|
||||
|
|
|
@ -35,20 +35,18 @@ static constexpr uint16_t _month_date_from_year_day[] = {
|
|||
};
|
||||
#undef M
|
||||
|
||||
enum DaysTillMonth {
|
||||
ACCUM_JAN = 0,
|
||||
ACCUM_FEB = ACCUM_JAN + 31,
|
||||
ACCUM_MAR = ACCUM_FEB + 29,
|
||||
ACCUM_APR = ACCUM_MAR + 31,
|
||||
ACCUM_MAY = ACCUM_APR + 30,
|
||||
ACCUM_JUN = ACCUM_MAY + 31,
|
||||
ACCUM_JUL = ACCUM_JUN + 30,
|
||||
ACCUM_AUG = ACCUM_JUL + 31,
|
||||
ACCUM_SEP = ACCUM_AUG + 31,
|
||||
ACCUM_OCT = ACCUM_SEP + 30,
|
||||
ACCUM_NOV = ACCUM_OCT + 31,
|
||||
ACCUM_DEC = ACCUM_NOV + 30,
|
||||
};
|
||||
static constexpr uint16_t ACCUM_JAN = 0;
|
||||
static constexpr uint16_t ACCUM_FEB = ACCUM_JAN + 31;
|
||||
static constexpr uint16_t ACCUM_MAR = ACCUM_FEB + 29;
|
||||
static constexpr uint16_t ACCUM_APR = ACCUM_MAR + 31;
|
||||
static constexpr uint16_t ACCUM_MAY = ACCUM_APR + 30;
|
||||
static constexpr uint16_t ACCUM_JUN = ACCUM_MAY + 31;
|
||||
static constexpr uint16_t ACCUM_JUL = ACCUM_JUN + 30;
|
||||
static constexpr uint16_t ACCUM_AUG = ACCUM_JUL + 31;
|
||||
static constexpr uint16_t ACCUM_SEP = ACCUM_AUG + 31;
|
||||
static constexpr uint16_t ACCUM_OCT = ACCUM_SEP + 30;
|
||||
static constexpr uint16_t ACCUM_NOV = ACCUM_OCT + 31;
|
||||
static constexpr uint16_t ACCUM_DEC = ACCUM_NOV + 30;
|
||||
|
||||
/** Number of days to pass from the first day in the year before reaching the first of a month. */
|
||||
static constexpr uint16_t _accum_days_for_month[] = {
|
||||
|
|
|
@ -26,55 +26,53 @@ enum TownSize : uint8_t {
|
|||
};
|
||||
DECLARE_ENUM_AS_ADDABLE(TownSize)
|
||||
|
||||
enum Ratings {
|
||||
/* These refer to the maximums, so Appalling is -1000 to -400
|
||||
* MAXIMUM RATINGS BOUNDARIES */
|
||||
RATING_MINIMUM = -1000,
|
||||
RATING_APPALLING = -400,
|
||||
RATING_VERYPOOR = -200,
|
||||
RATING_POOR = 0,
|
||||
RATING_MEDIOCRE = 200,
|
||||
RATING_GOOD = 400,
|
||||
RATING_VERYGOOD = 600,
|
||||
RATING_EXCELLENT = 800,
|
||||
RATING_OUTSTANDING = 1000, ///< OUTSTANDING
|
||||
/* These refer to the maximums, so Appalling is -1000 to -400
|
||||
* MAXIMUM RATINGS BOUNDARIES */
|
||||
static constexpr int RATING_MINIMUM = -1000;
|
||||
static constexpr int RATING_APPALLING = -400;
|
||||
static constexpr int RATING_VERYPOOR = -200;
|
||||
static constexpr int RATING_POOR = 0;
|
||||
static constexpr int RATING_MEDIOCRE = 200;
|
||||
static constexpr int RATING_GOOD = 400;
|
||||
static constexpr int RATING_VERYGOOD = 600;
|
||||
static constexpr int RATING_EXCELLENT = 800;
|
||||
static constexpr int RATING_OUTSTANDING = 1000; ///< OUTSTANDING
|
||||
|
||||
RATING_MAXIMUM = RATING_OUTSTANDING,
|
||||
static constexpr int RATING_MAXIMUM = RATING_OUTSTANDING;
|
||||
|
||||
RATING_INITIAL = 500, ///< initial rating
|
||||
static constexpr int RATING_INITIAL = 500; ///< initial rating
|
||||
|
||||
/* RATINGS AFFECTING NUMBERS */
|
||||
RATING_TREE_DOWN_STEP = -35,
|
||||
RATING_TREE_MINIMUM = RATING_MINIMUM,
|
||||
RATING_TREE_UP_STEP = 7,
|
||||
RATING_TREE_MAXIMUM = 220,
|
||||
/* RATINGS AFFECTING NUMBERS */
|
||||
static constexpr int RATING_TREE_DOWN_STEP = -35;
|
||||
static constexpr int RATING_TREE_MINIMUM = RATING_MINIMUM;
|
||||
static constexpr int RATING_TREE_UP_STEP = 7;
|
||||
static constexpr int RATING_TREE_MAXIMUM = 220;
|
||||
|
||||
RATING_GROWTH_UP_STEP = 5, ///< when a town grows, all companies have rating increased a bit ...
|
||||
RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE, ///< ... up to RATING_MEDIOCRE
|
||||
RATING_STATION_UP_STEP = 12, ///< when a town grows, company gains reputation for all well serviced stations ...
|
||||
RATING_STATION_DOWN_STEP = -15, ///< ... but loses for badly serviced stations
|
||||
static constexpr int RATING_GROWTH_UP_STEP = 5; ///< when a town grows, all companies have rating increased a bit ...
|
||||
static constexpr int RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE; ///< ... up to RATING_MEDIOCRE
|
||||
static constexpr int RATING_STATION_UP_STEP = 12; ///< when a town grows, company gains reputation for all well serviced stations ...
|
||||
static constexpr int RATING_STATION_DOWN_STEP = -15; ///< ... but loses for badly serviced stations
|
||||
|
||||
RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, ///< penalty for removing town owned tunnel or bridge
|
||||
RATING_TUNNEL_BRIDGE_MINIMUM = 0, ///< minimum rating after removing tunnel or bridge
|
||||
RATING_TUNNEL_BRIDGE_NEEDED_LENIENT = 144, ///< rating needed, "Lenient" difficulty settings
|
||||
RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL = 208, ///< "Neutral"
|
||||
RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE = 400, ///< "Hostile"
|
||||
RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_DOWN_STEP = -250; ///< penalty for removing town owned tunnel or bridge
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_MINIMUM = 0; ///< minimum rating after removing tunnel or bridge
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_NEEDED_LENIENT = 144; ///< rating needed, "Lenient" difficulty settings
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL = 208; ///< "Neutral"
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE = 400; ///< "Hostile"
|
||||
static constexpr int RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = RATING_MINIMUM; ///< "Permissive" (local authority disabled)
|
||||
|
||||
RATING_ROAD_DOWN_STEP_INNER = -50, ///< removing a roadpiece in the middle
|
||||
RATING_ROAD_DOWN_STEP_EDGE = -18, ///< removing a roadpiece at the edge
|
||||
RATING_ROAD_MINIMUM = -100, ///< minimum rating after removing town owned road
|
||||
RATING_ROAD_NEEDED_LENIENT = 16, ///< rating needed, "Lenient" difficulty settings
|
||||
RATING_ROAD_NEEDED_NEUTRAL = 64, ///< "Neutral"
|
||||
RATING_ROAD_NEEDED_HOSTILE = 112, ///< "Hostile"
|
||||
RATING_ROAD_NEEDED_PERMISSIVE = RATING_MINIMUM, ///< "Permissive" (local authority disabled)
|
||||
static constexpr int RATING_ROAD_DOWN_STEP_INNER = -50; ///< removing a roadpiece in the middle
|
||||
static constexpr int RATING_ROAD_DOWN_STEP_EDGE = -18; ///< removing a roadpiece at the edge
|
||||
static constexpr int RATING_ROAD_MINIMUM = -100; ///< minimum rating after removing town owned road
|
||||
static constexpr int RATING_ROAD_NEEDED_LENIENT = 16; ///< rating needed, "Lenient" difficulty settings
|
||||
static constexpr int RATING_ROAD_NEEDED_NEUTRAL = 64; ///< "Neutral"
|
||||
static constexpr int RATING_ROAD_NEEDED_HOSTILE = 112; ///< "Hostile"
|
||||
static constexpr int RATING_ROAD_NEEDED_PERMISSIVE = RATING_MINIMUM; ///< "Permissive" (local authority disabled)
|
||||
|
||||
RATING_HOUSE_MINIMUM = RATING_MINIMUM,
|
||||
static constexpr int RATING_HOUSE_MINIMUM = RATING_MINIMUM;
|
||||
|
||||
RATING_BRIBE_UP_STEP = 200,
|
||||
RATING_BRIBE_MAXIMUM = 800,
|
||||
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
|
||||
};
|
||||
static constexpr int RATING_BRIBE_UP_STEP = 200;
|
||||
static constexpr int RATING_BRIBE_MAXIMUM = 800;
|
||||
static constexpr int RATING_BRIBE_DOWN_TO = -50; // XXX SHOULD BE SOMETHING LOWER?
|
||||
|
||||
/** Town Layouts. It needs to be 8bits, because we save and load it as such */
|
||||
enum TownLayout : uint8_t {
|
||||
|
|
|
@ -16,18 +16,16 @@
|
|||
/**
|
||||
* Bit field layout of m5 for water tiles.
|
||||
*/
|
||||
enum WaterTileTypeBitLayout {
|
||||
WBL_TYPE_BEGIN = 4, ///< Start of the 'type' bitfield.
|
||||
WBL_TYPE_COUNT = 4, ///< Length of the 'type' bitfield.
|
||||
static constexpr uint8_t WBL_TYPE_BEGIN = 4; ///< Start of the 'type' bitfield.
|
||||
static constexpr uint8_t WBL_TYPE_COUNT = 4; ///< Length of the 'type' bitfield.
|
||||
|
||||
WBL_LOCK_ORIENT_BEGIN = 0, ///< Start of lock orientation bitfield.
|
||||
WBL_LOCK_ORIENT_COUNT = 2, ///< Length of lock orientation bitfield.
|
||||
WBL_LOCK_PART_BEGIN = 2, ///< Start of lock part bitfield.
|
||||
WBL_LOCK_PART_COUNT = 2, ///< Length of lock part bitfield.
|
||||
static constexpr uint8_t WBL_LOCK_ORIENT_BEGIN = 0; ///< Start of lock orientation bitfield.
|
||||
static constexpr uint8_t WBL_LOCK_ORIENT_COUNT = 2; ///< Length of lock orientation bitfield.
|
||||
static constexpr uint8_t WBL_LOCK_PART_BEGIN = 2; ///< Start of lock part bitfield.
|
||||
static constexpr uint8_t WBL_LOCK_PART_COUNT = 2; ///< Length of lock part bitfield.
|
||||
|
||||
WBL_DEPOT_PART = 0, ///< Depot part flag.
|
||||
WBL_DEPOT_AXIS = 1, ///< Depot axis flag.
|
||||
};
|
||||
static constexpr uint8_t WBL_DEPOT_PART = 0; ///< Depot part flag.
|
||||
static constexpr uint8_t WBL_DEPOT_AXIS = 1; ///< Depot axis flag.
|
||||
|
||||
/** Available water tile types. */
|
||||
enum WaterTileType {
|
||||
|
|
|
@ -18,15 +18,13 @@
|
|||
#include "window_type.h"
|
||||
|
||||
/** Bits of the #WWT_MATRIX widget data. */
|
||||
enum MatrixWidgetValues {
|
||||
/* Number of column bits of the WWT_MATRIX widget data. */
|
||||
MAT_COL_START = 0, ///< Lowest bit of the number of columns.
|
||||
MAT_COL_BITS = 8, ///< Number of bits for the number of columns in the matrix.
|
||||
/* Number of column bits of the WWT_MATRIX widget data. */
|
||||
static constexpr uint8_t MAT_COL_START = 0; ///< Lowest bit of the number of columns.
|
||||
static constexpr uint8_t MAT_COL_BITS = 8; ///< Number of bits for the number of columns in the matrix.
|
||||
|
||||
/* Number of row bits of the WWT_MATRIX widget data. */
|
||||
MAT_ROW_START = 8, ///< Lowest bit of the number of rows.
|
||||
MAT_ROW_BITS = 8, ///< Number of bits for the number of rows in the matrix.
|
||||
};
|
||||
/* Number of row bits of the WWT_MATRIX widget data. */
|
||||
static constexpr uint8_t MAT_ROW_START = 8; ///< Lowest bit of the number of rows.
|
||||
static constexpr uint8_t MAT_ROW_BITS = 8; ///< Number of bits for the number of rows in the matrix.
|
||||
|
||||
/** Values for an arrow widget */
|
||||
enum ArrowWidgetValues {
|
||||
|
|
|
@ -2707,10 +2707,11 @@ enum MouseClick {
|
|||
MC_RIGHT,
|
||||
MC_DOUBLE_LEFT,
|
||||
MC_HOVER,
|
||||
|
||||
MAX_OFFSET_DOUBLE_CLICK = 5, ///< How much the mouse is allowed to move to call it a double click
|
||||
MAX_OFFSET_HOVER = 5, ///< Maximum mouse movement before stopping a hover event.
|
||||
};
|
||||
|
||||
static constexpr int MAX_OFFSET_DOUBLE_CLICK = 5; ///< How much the mouse is allowed to move to call it a double click
|
||||
static constexpr int MAX_OFFSET_HOVER = 5; ///< Maximum mouse movement before stopping a hover event.
|
||||
|
||||
extern EventState VpHandlePlaceSizingDrag();
|
||||
|
||||
const std::chrono::milliseconds TIME_BETWEEN_DOUBLE_CLICK(500); ///< Time between 2 left clicks before it becoming a double click.
|
||||
|
|
|
@ -81,17 +81,14 @@ private:
|
|||
* Distances used in drawing widgets.
|
||||
* These constants should not be used elsewhere, use scaled/unscaled WidgetDimensions instead.
|
||||
*/
|
||||
enum WidgetDrawDistances {
|
||||
WD_SHADEBOX_WIDTH = 12, ///< Minimum width of a standard shade box widget.
|
||||
WD_STICKYBOX_WIDTH = 12, ///< Minimum width of a standard sticky box widget.
|
||||
WD_DEBUGBOX_WIDTH = 12, ///< Minimum width of a standard debug box widget.
|
||||
WD_DEFSIZEBOX_WIDTH = 12, ///< Minimum width of a standard defsize box widget.
|
||||
WD_RESIZEBOX_WIDTH = 12, ///< Minimum width of a resize box widget.
|
||||
WD_CLOSEBOX_WIDTH = 11, ///< Minimum width of a close box widget.
|
||||
|
||||
WD_CAPTION_HEIGHT = 14, ///< Minimum height of a title bar.
|
||||
WD_DROPDOWN_HEIGHT = 12, ///< Minimum height of a drop down widget.
|
||||
};
|
||||
static constexpr uint WD_SHADEBOX_WIDTH = 12; ///< Minimum width of a standard shade box widget.
|
||||
static constexpr uint WD_STICKYBOX_WIDTH = 12; ///< Minimum width of a standard sticky box widget.
|
||||
static constexpr uint WD_DEBUGBOX_WIDTH = 12; ///< Minimum width of a standard debug box widget.
|
||||
static constexpr uint WD_DEFSIZEBOX_WIDTH = 12; ///< Minimum width of a standard defsize box widget.
|
||||
static constexpr uint WD_RESIZEBOX_WIDTH = 12; ///< Minimum width of a resize box widget.
|
||||
static constexpr uint WD_CLOSEBOX_WIDTH = 11; ///< Minimum width of a close box widget.
|
||||
static constexpr uint WD_CAPTION_HEIGHT = 14; ///< Minimum height of a title bar.
|
||||
static constexpr uint WD_DROPDOWN_HEIGHT = 12; ///< Minimum height of a drop down widget.
|
||||
|
||||
friend NWidgetLeaf;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue