|
OpenTTD Source 20251104-master-g3befbdd52f
|
GUIs for debugging NewGRFs. More...
#include "stdafx.h"#include "core/backup_type.hpp"#include "core/geometry_func.hpp"#include "window_gui.h"#include "window_func.h"#include "random_access_file_type.h"#include "spritecache.h"#include "string_func.h"#include "strings_func.h"#include "textbuf_gui.h"#include "vehicle_gui.h"#include "zoom_func.h"#include "core/string_consumer.hpp"#include "engine_base.h"#include "industry.h"#include "object_base.h"#include "station_base.h"#include "town.h"#include "vehicle_base.h"#include "train.h"#include "roadveh.h"#include "newgrf_act5.h"#include "newgrf_airport.h"#include "newgrf_airporttiles.h"#include "newgrf_badge.h"#include "newgrf_debug.h"#include "newgrf_object.h"#include "newgrf_spritegroup.h"#include "newgrf_station.h"#include "newgrf_town.h"#include "newgrf_railtype.h"#include "newgrf_industries.h"#include "newgrf_industrytiles.h"#include "widgets/newgrf_debug_widget.h"#include "table/strings.h"#include "safeguards.h"#include "table/newgrf_debug_data.h"Go to the source code of this file.
Data Structures | |
| struct | NIProperty |
| Representation of the data from a NewGRF property. More... | |
| struct | NICallback |
| Representation of the available callbacks with information on when they actually apply. More... | |
| struct | NIVariable |
| Representation on the NewGRF variables. More... | |
| class | NIHelper |
| Helper class to wrap some functionality/queries in. More... | |
| struct | NIFeature |
| Container for all information for a given feature. More... | |
| struct | NewGRFInspectWindow |
| Window used for inspecting NewGRFs. More... | |
| struct | SpriteAlignerWindow |
| Window used for aligning sprites. More... | |
Typedefs | |
| using | NIReadProc = uint32_t(const void *b) |
Enumerations | |
| enum | NIType : uint8_t { NIT_INT , NIT_CARGO } |
| The type of a property to show. More... | |
Functions | |
| static uint | GetFeatureIndex (uint window_number) |
| Get the feature index related to the window number. | |
| static uint | GetInspectWindowNumber (GrfSpecFeature feature, uint index) |
| Get the window number for the inspect window given a feature and index. | |
| static uint | GetInspectWindowNumber (GrfSpecFeature feature, ConvertibleThroughBase auto index) |
| static GrfSpecFeature | GetFeatureNum (uint window_number) |
| Get the feature number related to the window number. | |
| static const NIFeature * | GetFeature (uint window_number) |
| Get the NIFeature related to the window number. | |
| static const NIHelper & | GetFeatureHelper (uint window_number) |
| Get the NIHelper related to the window number. | |
| void | ShowNewGRFInspectWindow (GrfSpecFeature feature, uint index, const uint32_t grfid) |
| Show the inspect window for a given feature and index. | |
| void | InvalidateNewGRFInspectWindow (GrfSpecFeature feature, uint index) |
| Invalidate the inspect window for a given feature and index. | |
| void | DeleteNewGRFInspectWindow (GrfSpecFeature feature, uint index) |
| Delete inspect window for a given feature and index. | |
| bool | IsNewGRFInspectable (GrfSpecFeature feature, uint index) |
| Can we inspect the data given a certain feature and index. | |
| GrfSpecFeature | GetGrfSpecFeature (TileIndex tile) |
| Get the GrfSpecFeature associated with the tile. | |
| GrfSpecFeature | GetGrfSpecFeature (VehicleType type) |
| Get the GrfSpecFeature associated with the vehicle. | |
| void | ShowSpriteAlignerWindow () |
| Show the window for aligning sprites. | |
Variables | |
| NewGrfDebugSpritePicker | _newgrf_debug_sprite_picker = { SPM_NONE, nullptr, {} } |
| The sprite picker. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_inspect_chain_widgets |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_inspect_widgets |
| static WindowDesc | _newgrf_inspect_chain_desc (WDP_AUTO, "newgrf_inspect_chain", 400, 300, WC_NEWGRF_INSPECT, WC_NONE, {}, _nested_newgrf_inspect_chain_widgets) |
| static WindowDesc | _newgrf_inspect_desc (WDP_AUTO, "newgrf_inspect", 400, 300, WC_NEWGRF_INSPECT, WC_NONE, {}, _nested_newgrf_inspect_widgets) |
| static constexpr std::initializer_list< NWidgetPart > | _nested_sprite_aligner_widgets |
| static WindowDesc | _sprite_aligner_desc (WDP_AUTO, "sprite_aligner", 400, 300, WC_SPRITE_ALIGNER, WC_NONE, {}, _nested_sprite_aligner_widgets) |
GUIs for debugging NewGRFs.
Definition in file newgrf_debug_gui.cpp.
| using NIReadProc = uint32_t(const void *b) |
Definition at line 89 of file newgrf_debug_gui.cpp.
| enum NIType : uint8_t |
The type of a property to show.
This is used to provide an appropriate representation in the GUI.
| Enumerator | |
|---|---|
| NIT_INT | The property is a simple integer. |
| NIT_CARGO | The property is a cargo. |
Definition at line 84 of file newgrf_debug_gui.cpp.
| void DeleteNewGRFInspectWindow | ( | GrfSpecFeature | feature, |
| uint | index | ||
| ) |
Delete inspect window for a given feature and index.
The index is normally an in-game location/identifier, such as a TileIndex or an IndustryID depending on the feature we want to inspect.
| feature | The feature we want to delete the window for. |
| index | The index/identifier of the feature to delete. |
Definition at line 726 of file newgrf_debug_gui.cpp.
References CloseWindowById(), GetInspectWindowNumber(), GSF_INVALID, InvalidateWindowData(), WC_LAND_INFO, and WC_NEWGRF_INSPECT.
Referenced by CmdMoveRailVehicle(), CmdRemoveSingleRail(), DoClearTownHouseHelper(), ReallyClearObjectTile(), RemoveAirport(), RemoveFromRailBaseStation(), RemoveRoadStop(), RemoveRoadWaypointStop(), Town::~Town(), and Vehicle::~Vehicle().
|
inlinestatic |
Get the NIFeature related to the window number.
| window_number | The window to get the NIFeature for. |
Definition at line 240 of file newgrf_debug_gui.cpp.
References _nifeatures, GetFeatureNum(), and GSF_FAKE_END.
Referenced by NewGRFInspectWindow::DrawMainPanelWidget(), GetFeatureHelper(), IsNewGRFInspectable(), and NewGRFInspectWindow::OnClick().
|
inlinestatic |
Get the NIHelper related to the window number.
| window_number | The window to get the NIHelper for. |
Definition at line 252 of file newgrf_debug_gui.cpp.
References GetFeature(), and NIFeature::helper.
Referenced by NewGRFInspectWindow::GetWidgetString(), and NewGRFInspectWindow::OnClick().
|
inlinestatic |
Get the feature index related to the window number.
| window_number | The window to get the feature index from. |
Definition at line 60 of file newgrf_debug_gui.cpp.
References GB().
|
inlinestatic |
Get the feature number related to the window number.
| window_number | The window to get the feature number for. |
Definition at line 230 of file newgrf_debug_gui.cpp.
References GB().
Referenced by NewGRFInspectWindow::DrawMainPanelWidget(), NewGRFInspectWindow::DrawVehicleChainWidget(), GetFeature(), NewGRFInspectWindow::HasChainIndex(), NewGRFInspectWindow::OnClick(), NewGRFInspectWindow::OnQueryTextFinished(), and NewGRFInspectWindow::UpdateWidgetSize().
| GrfSpecFeature GetGrfSpecFeature | ( | TileIndex | tile | ) |
Get the GrfSpecFeature associated with the tile.
| tile | The tile to get the feature from. |
Definition at line 760 of file newgrf_debug_gui.cpp.
References GetStationType(), GetTileType(), GSF_INVALID, IsLevelCrossing(), MP_HOUSE, MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_ROAD, and MP_STATION.
Referenced by NIHVehicle::GetParent(), LandInfoWindow::IsNewGRFInspectable(), VehicleViewWindow::IsNewGRFInspectable(), LandInfoWindow::ShowNewGRFInspectWindow(), VehicleViewWindow::ShowNewGRFInspectWindow(), and Vehicle::~Vehicle().
| GrfSpecFeature GetGrfSpecFeature | ( | VehicleType | type | ) |
Get the GrfSpecFeature associated with the vehicle.
| type | The vehicle type to get the feature from. |
Definition at line 786 of file newgrf_debug_gui.cpp.
References GSF_INVALID, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
|
inlinestatic |
Definition at line 78 of file newgrf_debug_gui.cpp.
|
inlinestatic |
Get the window number for the inspect window given a feature and index.
| feature | The feature we want to inspect. |
| index | The index/identifier of the feature to inspect. |
Definition at line 72 of file newgrf_debug_gui.cpp.
Referenced by DeleteNewGRFInspectWindow(), NIHVehicle::GetParent(), NIHStation::GetParent(), NIHHouse::GetParent(), NIHIndustryTile::GetParent(), NIHIndustry::GetParent(), NIHObject::GetParent(), NIHAirportTile::GetParent(), NIHAirport::GetParent(), NIHRoadStop::GetParent(), InvalidateNewGRFInspectWindow(), IsNewGRFInspectable(), and ShowNewGRFInspectWindow().
| void InvalidateNewGRFInspectWindow | ( | GrfSpecFeature | feature, |
| uint | index | ||
| ) |
Invalidate the inspect window for a given feature and index.
The index is normally an in-game location/identifier, such as a TileIndex or an IndustryID depending on the feature we want to inspect.
| feature | The feature we want to invalidate the window for. |
| index | The index/identifier of the feature to invalidate. |
Definition at line 710 of file newgrf_debug_gui.cpp.
References GetInspectWindowNumber(), GSF_INVALID, InvalidateWindowData(), and WC_NEWGRF_INSPECT.
Referenced by Train::ConsistChanged().
| bool IsNewGRFInspectable | ( | GrfSpecFeature | feature, |
| uint | index | ||
| ) |
Can we inspect the data given a certain feature and index.
The index is normally an in-game location/identifier, such as a TileIndex or an IndustryID depending on the feature we want to inspect.
| feature | The feature we want to inspect. |
| index | The index/identifier of the feature to inspect. |
Definition at line 748 of file newgrf_debug_gui.cpp.
References GetFeature(), GetInspectWindowNumber(), and NIFeature::helper.
Referenced by ShowNewGRFInspectWindow().
| void ShowNewGRFInspectWindow | ( | GrfSpecFeature | feature, |
| uint | index, | ||
| const uint32_t | grfid | ||
| ) |
Show the inspect window for a given feature and index.
The index is normally an in-game location/identifier, such as a TileIndex or an IndustryID depending on the feature we want to inspect.
| feature | The feature we want to inspect. |
| index | The index/identifier of the feature to inspect. |
| grfid | GRFID of the item opening this window, or 0 if not opened by other window. |
Definition at line 692 of file newgrf_debug_gui.cpp.
References GetInspectWindowNumber(), IsNewGRFInspectable(), and NewGRFInspectWindow::SetCallerGRFID().
| void ShowSpriteAlignerWindow | ( | ) |
Show the window for aligning sprites.
Definition at line 1202 of file newgrf_debug_gui.cpp.
Referenced by MenuClickHelp().
|
staticconstexpr |
Definition at line 627 of file newgrf_debug_gui.cpp.
|
staticconstexpr |
Definition at line 651 of file newgrf_debug_gui.cpp.
|
staticconstexpr |
Definition at line 1122 of file newgrf_debug_gui.cpp.
| NewGrfDebugSpritePicker _newgrf_debug_sprite_picker = { SPM_NONE, nullptr, {} } |
The sprite picker.
Definition at line 53 of file newgrf_debug_gui.cpp.
Referenced by SpriteAlignerWindow::DrawWidget(), GfxBlitter(), HandleMouseEvents(), SpriteAlignerWindow::OnClick(), SpriteAlignerWindow::OnInvalidateData(), and UpdateWindows().