diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 97f4fd5f4b..46c88c3b5d 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -16,9 +16,9 @@ #include #include -#define WW 400 -#define WH 350 -#define TABHEIGHT 50 +constexpr int32_t WW = 400; +constexpr int32_t WH = 350; +constexpr int32_t TABHEIGHT = 50; // clang-format off enum diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index 07044a6261..c2cd216a7b 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -22,8 +22,8 @@ #include #include -#define WW 113 -#define WH 96 +constexpr int32_t WW = 113; +constexpr int32_t WH = 96; // clang-format off enum WINDOW_BANNER_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 5eac72354b..31264ed571 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -32,10 +32,10 @@ enum { WIDX_SCROLL }; -#define WW 500 -#define WH 400 -#define MIN_WW 300 -#define MIN_WH 200 +constexpr int32_t WW = 500; +constexpr int32_t WH = 400; +constexpr int32_t MIN_WW = 300; +constexpr int32_t MIN_WH = 200; static rct_widget window_changelog_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, // panel / background diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 01e0f79552..156ec11d85 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -175,18 +175,18 @@ enum WINDOW_CHEATS_WIDGET_IDX #pragma region MEASUREMENTS -#define WW 249 -#define WH 300 -#define TAB_HEIGHT 43 -#define XSPA 5 // X spacing -#define YSPA 5 // Y spacing -#define XOS 6 + XSPA // X offset from left -#define YOS TAB_HEIGHT + YSPA // Y offset from top (includes tabs height) -#define BTNW 110 // button width -#define BTNH 16 // button height -#define OPTW 220 // Option (checkbox) width (two columns) -#define OPTH 10 // Option (checkbox) height (two columns) -#define GROUP_SPACE 6 +constexpr int32_t WW = 249; +constexpr int32_t WH = 300; +constexpr int32_t TAB_HEIGHT = 43; +constexpr int32_t XSPA = 5; // X spacing +constexpr int32_t YSPA = 5; // Y spacing +constexpr int32_t XOS = 6 + XSPA; // X offset from left +constexpr int32_t YOS = TAB_HEIGHT + YSPA; // Y offset from top (includes tabs height) +constexpr int32_t BTNW = 110; // button width +constexpr int32_t BTNH = 16; // button height +constexpr int32_t OPTW = 220; // Option (checkbox) width (two columns) +constexpr int32_t OPTH = 10; // Option (checkbox) height (two columns) +constexpr int32_t GROUP_SPACE = 6; #define YPL(ROW) ((int16_t)(YOS + ((BTNH + YSPA) * ROW))) #define HPL(ROW) ((int16_t)(YPL(ROW) + BTNH)) @@ -200,7 +200,7 @@ enum WINDOW_CHEATS_WIDGET_IDX #define MAX_BTN_LEFT ((int16_t)(XPL(1.5))) #define MAX_BTN_RIGHT ((int16_t)(WPL(1))) -#define TXTO 3 // Text horizontal offset from button left (for button text) +constexpr int32_t TXTO = 3; // Text horizontal offset from button left (for button text) #pragma endregion #define MAIN_CHEATS_WIDGETS \ diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 412ff6a5ba..a36432ba6e 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -32,8 +32,8 @@ enum WINDOW_DEBUG_PAINT_WIDGET_IDX WIDX_TOGGLE_SHOW_DIRTY_VISUALS, }; -#define WINDOW_WIDTH (200) -#define WINDOW_HEIGHT (8 + 15 + 15 + 15 + 15 + 11 + 8) +constexpr int32_t WINDOW_WIDTH = 200; +constexpr int32_t WINDOW_HEIGHT = 8 + 15 + 15 + 15 + 15 + 11 + 8; static rct_widget window_debug_paint_widgets[] = { { WWT_FRAME, 0, 0, WINDOW_WIDTH - 1, 0, WINDOW_HEIGHT - 1, STR_NONE, STR_NONE }, diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 8b652c69b6..058ddb1e18 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -16,8 +16,8 @@ #include #include -#define WW 200 -#define WH 100 +constexpr int32_t WW = 200; +constexpr int32_t WH = 100; static money32 _demolishRideCost; diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index d63e0fc712..2a5bfd9280 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -18,9 +18,9 @@ #include // The maximum number of rows to list before items overflow into new columns -#define DROPDOWN_TEXT_MAX_ROWS 32 +constexpr int32_t DROPDOWN_TEXT_MAX_ROWS = 32; -#define DROPDOWN_ITEM_HEIGHT 12 +constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12; int32_t gAppropriateImageDropdownItemsPerRow[] = { 1, 1, 1, 1, 2, 2, 3, 3, 4, 3, 5, 4, 4, 5, 5, 5, 4, 5, 6, 5, 5, 7, 4, 5, 6, 5, 6, 6, 6, 6, 6, 8, 8, 0, diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 92e9bf4d16..533fb5ddf3 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -26,8 +26,8 @@ #pragma region Widgets -#define WW 600 -#define WH 400 +constexpr int32_t WW = 600; +constexpr int32_t WH = 400; // clang-format off enum { diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 204dcc0569..4556c8a041 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -34,11 +34,11 @@ enum { WIDX_CANCEL }; -#define WW 380 -#define WH 448 -#define WW_LESS_PADDING (WW - 4) -#define PREVIEW_BUTTONS_LEFT (WW - 25) -#define ACTION_BUTTONS_LEFT (WW - 100) +constexpr int32_t WW = 380; +constexpr int32_t WH = 448; +constexpr int32_t WW_LESS_PADDING = WW - 4; +constexpr int32_t PREVIEW_BUTTONS_LEFT = WW - 25; +constexpr int32_t ACTION_BUTTONS_LEFT = WW - 100; static rct_widget window_install_track_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH-1, STR_NONE, STR_NONE }, diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 147945ebf7..287823a0f4 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -91,8 +91,8 @@ static rct_window_event_list window_land_rights_events = { }; // clang-format on -#define LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS 0 -#define LAND_RIGHTS_MODE_BUY_LAND 1 +constexpr uint8_t LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS = 0; +constexpr uint8_t LAND_RIGHTS_MODE_BUY_LAND = 1; static uint8_t _landRightsMode; static money32 _landRightsCost; diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index d3a57e9206..d4e9dc2c4e 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -38,8 +38,8 @@ #pragma region Widgets -#define WW 340 -#define WH 400 +constexpr int32_t WW = 340; +constexpr int32_t WH = 400; // clang-format off enum @@ -1115,8 +1115,8 @@ static void window_loadsave_select(rct_window* w, const char* path) #pragma region Overwrite prompt -#define OVERWRITE_WW 200 -#define OVERWRITE_WH 100 +constexpr int32_t OVERWRITE_WW = 200; +constexpr int32_t OVERWRITE_WH = 100; enum { diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index f402789e4c..5fcbd7fa07 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -34,7 +34,7 @@ #define MAP_COLOUR(colour) MAP_COLOUR_2(colour, colour) #define MAP_COLOUR_UNOWNED(colour) (PALETTE_INDEX_10 | ((colour)&0xFF00)) -#define MAP_WINDOW_MAP_SIZE (MAXIMUM_MAP_SIZE_TECHNICAL * 2) +constexpr int32_t MAP_WINDOW_MAP_SIZE = MAXIMUM_MAP_SIZE_TECHNICAL * 2; // Some functions manipulate coordinates on the map. These are the coordinates of the pixels in the // minimap. In order to distinguish those from actual coordinates, we use a separate name. diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 4f8e39edd1..646f150b4a 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -110,8 +110,8 @@ enum { #pragma region Widgets -#define WW 250 -#define WH 273 +constexpr int32_t WW = 250; +constexpr int32_t WH = 273; #define SHARED_WIDGETS \ { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, /* WIDX_BACKGROUND */ \ @@ -490,11 +490,11 @@ static constexpr const int32_t TabAnimationLoops[WINDOW_MAPGEN_PAGE_COUNT] = { }; // clang-format on -#define BASESIZE_MIN 0 -#define BASESIZE_MAX 60 -#define WATERLEVEL_MIN 0 -#define WATERLEVEL_MAX 54 -#define MAX_SMOOTH_ITERATIONS 20 +constexpr int32_t BASESIZE_MIN = 0; +constexpr int32_t BASESIZE_MAX = 60; +constexpr int32_t WATERLEVEL_MIN = 0; +constexpr int32_t WATERLEVEL_MAX = 54; +constexpr int32_t MAX_SMOOTH_ITERATIONS = 20; static void window_mapgen_set_page(rct_window* w, int32_t page); static void window_mapgen_set_pressed_tab(rct_window* w); diff --git a/src/openrct2-ui/windows/Network.cpp b/src/openrct2-ui/windows/Network.cpp index 9371195c70..a95a9dc421 100644 --- a/src/openrct2-ui/windows/Network.cpp +++ b/src/openrct2-ui/windows/Network.cpp @@ -26,8 +26,8 @@ enum { WINDOW_NETWORK_PAGE_INFORMATION, }; -#define WW 450 -#define WH 210 +constexpr int32_t WW = 450; +constexpr int32_t WH = 210; enum WINDOW_NETWORK_WIDGET_IDX { WIDX_BACKGROUND, diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 9397f80000..596fdb5b20 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -20,7 +20,7 @@ #include #include -#define SELECTED_RIDE_UNDEFINED ((uint16_t)0xFFFF) +constexpr uint16_t SELECTED_RIDE_UNDEFINED = 0xFFFF; // clang-format off enum WINDOW_NEW_CAMPAIGN_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 4867a9368f..6815ce2c11 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -33,9 +33,9 @@ #include #include -#define AVAILABILITY_STRING_SIZE 256 -#define WH 382 -#define WW 601 +constexpr size_t AVAILABILITY_STRING_SIZE = 256; +constexpr int32_t WH = 382; +constexpr int32_t WW = 601; static uint8_t _windowNewRideCurrentTab; static ride_list_item _windowNewRideHighlightedItem[6]; diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index fb742d845a..84fbecbcc8 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -263,13 +263,12 @@ enum WINDOW_OBJECT_LOAD_ERROR_WIDGET_IDX { WIDX_DOWNLOAD_ALL }; -#define WW 450 -#define WH 400 -#define WW_LESS_PADDING (WW - 5) -#define NAME_COL_LEFT 4 -#define SOURCE_COL_LEFT ((WW_LESS_PADDING / 4) + 1) -#define TYPE_COL_LEFT (5 * WW_LESS_PADDING / 8 + 1) -#define LIST_ITEM_HEIGHT 10 +constexpr int32_t WW = 450; +constexpr int32_t WH = 400; +constexpr int32_t WW_LESS_PADDING = WW - 5; +constexpr int32_t NAME_COL_LEFT = 4; +constexpr int32_t SOURCE_COL_LEFT = (WW_LESS_PADDING / 4) + 1; +constexpr int32_t TYPE_COL_LEFT = 5 * WW_LESS_PADDING / 8 + 1; static rct_widget window_object_load_error_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, // Background diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 20411fa7db..cb6f777e21 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -197,8 +197,8 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_NEWS_CHECKBOX }; -#define WW 310 -#define WH 332 +constexpr int32_t WW = 310; +constexpr int32_t WH = 332; #ifndef DISABLE_TWITCH #define TWITCH_TAB_SPRITE IMAGE_TYPE_REMAP | SPR_TAB diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 8dcab81a9b..ff3923ae52 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -202,7 +202,7 @@ enum { WIDX_SHOW_GUESTS_QUEUING }; -#define RCT1_LIGHT_OFFSET 4 +constexpr int32_t RCT1_LIGHT_OFFSET = 4; #define MAIN_RIDE_WIDGETS \ { WWT_FRAME, 0, 0, 315, 0, 206, 0xFFFFFFFF, STR_NONE }, \ diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index ecce651315..3f09049407 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -26,11 +26,11 @@ #include #include -#define WINDOW_SCENERY_WIDTH 634 -#define WINDOW_SCENERY_HEIGHT 180 -#define SCENERY_BUTTON_WIDTH 66 -#define SCENERY_BUTTON_HEIGHT 80 -#define SCENERY_WINDOW_TABS (MAX_SCENERY_GROUP_OBJECTS + 1) // The + 1 is for the 'Miscellaneous' tab +constexpr int32_t WINDOW_SCENERY_WIDTH = 634; +constexpr int32_t WINDOW_SCENERY_HEIGHT = 180; +constexpr int32_t SCENERY_BUTTON_WIDTH = 66; +constexpr int32_t SCENERY_BUTTON_HEIGHT = 80; +constexpr int32_t SCENERY_WINDOW_TABS = MAX_SCENERY_GROUP_OBJECTS + 1; // The + 1 is for the 'Miscellaneous' tab // clang-format off enum { diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index b08a5f8dd1..bde8d2b8b1 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -46,8 +46,8 @@ enum { WIDX_LOAD_SERVER }; -#define WW 300 -#define WH 154 +constexpr int32_t WW = 300; +constexpr int32_t WH = 154; static rct_widget window_server_start_widgets[] = { { WWT_FRAME, 0, 0, WW-1, 0, WH-1, STR_NONE, STR_NONE }, // panel / background diff --git a/src/openrct2-ui/windows/ShortcutKeyChange.cpp b/src/openrct2-ui/windows/ShortcutKeyChange.cpp index 9989b1c0b7..9393cf6ace 100644 --- a/src/openrct2-ui/windows/ShortcutKeyChange.cpp +++ b/src/openrct2-ui/windows/ShortcutKeyChange.cpp @@ -15,8 +15,8 @@ #include #include -#define WW 250 -#define WH 60 +constexpr int32_t WW = 250; +constexpr int32_t WH = 60; // clang-format off enum WINDOW_SHORTCUT_CHANGE_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 47aae89092..9854f47268 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -15,11 +15,11 @@ #include #include -#define WW 420 -#define WH 280 +constexpr int32_t WW = 420; +constexpr int32_t WH = 280; -#define WW_SC_MAX 1200 -#define WH_SC_MAX 800 +constexpr int32_t WW_SC_MAX = 1200; +constexpr int32_t WH_SC_MAX = 800; // clang-format off enum WINDOW_SHORTCUT_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 6eb04610c6..175627f562 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -25,8 +25,8 @@ #include #include -#define WW 113 -#define WH 96 +constexpr int32_t WW = 113; +constexpr int32_t WH = 96; // clang-format off enum WINDOW_SIGN_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 8b28da26bb..62b0227b1d 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -31,8 +31,8 @@ #include #include -#define WW 190 -#define WH 180 +constexpr int32_t WW = 190; +constexpr int32_t WH = 180; // clang-format off enum WINDOW_STAFF_PAGE { diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 439e6c2a48..21af27cc8c 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -16,8 +16,8 @@ #include #include -#define WW 200 -#define WH 100 +constexpr int32_t WW = 200; +constexpr int32_t WH = 100; // clang-format off enum WINDOW_STAFF_FIRE_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 361c6a82d3..0747509dbd 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -102,10 +102,10 @@ enum WINDOW_STAFF_LIST_WIDGET_IDX { WIDX_STAFF_LIST_MAP, }; -#define WW 320 -#define WH 270 -#define MAX_WW 500 -#define MAX_WH 450 +constexpr int32_t WW = 320; +constexpr int32_t WH = 270; +constexpr int32_t MAX_WW = 500; +constexpr int32_t MAX_WH = 450; static rct_widget window_staff_list_widgets[] = { { WWT_FRAME, 0, 0, 319, 0, 269, 0xFFFFFFFF, STR_NONE }, // panel / background diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index be30cbfefb..3cc21b2f04 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -25,8 +25,8 @@ #include #include -#define WW 250 -#define WH 90 +constexpr int32_t WW = 250; +constexpr int32_t WH = 90; // clang-format off enum WINDOW_TEXT_INPUT_WIDGET_IDX { diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 06e8a0244f..09a33bbf51 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -200,33 +200,33 @@ enum WINDOW_TILE_INSPECTOR_WIDGET_IDX { }; // Window sizes -#define WW 400 -#define WH 170 -#define MIN_WW WW -#define MAX_WW WW -#define MIN_WH 130 -#define MAX_WH 800 +constexpr int32_t WW = 400; +constexpr int32_t WH = 170; +constexpr int32_t MIN_WW = WW; +constexpr int32_t MAX_WW = WW; +constexpr int32_t MIN_WH = 130; +constexpr int32_t MAX_WH = 800; // Button space for top buttons -#define BW (WW - 5) // Button's right side -#define BX (BW - 23) // Button's left side -#define BY 17 // Button's Top -#define BH (BY + 23) // Button's Bottom -#define BS 24 +constexpr int32_t BW = WW - 5; // Button's right side +constexpr int32_t BX = BW - 23; // Button's left side +constexpr int32_t BY = 17; // Button's Top +constexpr int32_t BH = BY + 23; // Button's Bottom +constexpr int32_t BS = 24; // Column offsets for the table headers -#define COL_X_TYPE 3 // Type -#define COL_X_BH (COL_X_TYPE + 312) // Base height -#define COL_X_CH (COL_X_BH + 20) // Clearance height -#define COL_X_GF (COL_X_CH + 20) // Ghost flag -#define COL_X_LF (COL_X_GF + 12) // Last for tile flag +constexpr int32_t COL_X_TYPE = 3; // Type +constexpr int32_t COL_X_BH = COL_X_TYPE + 312; // Base height +constexpr int32_t COL_X_CH = COL_X_BH + 20; // Clearance height +constexpr int32_t COL_X_GF = COL_X_CH + 20; // Ghost flag +constexpr int32_t COL_X_LF = COL_X_GF + 12; // Last for tile flag -#define PADDING_BOTTOM 15 -#define GROUPBOX_PADDING 6 -#define HORIZONTAL_GROUPBOX_PADDING 5 -#define VERTICAL_GROUPBOX_PADDING 4 -#define BUTTONW 130 -#define BUTTONH 17 +constexpr int32_t PADDING_BOTTOM = 15; +constexpr int32_t GROUPBOX_PADDING = 6; +constexpr int32_t HORIZONTAL_GROUPBOX_PADDING = 5; +constexpr int32_t VERTICAL_GROUPBOX_PADDING = 4; +constexpr int32_t BUTTONW = 130; +constexpr int32_t BUTTONH = 17; // Calculates the .left, .right, .top and .bottom for buttons in a group box. // Buttons are used as reference points for all other widgets in the group boxes. @@ -275,10 +275,10 @@ static rct_widget DefaultWidgets[] = { }; // Group boxes .top and .bottom for a given window height offsets from the bottom -#define SUR_GBPB PADDING_BOTTOM // Surface group box properties bottom -#define SUR_GBPT (SUR_GBPB + 16 + 4 * 21) // Surface group box properties top -#define SUR_GBDB (SUR_GBPT + GROUPBOX_PADDING) // Surface group box details bottom -#define SUR_GBDT (SUR_GBDB + 20 + 4 * 11) // Surface group box details top +constexpr int32_t SUR_GBPB = PADDING_BOTTOM; // Surface group box properties bottom +constexpr int32_t SUR_GBPT = SUR_GBPB + 16 + 4 * 21; // Surface group box properties top +constexpr int32_t SUR_GBDB = SUR_GBPT + GROUPBOX_PADDING; // Surface group box details bottom +constexpr int32_t SUR_GBDT = SUR_GBDB + 20 + 4 * 11; // Surface group box details top static rct_widget SurfaceWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - SUR_GBPT, 0) + 3, GBBB(WH - SUR_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_SURFACE_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -292,10 +292,10 @@ static rct_widget SurfaceWidgets[] = { { WIDGETS_END }, }; -#define PAT_GBPB PADDING_BOTTOM // Path group box properties bottom -#define PAT_GBPT (PAT_GBPB + 16 + 5 * 21) // Path group box properties top -#define PAT_GBDB (PAT_GBPT + GROUPBOX_PADDING) // Path group box info bottom -#define PAT_GBDT (PAT_GBDB + 20 + 2 * 11) // Path group box info top +constexpr int32_t PAT_GBPB = PADDING_BOTTOM; // Path group box properties bottom +constexpr int32_t PAT_GBPT = PAT_GBPB + 16 + 5 * 21; // Path group box properties top +constexpr int32_t PAT_GBDB = PAT_GBPT + GROUPBOX_PADDING; // Path group box info bottom +constexpr int32_t PAT_GBDT = PAT_GBDB + 20 + 2 * 11; // Path group box info top static rct_widget PathWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - PAT_GBPT, 0) + 3, GBBB(WH - PAT_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_PATH_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -312,10 +312,10 @@ static rct_widget PathWidgets[] = { { WIDGETS_END }, }; -#define TRA_GBPB PADDING_BOTTOM // Track group box properties bottom -#define TRA_GBPT (TRA_GBPB + 16 + 5 * 21) // Track group box properties top -#define TRA_GBDB (TRA_GBPT + GROUPBOX_PADDING) // Track group box info bottom -#define TRA_GBDT (TRA_GBDB + 20 + 7 * 11) // Track group box info top +constexpr int32_t TRA_GBPB = PADDING_BOTTOM; // Track group box properties bottom +constexpr int32_t TRA_GBPT = TRA_GBPB + 16 + 5 * 21; // Track group box properties top +constexpr int32_t TRA_GBDB = TRA_GBPT + GROUPBOX_PADDING; // Track group box info bottom +constexpr int32_t TRA_GBDT = TRA_GBDB + 20 + 7 * 11; // Track group box info top static rct_widget TrackWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, { WWT_CHECKBOX, 1, GBBF(WH - TRA_GBPT, 0, 0), STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE, STR_NONE }, // WIDX_TRACK_CHECK_APPLY_TO_ALL @@ -326,10 +326,10 @@ static rct_widget TrackWidgets[] = { { WIDGETS_END }, }; -#define SCE_GBPB PADDING_BOTTOM // Scenery group box properties bottom -#define SCE_GBPT (SCE_GBPB + 16 + 4 * 21) // Scenery group box properties top -#define SCE_GBDB (SCE_GBPT + GROUPBOX_PADDING) // Scenery group box info bottom -#define SCE_GBDT (SCE_GBDB + 20 + 3 * 11) // Scenery group box info top +constexpr int32_t SCE_GBPB = PADDING_BOTTOM; // Scenery group box properties bottom +constexpr int32_t SCE_GBPT = SCE_GBPB + 16 + 4 * 21; // Scenery group box properties top +constexpr int32_t SCE_GBDB = SCE_GBPT + GROUPBOX_PADDING; // Scenery group box info bottom +constexpr int32_t SCE_GBDT = SCE_GBDB + 20 + 3 * 11; // Scenery group box info top static rct_widget SceneryWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - SCE_GBPT, 0) + 3, GBBB(WH - SCE_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -345,10 +345,10 @@ static rct_widget SceneryWidgets[] = { }; -#define ENT_GBPB PADDING_BOTTOM // Entrance group box properties bottom -#define ENT_GBPT (ENT_GBPB + 16 + 2 * 21) // Entrance group box properties top -#define ENT_GBDB (ENT_GBPT + GROUPBOX_PADDING) // Entrance group box info bottom -#define ENT_GBDT (ENT_GBDB + 20 + 4 * 11) // Entrance group box info top +constexpr int32_t ENT_GBPB = PADDING_BOTTOM; // Entrance group box properties bottom +constexpr int32_t ENT_GBPT = ENT_GBPB + 16 + 2 * 21; // Entrance group box properties top +constexpr int32_t ENT_GBDB = ENT_GBPT + GROUPBOX_PADDING; // Entrance group box info bottom +constexpr int32_t ENT_GBDT = ENT_GBDB + 20 + 4 * 11; // Entrance group box info top static rct_widget EntranceWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - ENT_GBPT, 0) + 3, GBBB(WH - ENT_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_ENTRANCE_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -356,10 +356,10 @@ static rct_widget EntranceWidgets[] = { { WIDGETS_END }, }; -#define WALL_GBPB PADDING_BOTTOM // Wall group box properties bottom -#define WALL_GBPT (WALL_GBPB + 16 + 2 * 21) // Wall group box properties top -#define WALL_GBDB (WALL_GBPT + GROUPBOX_PADDING) // Wall group box info bottom -#define WALL_GBDT (WALL_GBDB + 20 + 2 * 11) // Wall group box info top +constexpr int32_t WALL_GBPB = PADDING_BOTTOM; // Wall group box properties bottom +constexpr int32_t WALL_GBPT = WALL_GBPB + 16 + 2 * 21; // Wall group box properties top +constexpr int32_t WALL_GBDB = WALL_GBPT + GROUPBOX_PADDING; // Wall group box info bottom +constexpr int32_t WALL_GBDT = WALL_GBDB + 20 + 2 * 11; // Wall group box info top static rct_widget WallWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - WALL_GBPT, 0) + 3, GBBB(WH - WALL_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_WALL_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -368,20 +368,20 @@ static rct_widget WallWidgets[] = { { WIDGETS_END }, }; -#define LAR_GBPB PADDING_BOTTOM // Large scenery group box properties bottom -#define LAR_GBPT (LAR_GBPB + 16 + 1 * 21) // Large scenery group box properties top -#define LAR_GBDB (LAR_GBPT + GROUPBOX_PADDING) // Large scenery group box info bottom -#define LAR_GBDT (LAR_GBDB + 20 + 3 * 11) // Large scenery group box info top +constexpr int32_t LAR_GBPB = PADDING_BOTTOM; // Large scenery group box properties bottom +constexpr int32_t LAR_GBPT = LAR_GBPB + 16 + 1 * 21; // Large scenery group box properties top +constexpr int32_t LAR_GBDB = LAR_GBPT + GROUPBOX_PADDING; // Large scenery group box info bottom +constexpr int32_t LAR_GBDT = LAR_GBDB + 20 + 3 * 11; // Large scenery group box info top static rct_widget LargeSceneryWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - LAR_GBPT, 0) + 3, GBBB(WH - LAR_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} { WIDGETS_END }, }; -#define BAN_GBPB PADDING_BOTTOM // Banner group box properties bottom -#define BAN_GBPT (BAN_GBPB + 16 + 3 * 21) // Banner group box properties top -#define BAN_GBDB (BAN_GBPT + GROUPBOX_PADDING) // Banner group box info bottom -#define BAN_GBDT (BAN_GBDB + 20 + 1 * 11) // Banner group box info top +constexpr int32_t BAN_GBPB = PADDING_BOTTOM; // Banner group box properties bottom +constexpr int32_t BAN_GBPT = BAN_GBPB + 16 + 3 * 21; // Banner group box properties top +constexpr int32_t BAN_GBDB = BAN_GBPT + GROUPBOX_PADDING; // Banner group box info bottom +constexpr int32_t BAN_GBDT = BAN_GBDB + 20 + 1 * 11; // Banner group box info top static rct_widget BannerWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - BAN_GBPT, 0) + 3, GBBB(WH - BAN_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_BANNER_SPINNER_HEIGHT{,_INCREASE,_DECREASE} @@ -393,10 +393,10 @@ static rct_widget BannerWidgets[] = { { WIDGETS_END }, }; -#define COR_GBPB PADDING_BOTTOM // Corrupt element group box properties bottom -#define COR_GBPT (COR_GBPB + 16 + 2 * 21) // Corrupt element group box properties top -#define COR_GBDB (COR_GBPT + GROUPBOX_PADDING) // Corrupt element group box info bottom -#define COR_GBDT (COR_GBDB + 20 + 0 * 11) // Corrupt element group box info top +constexpr int32_t COR_GBPB = PADDING_BOTTOM; // Corrupt element group box properties bottom +constexpr int32_t COR_GBPT = COR_GBPB + 16 + 2 * 21; // Corrupt element group box properties top +constexpr int32_t COR_GBDB = COR_GBPT + GROUPBOX_PADDING; // Corrupt element group box info bottom +constexpr int32_t COR_GBDT = COR_GBDB + 20 + 0 * 11; // Corrupt element group box info top static rct_widget CorruptWidgets[] = { MAIN_TILE_INSPECTOR_WIDGETS, SPINNER_WIDGETS (1, GBBL(1), GBBR(1), GBBT(WH - COR_GBPT, 0) + 3, GBBB(WH - COR_GBPT, 0) - 3, STR_NONE, STR_NONE), // WIDX_CORRUPT_SPINNER_HEIGHT{,_INCREASE,_DECREASE} diff --git a/src/openrct2-ui/windows/TitleCommandEditor.cpp b/src/openrct2-ui/windows/TitleCommandEditor.cpp index 4a84b2ba08..5a481d7d70 100644 --- a/src/openrct2-ui/windows/TitleCommandEditor.cpp +++ b/src/openrct2-ui/windows/TitleCommandEditor.cpp @@ -69,16 +69,16 @@ enum WINDOW_WATER_WIDGET_IDX { WIDX_CANCEL }; -#define WW 200 -#define WH 120 -#define BY 32 -#define BY2 70 -#define WS 16 -#define WHA ((WW-WS*2)/2) +constexpr int32_t WW = 200; +constexpr int32_t WH = 120; +constexpr int32_t BY = 32; +constexpr int32_t BY2 = 70; +constexpr int32_t WS = 16; +constexpr int32_t WHA = (WW-WS*2)/2; static bool _window_title_command_editor_insert; static int32_t _window_title_command_editor_index; -#define BUF_SIZE 50 +constexpr size_t BUF_SIZE = 50; static char textbox1Buffer[BUF_SIZE]; static char textbox2Buffer[BUF_SIZE]; static TitleCommand command = { TITLE_SCRIPT_LOAD, { 0 } }; diff --git a/src/openrct2-ui/windows/TitleEditor.cpp b/src/openrct2-ui/windows/TitleEditor.cpp index 0baa7a3550..c47cf68869 100644 --- a/src/openrct2-ui/windows/TitleEditor.cpp +++ b/src/openrct2-ui/windows/TitleEditor.cpp @@ -135,15 +135,15 @@ enum WINDOW_TITLE_EDITOR_WIDGET_IDX { // Increase BW if certain languages do not fit // BW should be a multiple of 4 -#define WW 320 -#define WH 270 -#define BX 8 -#define BW 72 -#define BY 52 -#define BH 63 -#define BS 18 -#define SCROLL_WIDTH 350 -#define WH2 127 +constexpr int32_t WW = 320; +constexpr int32_t WH = 270; +constexpr int32_t BX = 8; +constexpr int32_t BW = 72; +constexpr int32_t BY = 52; +constexpr int32_t BH = 63; +constexpr int32_t BS = 18; +constexpr int32_t SCROLL_WIDTH = 350; +constexpr int32_t WH2 = 127; static rct_widget window_title_editor_widgets[] = { { WWT_FRAME, 0, 0, WW-1, 0, WH2-1, 0xFFFFFFFF, STR_NONE }, // panel / background diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 62a857ab17..bb280f71b7 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -27,9 +27,9 @@ #include #include -#define TRACK_MINI_PREVIEW_WIDTH 168 -#define TRACK_MINI_PREVIEW_HEIGHT 78 -#define TRACK_MINI_PREVIEW_SIZE (TRACK_MINI_PREVIEW_WIDTH * TRACK_MINI_PREVIEW_HEIGHT) +constexpr int16_t TRACK_MINI_PREVIEW_WIDTH = 168; +constexpr int16_t TRACK_MINI_PREVIEW_HEIGHT = 78; +constexpr uint16_t TRACK_MINI_PREVIEW_SIZE = TRACK_MINI_PREVIEW_WIDTH * TRACK_MINI_PREVIEW_HEIGHT; struct rct_track_td6; diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 1cf6d4d08d..332066bdca 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -97,7 +97,7 @@ static rct_window_event_list window_track_list_events = { }; // clang-format on -#define TRACK_DESIGN_INDEX_UNLOADED UINT16_MAX +constexpr uint16_t TRACK_DESIGN_INDEX_UNLOADED = UINT16_MAX; ride_list_item _window_track_list_item; diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 2b0efa222f..9950d52377 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -45,8 +45,8 @@ static DISPLAY_TYPE gClipHeightDisplayType = DISPLAY_TYPE::DISPLAY_UNITS; #pragma region Widgets -#define WW 180 -#define WH 155 +constexpr int32_t WW = 180; +constexpr int32_t WH = 155; static rct_widget window_view_clipping_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, // panel / background diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 33a4af79dc..c36c6954b7 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -15,8 +15,8 @@ #include #include -#define INITIAL_WIDTH 500 -#define INITIAL_HEIGHT 350 +constexpr int32_t INITIAL_WIDTH = 500; +constexpr int32_t INITIAL_HEIGHT = 350; // clang-format off enum {