61 inline std::span<const Element> GetClasses()
const {
return this->gui_classes; }
63 inline std::span<const uint> GetColumnWidths()
const {
return this->column_widths; }
68 std::vector<Element> gui_classes{};
69 std::vector<uint> column_widths{};
80 bool Filter(std::span<const BadgeID> badges)
const;
83 std::vector<BadgeID> badges{};
86std::unique_ptr<DropDownListItem> MakeDropDownListBadgeItem(
const std::shared_ptr<GUIBadgeClasses> &gui_classes, std::span<const BadgeID> badges,
GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date,
StringID str,
int value,
bool masked =
false,
bool shaded =
false);
87std::unique_ptr<DropDownListItem> MakeDropDownListBadgeIconItem(
const std::shared_ptr<GUIBadgeClasses> &gui_classes, std::span<const BadgeID> badges,
GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date,
const Dimension &dim,
SpriteID sprite,
PaletteID palette,
StringID str,
int value,
bool masked =
false,
bool shaded =
false);
VariableGRFFileProps grf_prop
Sprite information.
BadgeClassID class_index
Index of class this badge belongs to.
std::string label
Label of badge.
BadgeID index
Index assigned to badge.
BadgeFlags flags
Display flags.
GrfSpecFeatures features
Bitmask of which features use this badge.
uint GetTotalColumnsWidth() const
Get total width of all columns.
Types related to the drop down widget.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint32_t PaletteID
The number of the palette.
Base for the NewGRF implementation.
uint32_t GetBadgeVariableResult(const GRFFile &grffile, std::span< const BadgeID > badges, uint32_t parameter)
Test for a matching badge in a list of badges, returning the number of matching bits.
Badge * GetBadge(BadgeID index)
Get a badge if it exists.
void ApplyBadgeFeaturesToClassBadges()
Apply features from all badges to their badge classes.
void MarkBadgeSeen(BadgeID index, GrfSpecFeature feature)
Mark a badge a seen (used) by a feature.
int DrawBadgeNameList(Rect r, std::span< const BadgeID > badges, GrfSpecFeature feature)
Draw names for a list of badge labels.
void AppendCopyableBadgeList(std::vector< BadgeID > &dst, std::span< const BadgeID > src, GrfSpecFeature feature)
Append copyable badges from a list onto another.
Badge * GetClassBadge(BadgeClassID class_index)
Get the badge class of a badge label.
Badge & GetOrCreateBadge(std::string_view label)
Register a badge label and return its global index.
Badge * GetBadgeByLabel(std::string_view label)
Get a badge by label if it exists.
void DrawBadgeColumn(Rect r, int column_group, const GUIBadgeClasses &badge_classes, std::span< const BadgeID > badges, GrfSpecFeature feature, std::optional< TimerGameCalendar::Date > introduction_date, PaletteID remap)
Draw a badge column group.
void ResetBadges()
Reset badges to the default state.
Types related to NewGRF badges.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
@ Filter
filter disabled/enabled
Types related to strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Dimensions (a width and height) of a rectangle in 2D.
Dynamic data of a loaded NewGRF.
Dimension size
Maximal size of this element.
uint sort_order
Order of element.
BadgeClassID badge_class
Badge class index.
std::string_view label
Class label (string owned by the class badge)
bool visible
Whether this element is visible.
uint8_t column_group
Column group in UI. 0 = left, 1 = centre, 2 = right.
Specification of a rectangle with absolute coordinates of all edges.
Variable-length list of sprite groups for an entity.
Definition of the game-calendar-timer.