OpenTTD Source 20260512-master-g20b387b91f
newgrf_debug.h File Reference

Functions/types related to NewGRF debugging. More...

#include "core/flatset_type.hpp"
#include "newgrf.h"
#include "tile_type.h"
#include "vehicle_type.h"

Go to the source code of this file.

Data Structures

struct  NewGrfDebugSpritePicker
 Spritepicker of SpriteAligner. More...

Enumerations

enum  NewGrfDebugSpritePickerMode : uint8_t { SPM_NONE , SPM_WAIT_CLICK , SPM_REDRAW }
 Current state of spritepicker. More...

Functions

bool IsNewGRFInspectable (GrfSpecFeature feature, uint index)
 Can we inspect the data given a certain feature and index.
void ShowNewGRFInspectWindow (GrfSpecFeature feature, uint index, const uint32_t grfid=0)
 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 InvalidateNewGRFInspectWindow (GrfSpecFeature feature, ConvertibleThroughBase auto index)
void DeleteNewGRFInspectWindow (GrfSpecFeature feature, uint index)
 Delete inspect window for a given feature and index.
void DeleteNewGRFInspectWindow (GrfSpecFeature feature, ConvertibleThroughBase auto index)
GrfSpecFeature GetGrfSpecFeature (TileIndex tile)
 Get the GrfSpecFeature associated with the tile.
void ShowSpriteAlignerWindow ()
 Show the window for aligning sprites.

Variables

NewGrfDebugSpritePicker _newgrf_debug_sprite_picker
 The sprite picker.

Detailed Description

Functions/types related to NewGRF debugging.

Definition in file newgrf_debug.h.

Enumeration Type Documentation

◆ NewGrfDebugSpritePickerMode

Current state of spritepicker.

Definition at line 19 of file newgrf_debug.h.

Function Documentation

◆ DeleteNewGRFInspectWindow() [1/2]

void DeleteNewGRFInspectWindow ( GrfSpecFeature feature,
ConvertibleThroughBase auto index )

Definition at line 39 of file newgrf_debug.h.

◆ DeleteNewGRFInspectWindow() [2/2]

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.

Parameters
featureThe feature we want to delete the window for.
indexThe index/identifier of the feature to delete.

Definition at line 740 of file newgrf_debug_gui.cpp.

References CloseWindowById(), GetInspectWindowNumber(), Invalid, InvalidateWindowData(), WC_LAND_INFO, and WC_NEWGRF_INSPECT.

Referenced by CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdMoveRailVehicle(), CmdRemoveSingleRail(), DoClearTownHouseHelper(), ReallyClearObjectTile(), RemoveAirport(), RemoveFromRailBaseStation(), RemoveRoadStop(), RemoveRoadWaypointStop(), Industry::~Industry(), Town::~Town(), and Vehicle::~Vehicle().

◆ GetGrfSpecFeature()

GrfSpecFeature GetGrfSpecFeature ( TileIndex tile)

Get the GrfSpecFeature associated with the tile.

Parameters
tileThe tile to get the feature from.
Returns
the GrfSpecFeature.

Definition at line 774 of file newgrf_debug_gui.cpp.

References Airport, AirportTiles, Bus, GetStationType(), GetTileType(), House, Houses, Industry, IndustryTiles, Invalid, IsLevelCrossing(), Object, Objects, Rail, RailTypes, Railway, Road, RoadStops, RoadTypes, Station, Stations, and Truck.

◆ InvalidateNewGRFInspectWindow() [1/2]

void InvalidateNewGRFInspectWindow ( GrfSpecFeature feature,
ConvertibleThroughBase auto index )

Definition at line 37 of file newgrf_debug.h.

◆ InvalidateNewGRFInspectWindow() [2/2]

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.

Parameters
featureThe feature we want to invalidate the window for.
indexThe index/identifier of the feature to invalidate.

Definition at line 724 of file newgrf_debug_gui.cpp.

References GetInspectWindowNumber(), Invalid, InvalidateWindowData(), and WC_NEWGRF_INSPECT.

Referenced by Train::ConsistChanged().

◆ IsNewGRFInspectable()

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.

Parameters
featureThe feature we want to inspect.
indexThe index/identifier of the feature to inspect.
Returns
true if there is something to show.

Definition at line 762 of file newgrf_debug_gui.cpp.

References GetFeature(), GetInspectWindowNumber(), and NIFeature::helper.

Referenced by ShowNewGRFInspectWindow().

◆ 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.

Parameters
featureThe feature we want to inspect.
indexThe index/identifier of the feature to inspect.
grfidGRFID of the item opening this window, or 0 if not opened by other window.

Definition at line 706 of file newgrf_debug_gui.cpp.

References _newgrf_inspect_chain_desc, _newgrf_inspect_desc, AllocateWindowDescFront(), GetInspectWindowNumber(), IsNewGRFInspectable(), RoadVehicles, NewGRFInspectWindow::SetCallerGRFID(), and Trains.

◆ ShowSpriteAlignerWindow()

void ShowSpriteAlignerWindow ( )

Show the window for aligning sprites.

Definition at line 1199 of file newgrf_debug_gui.cpp.

References _sprite_aligner_desc, and AllocateWindowDescFront().

Referenced by MenuClickHelp().

Variable Documentation

◆ _newgrf_debug_sprite_picker