Add: [NewGRF] Inspection window for airports.

As as the station window combines all station types, accessing the
debug view is via the parent of the airport tile only.

(cherry picked from commit a6f2f3c042)
This commit is contained in:
Michael Lutz
2023-09-10 17:09:31 +02:00
committed by Jonathan G Rennison
parent f6eadf19c6
commit 5cc623cb3c
4 changed files with 104 additions and 50 deletions

View File

@@ -17,50 +17,6 @@
#include "safeguards.h"
/** Resolver for the airport scope. */
struct AirportScopeResolver : public ScopeResolver {
struct Station *st; ///< Station of the airport for which the callback is run, or \c nullptr for build gui.
byte airport_id; ///< Type of airport for which the callback is run.
byte layout; ///< Layout of the airport to build.
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
/**
* Constructor of the scope resolver for an airport.
* @param ro Surrounding resolver.
* @param tile %Tile for the callback, only valid for airporttile callbacks.
* @param st %Station of the airport for which the callback is run, or \c nullptr for build gui.
* @param airport_id Type of airport for which the callback is run.
* @param layout Layout of the airport to build.
*/
AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout)
: ScopeResolver(ro), st(st), airport_id(airport_id), layout(layout), tile(tile)
{
}
uint32 GetRandomBits() const override;
uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const override;
void StorePSA(uint pos, int32 value) override;
};
/** Resolver object for airports. */
struct AirportResolverObject : public ResolverObject {
AirportScopeResolver airport_scope;
AirportResolverObject(TileIndex tile, Station *st, byte airport_id, byte layout,
CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, VarSpriteGroupScopeOffset relative = 0) override
{
switch (scope) {
case VSG_SCOPE_SELF: return &this->airport_scope;
default: return ResolverObject::GetScope(scope, relative);
}
}
GrfSpecFeature GetFeature() const override;
uint32 GetDebugID() const override;
};
/**
* Reset airport classes to their default state.
* This includes initialising the defaults classes with an empty