GUIs for debugging NewGRFs. More...
#include "stdafx.h"
#include <stdarg.h>
#include "window_gui.h"
#include "window_func.h"
#include "fileio_func.h"
#include "spritecache.h"
#include "string_func.h"
#include "strings_func.h"
#include "textbuf_gui.h"
#include "engine_base.h"
#include "industry.h"
#include "object_base.h"
#include "station_base.h"
#include "town.h"
#include "vehicle_base.h"
#include "newgrf_airporttiles.h"
#include "newgrf_debug.h"
#include "newgrf_object.h"
#include "newgrf_spritegroup.h"
#include "newgrf_station.h"
#include "newgrf_town.h"
#include "table/strings.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... | |
Enumerations | |
enum | NIType { NIT_INT, NIT_CARGO } |
The type of a property to show. More... | |
enum | NewGRFInspectWidgets { NIW_CAPTION, NIW_PARENT, NIW_MAINPANEL, NIW_SCROLLBAR } |
Widget numbers of settings window. More... | |
enum | SpriteAlignerWidgets { SAW_CAPTION, SAW_PREVIOUS, SAW_GOTO, SAW_NEXT, SAW_UP, SAW_LEFT, SAW_RIGHT, SAW_DOWN, SAW_SPRITE, SAW_OFFSETS, SAW_PICKER, SAW_LIST, SAW_SCROLLBAR } |
Widgets we want (some) influence over. 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 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) |
Show 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, NULL, 0, SmallVector<SpriteID, 256>() } |
static const int | CBM_NO_BIT = UINT8_MAX |
Mask to show no bit needs to be enabled for the callback. | |
static const NWidgetPart | _nested_newgrf_inspect_widgets [] |
static const WindowDesc | _newgrf_inspect_desc (WDP_AUTO, 400, 300, WC_NEWGRF_INSPECT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_newgrf_inspect_widgets, lengthof(_nested_newgrf_inspect_widgets)) |
static const NWidgetPart | _nested_sprite_aligner_widgets [] |
static const WindowDesc | _sprite_aligner_desc (WDP_AUTO, 400, 300, WC_SPRITE_ALIGNER, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_sprite_aligner_widgets, lengthof(_nested_sprite_aligner_widgets)) |
GUIs for debugging NewGRFs.
Definition in file newgrf_debug_gui.cpp.
enum NewGRFInspectWidgets |
Widget numbers of settings window.
NIW_CAPTION |
The caption bar ofcourse. |
NIW_PARENT |
Inspect the parent. |
NIW_MAINPANEL |
Panel widget containing the actual data. |
NIW_SCROLLBAR |
Definition at line 242 of file newgrf_debug_gui.cpp.
enum NIType |
The type of a property to show.
This is used to provide an appropriate represenation in the GUI.
Definition at line 67 of file newgrf_debug_gui.cpp.
enum SpriteAlignerWidgets |
Widgets we want (some) influence over.
SAW_CAPTION |
Caption of the window. |
SAW_PREVIOUS |
Skip to the previous sprite. |
SAW_GOTO |
Go to a given sprite. |
SAW_NEXT |
Skip to the next sprite. |
SAW_UP |
Move the sprite up. |
SAW_LEFT |
Move the sprite to the left. |
SAW_RIGHT |
Move the sprite to the right. |
SAW_DOWN |
Move the sprite down. |
SAW_SPRITE |
The actual sprite. |
SAW_OFFSETS |
The sprite offsets. |
SAW_PICKER |
Sprite picker. |
SAW_LIST |
Queried sprite list. |
SAW_SCROLLBAR |
Scrollbar for sprite list. |
Definition at line 552 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 498 of file newgrf_debug_gui.cpp.
References DeleteWindowById(), FindWindowById(), GetInspectWindowNumber(), GSF_INVALID, and Window::ReInit().
Referenced by CmdRemoveSingleRail(), DoClearTownHouseHelper(), ReallyClearObjectTile(), RemoveAirport(), RemoveFromRailBaseStation(), RemoveRailStation(), Town::~Town(), and Vehicle::~Vehicle().
static const NIFeature* GetFeature | ( | uint | window_number | ) | [inline, static] |
Get the NIFeature related to the window number.
window_number | The window to get the NIFeature for. |
Definition at line 223 of file newgrf_debug_gui.cpp.
References _nifeatures, GetFeatureNum(), and GSF_FAKE_END.
Referenced by GetFeatureHelper(), and IsNewGRFInspectable().
static const NIHelper* GetFeatureHelper | ( | uint | window_number | ) | [inline, static] |
Get the NIHelper related to the window number.
window_number | The window to get the NIHelper for. |
Definition at line 235 of file newgrf_debug_gui.cpp.
References GetFeature(), and NIFeature::helper.
Referenced by NewGRFInspectWindow::SetStringParameters().
static uint GetFeatureIndex | ( | uint | window_number | ) | [inline, static] |
Get the feature index related to the window number.
window_number | The window to get the feature index from. |
Definition at line 45 of file newgrf_debug_gui.cpp.
References GB().
Referenced by NewGRFInspectWindow::SetStringParameters().
static GrfSpecFeature GetFeatureNum | ( | uint | window_number | ) | [inline, static] |
Get the feature number related to the window number.
window_number | The window to get the feature number for. |
Definition at line 213 of file newgrf_debug_gui.cpp.
References GB().
Referenced by GetFeature().
GrfSpecFeature GetGrfSpecFeature | ( | VehicleType | type | ) |
Get the GrfSpecFeature associated with the vehicle.
Definition at line 536 of file newgrf_debug_gui.cpp.
References GSF_INVALID, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
GrfSpecFeature GetGrfSpecFeature | ( | TileIndex | tile | ) |
Get the GrfSpecFeature associated with the tile.
Definition at line 517 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(), VehicleViewWindow::IsNewGRFInspectable(), LandInfoWindow::IsNewGRFInspectable(), VehicleViewWindow::ShowNewGRFInspectWindow(), LandInfoWindow::ShowNewGRFInspectWindow(), and Vehicle::~Vehicle().
static uint GetInspectWindowNumber | ( | GrfSpecFeature | feature, | |
uint | index | |||
) | [inline, static] |
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 57 of file newgrf_debug_gui.cpp.
Referenced by DeleteNewGRFInspectWindow(), NIHAirportTile::GetParent(), NIHObject::GetParent(), NIHIndustry::GetParent(), NIHIndustryTile::GetParent(), NIHHouse::GetParent(), NIHStation::GetParent(), NIHVehicle::GetParent(), IsNewGRFInspectable(), and ShowNewGRFInspectWindow().
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 510 of file newgrf_debug_gui.cpp.
References GetFeature(), GetInspectWindowNumber(), NIFeature::helper, and NIHelper::IsInspectable().
Referenced by VehicleViewWindow::IsNewGRFInspectable(), and ShowNewGRFInspectWindow().
void ShowNewGRFInspectWindow | ( | GrfSpecFeature | feature, | |
uint | index | |||
) |
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. |
Definition at line 490 of file newgrf_debug_gui.cpp.
References GetInspectWindowNumber(), and IsNewGRFInspectable().
Referenced by VehicleViewWindow::ShowNewGRFInspectWindow().
const NWidgetPart _nested_newgrf_inspect_widgets[] [static] |
{ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, NIW_CAPTION), SetDataTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NIW_PARENT), SetDataTip(STR_NEWGRF_INSPECT_PARENT_BUTTON, STR_NEWGRF_INSPECT_PARENT_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_GREY, NIW_MAINPANEL), SetMinimalSize(300, 0), SetScrollbar(NIW_SCROLLBAR), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_VSCROLLBAR, COLOUR_GREY, NIW_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), EndContainer(), }
Definition at line 466 of file newgrf_debug_gui.cpp.
const int CBM_NO_BIT = UINT8_MAX [static] |
Mask to show no bit needs to be enabled for the callback.
Definition at line 94 of file newgrf_debug_gui.cpp.