OpenTTD
Data Structures | Enumerations | Functions | Variables
newgrf_debug.h File Reference

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

#include "newgrf.h"
#include "core/smallvec_type.hpp"
#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 { SPM_NONE, SPM_WAIT_CLICK, SPM_REDRAW }
 Current state of spritepicker.
 

Functions

bool IsNewGRFInspectable (GrfSpecFeature feature, uint index)
 Can we inspect the data given a certain feature and index. More...
 
void ShowNewGRFInspectWindow (GrfSpecFeature feature, uint index, const uint32 grfid=0)
 Show the inspect window for a given feature and index. More...
 
void InvalidateNewGRFInspectWindow (GrfSpecFeature feature, uint index)
 Invalidate the inspect window for a given feature and index. More...
 
void DeleteNewGRFInspectWindow (GrfSpecFeature feature, uint index)
 Delete inspect window for a given feature and index. More...
 
GrfSpecFeature GetGrfSpecFeature (TileIndex tile)
 Get the GrfSpecFeature associated with the tile. More...
 
GrfSpecFeature GetGrfSpecFeature (VehicleType type)
 Get the GrfSpecFeature associated with the vehicle. More...
 
void ShowSpriteAlignerWindow ()
 Show the window for aligning sprites.
 

Variables

NewGrfDebugSpritePicker _newgrf_debug_sprite_picker
 The sprite picker. More...
 

Detailed Description

Functions/types related to NewGRF debugging.

Definition in file newgrf_debug.h.

Function Documentation

◆ DeleteNewGRFInspectWindow()

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 734 of file newgrf_debug_gui.cpp.

References DeleteWindowById(), GetInspectWindowNumber(), GSF_INVALID, InvalidateWindowData(), WC_LAND_INFO, and WC_NEWGRF_INSPECT.

Referenced by ReallyClearObjectTile().

◆ GetGrfSpecFeature() [1/2]

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 768 of file newgrf_debug_gui.cpp.

References GetTileType(), GSF_INVALID, and MP_RAILWAY.

Referenced by NIHVehicle::GetParent(), LandInfoWindow::IsNewGRFInspectable(), VehicleViewWindow::IsNewGRFInspectable(), LandInfoWindow::ShowNewGRFInspectWindow(), and VehicleViewWindow::ShowNewGRFInspectWindow().

◆ GetGrfSpecFeature() [2/2]

GrfSpecFeature GetGrfSpecFeature ( VehicleType  type)

Get the GrfSpecFeature associated with the vehicle.

Parameters
typeThe vehicle type to get the feature from.
Returns
the GrfSpecFeature.

Definition at line 792 of file newgrf_debug_gui.cpp.

References VEH_TRAIN.

◆ InvalidateNewGRFInspectWindow()

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 718 of file newgrf_debug_gui.cpp.

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

◆ 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 756 of file newgrf_debug_gui.cpp.

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

Referenced by LandInfoWindow::IsNewGRFInspectable(), IndustryViewWindow::IsNewGRFInspectable(), VehicleViewWindow::IsNewGRFInspectable(), and ShowNewGRFInspectWindow().

◆ ShowNewGRFInspectWindow()

void ShowNewGRFInspectWindow ( GrfSpecFeature  feature,
uint  index,
const uint32  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 700 of file newgrf_debug_gui.cpp.

References GetInspectWindowNumber(), and IsNewGRFInspectable().

Referenced by NewGRFInspectWindow::OnClick(), and IndustryViewWindow::ShowNewGRFInspectWindow().

Variable Documentation

◆ _newgrf_debug_sprite_picker

NewGrfDebugSpritePicker _newgrf_debug_sprite_picker

The sprite picker.

Definition at line 50 of file newgrf_debug_gui.cpp.