OpenTTD Source 20250220-master-gf89924a727
newgrf_badge.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#include "stdafx.h"
11#include "dropdown_type.h"
13#include "newgrf.h"
14#include "newgrf_badge.h"
15#include "newgrf_badge_type.h"
16#include "newgrf_spritegroup.h"
17#include "stringfilter_type.h"
18#include "strings_func.h"
20#include "window_gui.h"
21#include "zoom_func.h"
22
23#include "table/strings.h"
24
25#include "safeguards.h"
26
28static constexpr char BADGE_CLASS_SEPARATOR = '/';
29
31class Badges {
32public:
33 std::vector<BadgeID> classes;
34 std::vector<Badge> specs;
35};
36
38static Badges _badges = {};
39
46{
47 auto it = std::ranges::find(_badges.classes, index);
48 if (it == std::end(_badges.classes)) {
49 it = _badges.classes.emplace(it, index);
50 }
51
52 return static_cast<BadgeClassID>(std::distance(std::begin(_badges.classes), it));
53}
54
59{
60 _badges = {};
61}
62
68Badge &GetOrCreateBadge(std::string_view label)
69{
70 /* Check if the label exists. */
71 auto it = std::ranges::find(_badges.specs, label, &Badge::label);
72 if (it != std::end(_badges.specs)) return *it;
73
74 BadgeClassID class_index;
75
76 /* Extract class. */
77 auto sep = label.find_first_of(BADGE_CLASS_SEPARATOR);
78 if (sep != std::string_view::npos) {
79 /* There is a separator, find (and create if necessary) the class label. */
80 class_index = GetOrCreateBadge(label.substr(0, sep)).class_index;
81 it = std::end(_badges.specs);
82 }
83
84 BadgeID index = BadgeID(std::distance(std::begin(_badges.specs), it));
85 if (sep == std::string_view::npos) {
86 /* There is no separator, so this badge is a class badge. */
87 class_index = GetOrCreateBadgeClass(index);
88 }
89
90 it = _badges.specs.emplace(it, label, index, class_index);
91 return *it;
92}
93
100{
101 if (index.base() >= std::size(_badges.specs)) return nullptr;
102 return &_badges.specs[index.base()];
103}
104
110Badge *GetBadgeByLabel(std::string_view label)
111{
112 auto it = std::ranges::find(_badges.specs, label, &Badge::label);
113 if (it == std::end(_badges.specs)) return nullptr;
114
115 return &*it;
116}
117
124{
125 if (class_index.base() >= std::size(_badges.classes)) return nullptr;
126 return GetBadge(_badges.classes[class_index.base()]);
127}
128
131 const Badge &badge;
132 const std::optional<TimerGameCalendar::Date> introduction_date;
133
140 BadgeScopeResolver(ResolverObject &ro, const Badge &badge, const std::optional<TimerGameCalendar::Date> introduction_date)
141 : ScopeResolver(ro), badge(badge), introduction_date(introduction_date) { }
142
143 uint32_t GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const override;
144};
145
146/* virtual */ uint32_t BadgeScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const
147{
148 switch (variable) {
149 case 0x40:
150 if (this->introduction_date.has_value()) return this->introduction_date->base();
151 return TimerGameCalendar::date.base();
152
153 default: break;
154 }
155
156 available = false;
157 return UINT_MAX;
158}
159
162 BadgeScopeResolver self_scope;
163
164 BadgeResolverObject(const Badge &badge, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, CallbackID callback = CBID_NO_CALLBACK, uint32_t callback_param1 = 0, uint32_t callback_param2 = 0);
165
166 ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, uint8_t relative = 0) override
167 {
168 switch (scope) {
169 case VSG_SCOPE_SELF: return &this->self_scope;
170 default: return ResolverObject::GetScope(scope, relative);
171 }
172 }
173
174 GrfSpecFeature GetFeature() const override;
175 uint32_t GetDebugID() const override;
176};
177
179{
180 return GSF_BADGES;
181}
182
184{
185 return this->self_scope.badge.index.base();
186}
187
197BadgeResolverObject::BadgeResolverObject(const Badge &badge, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, CallbackID callback, uint32_t callback_param1, uint32_t callback_param2)
198 : ResolverObject(badge.grf_prop.grffile, callback, callback_param1, callback_param2), self_scope(*this, badge, introduction_date)
199{
200 assert(feature <= GSF_END);
201 this->root_spritegroup = this->self_scope.badge.grf_prop.GetSpriteGroup(feature);
202 if (this->root_spritegroup == nullptr) this->root_spritegroup = this->self_scope.badge.grf_prop.GetSpriteGroup(GSF_END);
203}
204
212uint32_t GetBadgeVariableResult(const GRFFile &grffile, std::span<const BadgeID> badges, uint32_t parameter)
213{
214 if (parameter >= std::size(grffile.badge_list)) return UINT_MAX;
215
216 BadgeID index = grffile.badge_list[parameter];
217 return std::ranges::find(badges, index) != std::end(badges);
218}
219
224{
225 Badge *b = GetBadge(index);
226 assert(b != nullptr);
227 b->features.Set(feature);
228}
229
237void AppendCopyableBadgeList(std::vector<BadgeID> &dst, std::span<const BadgeID> src, GrfSpecFeature feature)
238{
239 for (const BadgeID &index : src) {
240 /* Is badge already present? */
241 if (std::ranges::find(dst, index) != std::end(dst)) continue;
242
243 /* Is badge copyable? */
244 Badge *badge = GetBadge(index);
245 if (badge == nullptr) continue;
246 if (!badge->flags.Test(BadgeFlag::Copy)) continue;
247
248 dst.push_back(index);
249 badge->features.Set(feature);
250 }
251}
252
255{
256 for (const Badge &badge : _badges.specs) {
257 Badge *class_badge = GetClassBadge(badge.class_index);
258 assert(class_badge != nullptr);
259 class_badge->features.Set(badge.features);
260 }
261}
262
263static constexpr uint MAX_BADGE_HEIGHT = 12;
264static constexpr uint MAX_BADGE_WIDTH = MAX_BADGE_HEIGHT * 2;
265
274static PalSpriteID GetBadgeSprite(const Badge &badge, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, PaletteID remap)
275{
276 BadgeResolverObject object(badge, feature, introduction_date);
277 const SpriteGroup *group = object.Resolve();
278 if (group == nullptr) return {0, PAL_NONE};
279
280 PaletteID pal = badge.flags.Test(BadgeFlag::UseCompanyColour) ? remap : PAL_NONE;
281
282 return {group->GetResult(), pal};
283}
284
292{
293 Dimension d = { 0, MAX_BADGE_HEIGHT };
294
295 for (const auto &badge : _badges.specs) {
296 if (badge.class_index != class_index) continue;
297
298 PalSpriteID ps = GetBadgeSprite(badge, feature, std::nullopt, PAL_NONE);
299 if (ps.sprite == 0) continue;
300
301 d.width = std::max(d.width, GetSpriteSize(ps.sprite, nullptr, ZOOM_LVL_NORMAL).width);
302 if (d.width > MAX_BADGE_WIDTH) break;
303 }
304
305 d.width = std::min(d.width, MAX_BADGE_WIDTH);
306 return d;
307}
308
311public:
317 {
318 for (auto index : _badges.classes) {
319 Badge *class_badge = GetBadge(index);
320 if (!class_badge->features.Test(feature)) continue;
321
322 this->classes.push_back(class_badge->class_index);
323 }
324
325 std::ranges::sort(this->classes, [](const BadgeClassID &a, const BadgeClassID &b)
326 {
327 return GetClassBadge(a)->label < GetClassBadge(b)->label;
328 });
329 }
330
331 std::span<const BadgeClassID> Classes() const { return this->classes; }
332
333private:
334 std::vector<BadgeClassID> classes;
335};
336
337static bool operator<(const GUIBadgeClasses::Element &a, const GUIBadgeClasses::Element &b)
338{
339 if (a.column_group != b.column_group) return a.column_group < b.column_group;
340 if (a.sort_order != b.sort_order) return a.sort_order < b.sort_order;
341 return a.label < b.label;
342}
343
348GUIBadgeClasses::GUIBadgeClasses(GrfSpecFeature feature)
349{
350 /* Get list of classes used by feature. */
351 UsedBadgeClasses used(feature);
352
353 uint max_column = 0;
354 for (BadgeClassID class_index : used.Classes()) {
355 Dimension size = GetBadgeMaximalDimension(class_index, feature);
356 if (size.width == 0) continue;
357
358 uint8_t column = 0;
359 bool visible = true;
360 uint sort_order = UINT_MAX;
361
362 std::string_view label = GetClassBadge(class_index)->label;
363
364 this->gui_classes.emplace_back(class_index, column, visible, sort_order, size, label);
365 if (visible) max_column = std::max<uint>(max_column, column);
366 }
367
368 std::sort(std::begin(this->gui_classes), std::end(this->gui_classes));
369
370 /* Determine total width of visible badge columns. */
371 this->column_widths.resize(max_column + 1);
372 for (const auto &el : this->gui_classes) {
373 if (!el.visible) continue;
374 this->column_widths[el.column_group] += ScaleGUITrad(el.size.width) + WidgetDimensions::scaled.hsep_normal;
375 }
376
377 /* Replace trailing `hsep_normal` spacer with wider `hsep_wide` spacer. */
378 for (uint &badge_width : this->column_widths) {
379 if (badge_width == 0) continue;
381 }
382}
383
389{
390 return std::accumulate(std::begin(this->column_widths), std::end(this->column_widths), 0U);
391}
392
399{
400 /* Do not filter if the filter text box is empty */
401 if (filter.IsEmpty()) return;
402
403 /* Pre-build list of badges that match by string. */
404 for (const auto &badge : _badges.specs) {
405 if (badge.name == STR_NULL) continue;
406 if (!badge.features.Test(feature)) continue;
407
408 filter.ResetState();
409 filter.AddLine(GetString(badge.name));
410 if (!filter.GetState()) continue;
411
412 auto it = std::ranges::lower_bound(this->badges, badge.index);
413 if (it != std::end(this->badges) && *it == badge.index) continue;
414
415 this->badges.insert(it, badge.index);
416 }
417}
418
424bool BadgeTextFilter::Filter(std::span<const BadgeID> badges) const
425{
426 return std::ranges::any_of(badges, [this](const BadgeID &badge) { return std::ranges::binary_search(this->badges, badge); });
427}
428
436int DrawBadgeNameList(Rect r, std::span<const BadgeID> badges, GrfSpecFeature)
437{
438 if (badges.empty()) return r.top;
439
440 std::set<BadgeClassID> classes;
441 for (const BadgeID &index : badges) classes.insert(GetBadge(index)->class_index);
442
443 std::string_view list_separator = GetListSeparator();
444 for (const BadgeClassID &class_index : classes) {
445 const Badge *class_badge = GetClassBadge(class_index);
446 if (class_badge == nullptr || class_badge->name == STR_NULL) continue;
447
448 std::string s;
449 for (const BadgeID &index : badges) {
450 const Badge *badge = GetBadge(index);
451 if (badge == nullptr || badge->name == STR_NULL) continue;
452 if (badge->class_index != class_index) continue;
453
454 if (!s.empty()) {
455 if (badge->flags.Test(BadgeFlag::NameListFirstOnly)) continue;
456 s += list_separator;
457 }
458 AppendStringInPlace(s, badge->name);
459 if (badge->flags.Test(BadgeFlag::NameListStop)) break;
460 }
461
462 if (s.empty()) continue;
463
464 SetDParam(0, class_badge->name);
465 SetDParamStr(1, std::move(s));
466 r.top = DrawStringMultiLine(r, STR_BADGE_NAME_LIST, TC_BLACK);
467 }
468
469 return r.top;
470}
471
482void 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)
483{
484 bool rtl = _current_text_dir == TD_RTL;
485 for (const auto &badge_class : badge_classes.GetClasses()) {
486 if (badge_class.column_group != column_group) continue;
487 if (!badge_class.visible) continue;
488
489 int width = ScaleGUITrad(badge_class.size.width);
490 for (const BadgeID &index : badges) {
491 const Badge &badge = *GetBadge(index);
492 if (badge.class_index != badge_class.badge_class) continue;
493
494 PalSpriteID ps = GetBadgeSprite(badge, feature, introduction_date, remap);
495 if (ps.sprite == 0) continue;
496
497 DrawSpriteIgnorePadding(ps.sprite, ps.pal, r.WithWidth(width, rtl), SA_CENTER);
498 break;
499 }
500
501 r = r.Indent(width + WidgetDimensions::scaled.hsep_normal, rtl);
502 }
503}
504
506template <class TBase, bool TEnd = true, FontSize TFs = FS_NORMAL>
507class DropDownBadges : public TBase {
508public:
509 template <typename... Args>
510 explicit DropDownBadges(const std::shared_ptr<GUIBadgeClasses> &badge_classes, std::span<const BadgeID> badges, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, Args&&... args)
511 : TBase(std::forward<Args>(args)...), badge_classes(badge_classes), badges(badges), feature(feature), introduction_date(introduction_date)
512 {
513 for (const auto &badge_class : badge_classes->GetClasses()) {
514 if (badge_class.column_group != 0) continue;
515 dim.width += badge_class.size.width + WidgetDimensions::scaled.hsep_normal;
516 dim.height = std::max(dim.height, badge_class.size.height);
517 }
518 }
519
520 uint Height() const override { return std::max<uint>(this->dim.height, this->TBase::Height()); }
521 uint Width() const override { return this->dim.width + WidgetDimensions::scaled.hsep_wide + this->TBase::Width(); }
522
523 void Draw(const Rect &full, const Rect &r, bool sel, Colours bg_colour) const override
524 {
525 bool rtl = TEnd ^ (_current_text_dir == TD_RTL);
526
527 DrawBadgeColumn(r.WithWidth(this->dim.width, rtl), 0, *this->badge_classes, this->badges, this->feature, this->introduction_date, PAL_NONE);
528
529 this->TBase::Draw(full, r.Indent(this->dim.width + WidgetDimensions::scaled.hsep_wide, rtl), sel, bg_colour);
530 }
531
532private:
533 std::shared_ptr<GUIBadgeClasses> badge_classes;
534
535 const std::span<const BadgeID> badges;
536 const GrfSpecFeature feature;
537 const std::optional<TimerGameCalendar::Date> introduction_date;
538
539 Dimension dim{};
540
541};
542
545
546std::unique_ptr<DropDownListItem> MakeDropDownListBadgeItem(const std::shared_ptr<GUIBadgeClasses> &badge_classes, std::span<const BadgeID> badges, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, StringID str, int value, bool masked, bool shaded)
547{
548 return std::make_unique<DropDownListBadgeItem>(badge_classes, badges, feature, introduction_date, str, value, masked, shaded);
549}
550
551std::unique_ptr<DropDownListItem> MakeDropDownListBadgeIconItem(const std::shared_ptr<GUIBadgeClasses> &badge_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, bool shaded)
552{
553 return std::make_unique<DropDownListBadgeIconItem>(badge_classes, badges, feature, introduction_date, dim, sprite, palette, str, value, masked, shaded);
554}
bool Filter(std::span< const BadgeID > badges) const
Test if any of the given badges matches the filtered badge list.
BadgeTextFilter(struct StringFilter &filter, GrfSpecFeature feature)
Construct a badge text filter.
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.
StringID name
Short name.
Global state for badge definitions.
std::vector< BadgeID > classes
List of known badge classes.
std::vector< Badge > specs
List of known badges.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Set()
Set all bits.
Drop down element that draws a list of badges.
uint GetTotalColumnsWidth() const
Get total width of all columns.
static Date date
Current date in days (day counter).
Utility class to create a list of badge classes used by a feature.
std::vector< BadgeClassID > classes
List of badge classes.
UsedBadgeClasses(GrfSpecFeature feature)
Create a list of used badge classes for a feature.
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:28
int hsep_wide
Wide horizontal spacing.
Definition window_gui.h:62
int hsep_normal
Normal horizontal spacing.
Definition window_gui.h:61
Common drop down list components.
Types related to the drop down widget.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition gfx.cpp:922
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition gfx.cpp:774
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
@ SA_CENTER
Center both horizontally and vertically.
Definition gfx_type.h:385
uint32_t PaletteID
The number of the palette.
Definition gfx_type.h:18
Base for the NewGRF implementation.
GrfSpecFeature
Definition newgrf.h:69
int DrawBadgeNameList(Rect r, std::span< const BadgeID > badges, GrfSpecFeature)
Draw names for a list of badge labels.
static Badges _badges
Static instance of badge state.
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.
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.
static constexpr char BADGE_CLASS_SEPARATOR
Separator to identify badge classes from a label.
static constexpr uint MAX_BADGE_HEIGHT
Maximal height of a badge sprite.
static BadgeClassID GetOrCreateBadgeClass(BadgeID index)
Assign a BadgeClassID to the given badge.
static constexpr uint MAX_BADGE_WIDTH
Maximal width.
Badge & GetOrCreateBadge(std::string_view label)
Register a badge label and return its global index.
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.
static Dimension GetBadgeMaximalDimension(BadgeClassID class_index, GrfSpecFeature feature)
Get the largest badge size (within limits) for a badge class.
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.
static PalSpriteID GetBadgeSprite(const Badge &badge, GrfSpecFeature feature, std::optional< TimerGameCalendar::Date > introduction_date, PaletteID remap)
Get sprite for the given badge.
void ResetBadges()
Reset badges to the default state.
Functions related to NewGRF badges.
Badge * GetClassBadge(BadgeClassID class_index)
Get the badge class of a badge label.
Types related to NewGRF badges.
@ NameListStop
Stop adding names to the name list after this badge.
@ UseCompanyColour
Apply company colour palette to this badge.
@ NameListFirstOnly
Don't add this name to the name list if not first.
@ Copy
Copy badge to related things.
CallbackID
List of implemented NewGRF callbacks.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
Action 2 handling.
VarSpriteGroupScope
@ VSG_SCOPE_SELF
Resolved object itself.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Searching and filtering using a stringterm.
std::string_view GetListSeparator()
Get the list separator string for the current language.
Definition strings.cpp:303
void AppendStringInPlace(std::string &result, StringID string)
Resolve the given StringID and append in place into an existing std::string with all the associated D...
Definition strings.cpp:432
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Definition strings.cpp:163
std::string GetString(StringID string)
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
Definition strings.cpp:420
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
void SetDParamStr(size_t n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
Definition strings.cpp:466
Functions related to OTTD's strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
@ TD_RTL
Text is written right-to-left by default.
Resolver of badges.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
BadgeResolverObject(const Badge &badge, GrfSpecFeature feature, std::optional< TimerGameCalendar::Date > introduction_date, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Constructor of the badge resolver.
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
Resolver for a badge scope.
BadgeScopeResolver(ResolverObject &ro, const Badge &badge, const std::optional< TimerGameCalendar::Date > introduction_date)
Scope resolver of a badge.
uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const override
Get a variable value.
Dimensions (a width and height) of a rectangle in 2D.
Dynamic data of a loaded NewGRF.
Definition newgrf.h:112
std::vector< BadgeID > badge_list
Badge translation table (local index -> global index)
Definition newgrf.h:136
uint sort_order
Order of element.
std::string_view label
Class label (string owned by the class badge)
uint8_t column_group
Column group in UI. 0 = left, 1 = centre, 2 = right.
Combination of a palette sprite and a 'real' sprite.
Definition gfx_type.h:22
SpriteID sprite
The 'real' sprite.
Definition gfx_type.h:23
PaletteID pal
The palette (use PAL_NONE) if not needed)
Definition gfx_type.h:24
Specification of a rectangle with absolute coordinates of all edges.
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
Interface for SpriteGroup-s to access the gamestate.
uint32_t callback_param2
Second parameter (var 18) of the callback.
CallbackID callback
Callback being resolved.
uint32_t callback_param1
First parameter (var 10) of the callback.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0)
Get a resolver for the scope.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
ResolverObject & ro
Surrounding resolver object.
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
String filter and state.
bool IsEmpty() const
Check whether any filter words were entered.
void ResetState()
Reset the matching state to process a new item.
void AddLine(const char *str)
Pass another text line from the current item to the filter.
bool GetState() const
Get the matching state of the current item.
const struct SpriteGroup * GetSpriteGroup(size_t index) const
Get the SpriteGroup at the specified index.
int16_t Height
Fixed point type for heights.
Definition tgp.cpp:153
Definition of the game-calendar-timer.
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition widget.cpp:35
Functions, definitions and such used only by the GUI.
Functions related to zooming.
@ ZOOM_LVL_NORMAL
The normal zoom level.
Definition zoom_type.h:21