mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
Merge pull request #21457 from Gymnasiast/refactor/global-widget-idx-to-constexpr
Move global window indices to constexpr
This commit is contained in:
commit
70461be037
4 changed files with 69 additions and 67 deletions
|
@ -4,5 +4,8 @@ Checks: >
|
|||
cppcoreguidelines-macro-usage,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override
|
||||
CheckOptions:
|
||||
- key: cppcoreguidelines-macro-usage.AllowedRegexp
|
||||
value: 'validate_global_widx'
|
||||
WarningsAsErrors: true
|
||||
FormatStyle: 'file'
|
||||
|
|
|
@ -549,7 +549,7 @@ static void ShortcutIncreaseElementHeight()
|
|||
if (w != nullptr)
|
||||
{
|
||||
int action = -1;
|
||||
switch (w->tileInspectorPage)
|
||||
switch (EnumValue(w->tileInspectorPage))
|
||||
{
|
||||
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE:
|
||||
action = WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE;
|
||||
|
@ -575,8 +575,6 @@ static void ShortcutIncreaseElementHeight()
|
|||
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER:
|
||||
action = WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_INCREASE;
|
||||
break;
|
||||
case TileInspectorPage::Default:
|
||||
break;
|
||||
}
|
||||
if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty)
|
||||
WindowEventMouseDownCall(w, action);
|
||||
|
@ -590,7 +588,7 @@ static void ShortcutDecreaseElementHeight()
|
|||
if (w != nullptr)
|
||||
{
|
||||
int action = -1;
|
||||
switch (w->tileInspectorPage)
|
||||
switch (EnumValue(w->tileInspectorPage))
|
||||
{
|
||||
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE:
|
||||
action = WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE;
|
||||
|
@ -616,8 +614,6 @@ static void ShortcutDecreaseElementHeight()
|
|||
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER:
|
||||
action = WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_DECREASE;
|
||||
break;
|
||||
case TileInspectorPage::Default:
|
||||
break;
|
||||
}
|
||||
if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty)
|
||||
WindowEventMouseDownCall(w, action);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "../drawing/ImageId.hpp"
|
||||
#include "../localisation/Formatter.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../windows/TileInspectorGlobals.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/ScenerySelection.h"
|
||||
#include "WindowClasses.h"
|
||||
|
@ -336,65 +338,65 @@ enum WindowDetail
|
|||
#define validate_global_widx(wc, widx) \
|
||||
static_assert(widx == wc##__##widx, "Global WIDX of " #widx " doesn't match actual value.")
|
||||
|
||||
#define WC_MAIN_WINDOW__0 0
|
||||
#define WC_TOP_TOOLBAR__WIDX_PAUSE 0
|
||||
#define WC_TOP_TOOLBAR__WIDX_LAND 8
|
||||
#define WC_TOP_TOOLBAR__WIDX_WATER 9
|
||||
#define WC_TOP_TOOLBAR__WIDX_SCENERY 10
|
||||
#define WC_TOP_TOOLBAR__WIDX_PATH 11
|
||||
#define WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY 17
|
||||
#define WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT 25
|
||||
#define WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE 30
|
||||
#define WC_RIDE_CONSTRUCTION__WIDX_EXIT 31
|
||||
#define WC_RIDE_CONSTRUCTION__WIDX_ROTATE 32
|
||||
#define WC_MAZE_CONSTRUCTION__WIDX_MAZE_DIRECTION_GROUPBOX WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT
|
||||
#define WC_MAZE_CONSTRUCTION__WIDX_MAZE_ENTRANCE WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
|
||||
#define WC_MAZE_CONSTRUCTION__WIDX_MAZE_EXIT WC_RIDE_CONSTRUCTION__WIDX_EXIT
|
||||
#define WC_SCENERY__WIDX_SCENERY_TAB_1 14
|
||||
#define WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON 5
|
||||
#define WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON 10
|
||||
#define WC_PEEP__WIDX_PATROL 10
|
||||
#define WC_PEEP__WIDX_ACTION_LBL 13
|
||||
#define WC_PEEP__WIDX_PICKUP 14
|
||||
#define WC_TRACK_DESIGN_LIST__WIDX_ROTATE 8
|
||||
#define WC_TRACK_DESIGN_PLACE__WIDX_ROTATE 3
|
||||
#define WC_MAP__WIDX_ROTATE_90 24
|
||||
#define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 22
|
||||
#define WC_STAFF__WIDX_PICKUP 9
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE 13
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_COPY 16
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE 15
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE 10
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP 11
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN 12
|
||||
#define WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE 5
|
||||
#define WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE 6
|
||||
#define WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE 8
|
||||
#define WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE 9
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE TileInspectorPage::Surface
|
||||
#define WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_PATH TileInspectorPage::Path
|
||||
#define WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_TRACK TileInspectorPage::Track
|
||||
#define WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_INCREASE 28
|
||||
#define WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_DECREASE 29
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SCENERY TileInspectorPage::Scenery
|
||||
#define WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_ENTRANCE TileInspectorPage::Entrance
|
||||
#define WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_WALL TileInspectorPage::Wall
|
||||
#define WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_LARGE_SCENERY TileInspectorPage::LargeScenery
|
||||
#define WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE 28
|
||||
#define WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER TileInspectorPage::Banner
|
||||
#define WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_INCREASE 27
|
||||
#define WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_DECREASE 28
|
||||
constexpr int32_t WC_MAIN_WINDOW__0 = 0;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_PAUSE = 0;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_LAND = 8;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_WATER = 9;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_SCENERY = 10;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_PATH = 11;
|
||||
constexpr int32_t WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY = 17;
|
||||
constexpr int32_t WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT = 25;
|
||||
constexpr int32_t WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE = 30;
|
||||
constexpr int32_t WC_RIDE_CONSTRUCTION__WIDX_EXIT = 31;
|
||||
constexpr int32_t WC_RIDE_CONSTRUCTION__WIDX_ROTATE = 32;
|
||||
constexpr int32_t WC_MAZE_CONSTRUCTION__WIDX_MAZE_DIRECTION_GROUPBOX = WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT;
|
||||
constexpr int32_t WC_MAZE_CONSTRUCTION__WIDX_MAZE_ENTRANCE = WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE;
|
||||
constexpr int32_t WC_MAZE_CONSTRUCTION__WIDX_MAZE_EXIT = WC_RIDE_CONSTRUCTION__WIDX_EXIT;
|
||||
constexpr int32_t WC_SCENERY__WIDX_SCENERY_TAB_1 = 14;
|
||||
constexpr int32_t WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON = 5;
|
||||
constexpr int32_t WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON = 10;
|
||||
constexpr int32_t WC_PEEP__WIDX_PATROL = 10;
|
||||
constexpr int32_t WC_PEEP__WIDX_ACTION_LBL = 13;
|
||||
constexpr int32_t WC_PEEP__WIDX_PICKUP = 14;
|
||||
constexpr int32_t WC_TRACK_DESIGN_LIST__WIDX_ROTATE = 8;
|
||||
constexpr int32_t WC_TRACK_DESIGN_PLACE__WIDX_ROTATE = 3;
|
||||
constexpr int32_t WC_MAP__WIDX_ROTATE_90 = 24;
|
||||
constexpr int32_t WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 = 22;
|
||||
constexpr int32_t WC_STAFF__WIDX_PICKUP = 9;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE = 13;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_COPY = 16;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE = 15;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE = 10;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP = 11;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN = 12;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE = 5;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE = 6;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE = 8;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE = 9;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE = EnumValue(TileInspectorPage::Surface);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_PATH = EnumValue(TileInspectorPage::Path);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_TRACK = EnumValue(TileInspectorPage::Track);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_INCREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_DECREASE = 29;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SCENERY = EnumValue(TileInspectorPage::Scenery);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_ENTRANCE = EnumValue(TileInspectorPage::Entrance);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_WALL = EnumValue(TileInspectorPage::Wall);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_LARGE_SCENERY = EnumValue(TileInspectorPage::LargeScenery);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE = 28;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER = EnumValue(TileInspectorPage::Banner);
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_INCREASE = 27;
|
||||
constexpr int32_t WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_DECREASE = 28;
|
||||
|
||||
enum class PromptMode : uint8_t
|
||||
{
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../interface/Window.h"
|
||||
#include <cstdint>
|
||||
|
||||
struct TileCoordsXY;
|
||||
|
||||
enum class TileInspectorPage : int16_t
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue