OpenTTD Source: src/newgrf_badge_config.h File Reference

OpenTTD Source 15.3

Data Structures | Functions
newgrf_badge_config.h File Reference

Functions related to NewGRF badge configuration. More...

`#include "newgrf.h"`
`#include "newgrf_badge_type.h"`

Go to the source code of this file.

## Data Structures
class | BadgeClassConfigItem

## Functions
void | BadgeClassLoadConfig (const struct IniFile &ini)
void | BadgeClassSaveConfig (struct IniFile &ini)
| Save badge column preferences.
std::span< BadgeClassConfigItem > | GetBadgeClassConfiguration (GrfSpecFeature feature)
| Get the badge user configuration for a feature.
void | AddBadgeClassesToConfiguration ()
| Add current badge classes to user configuration.
void | ResetBadgeClassConfiguration (GrfSpecFeature feature)
| Reset badge class configuration for a feature.
std::pair< const BadgeClassConfigItem &, int > | GetBadgeClassConfigItem (GrfSpecFeature feature, std::string_view label)
| Get configuration for a badge class.

## Detailed Description

Functions related to NewGRF badge configuration.

Definition in file newgrf_badge_config.h.

## Function Documentation

## ◆ AddBadgeClassesToConfiguration()

void AddBadgeClassesToConfiguration | ( |  | ) |

Add current badge classes to user configuration.

Definition at line 76 of file newgrf_badge_config.cpp.

References _badge_config, Badge::features, GetBadge(), GetClassBadges(), Badge::label, BadgeClassConfigItem::label, Badge::name, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by FinaliseBadges().

## ◆ BadgeClassSaveConfig()

void BadgeClassSaveConfig | ( | IniFile & | ini | ) |

Save badge column preferences.

Parameters

  ini | IniFile to save to.

Definition at line 198 of file newgrf_badge_config.cpp.

References BadgeClassSaveConfigFeature().

Referenced by SaveToConfig().

## ◆ GetBadgeClassConfigItem()

std::pair< const BadgeClassConfigItem &, int > GetBadgeClassConfigItem | ( | GrfSpecFeature | feature,
|  | std::string_view | label
| ) |  |

Get configuration for a badge class.

Parameters

  feature | Feature being used.
  label | Badge class label.

Returns
  badge class configuration item.

Definition at line 119 of file newgrf_badge_config.cpp.

References GetBadgeClassConfiguration(), and BadgeClassConfigItem::label.

Referenced by AddBadgeDropdownFilters(), and GUIBadgeClasses::GUIBadgeClasses().

## ◆ GetBadgeClassConfiguration()

std::span< BadgeClassConfigItem > GetBadgeClassConfiguration | ( | GrfSpecFeature | feature | ) |

Get the badge user configuration for a feature.

Returns
  badge configuration for the given feature.

Definition at line 66 of file newgrf_badge_config.cpp.

References _badge_config, and to_underlying().

Referenced by GetBadgeClassConfigItem().

## ◆ ResetBadgeClassConfiguration()

void ResetBadgeClassConfiguration | ( | GrfSpecFeature | feature | ) |

Reset badge class configuration for a feature.

Parameters

  feature | Feature to reset.

Definition at line 99 of file newgrf_badge_config.cpp.

References _badge_config, GetBadge(), GetClassBadges(), Badge::label, and Badge::name.

Referenced by HandleBadgeConfigurationDropDownClick().