mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 20:54:08 +01:00
Add: Show badges in NewGRF debug window. (#13597)
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#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"
|
||||
@@ -172,6 +173,13 @@ public:
|
||||
*/
|
||||
virtual uint32_t GetGRFID(uint index) const = 0;
|
||||
|
||||
/**
|
||||
* Get the list of badges of this item.
|
||||
* @param index index to check.
|
||||
* @return List of badges of the item.
|
||||
*/
|
||||
virtual std::span<const BadgeID> GetBadges(uint index) const = 0;
|
||||
|
||||
/**
|
||||
* Resolve (action2) variable for a given index.
|
||||
* @param index The (instance) index to resolve the variable for.
|
||||
@@ -490,6 +498,15 @@ struct NewGRFInspectWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
auto badges = nih.GetBadges(index);
|
||||
if (!badges.empty()) {
|
||||
this->DrawString(r, i++, "Badges:");
|
||||
for (const BadgeID &badge_index : badges) {
|
||||
const Badge *badge = GetBadge(badge_index);
|
||||
this->DrawString(r, i++, fmt::format(" {}: {}", StrMakeValid(badge->label), GetString(badge->name)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!nif->properties.empty()) {
|
||||
this->DrawString(r, i++, "Properties:");
|
||||
for (const NIProperty &nip : nif->properties) {
|
||||
|
||||
Reference in New Issue
Block a user