* Append copyable badges from a list onto another. * Badges must exist and be marked with the Copy flag. * @param dst Destination badge list. * @param src Source badge list. * @param feature Feature of list. */
| 248 | * @param feature Feature of list. |
| 249 | */ |
| 250 | void AppendCopyableBadgeList(std::vector<BadgeID> &dst, std::span<const BadgeID> src, GrfSpecFeature feature) |
| 251 | { |
| 252 | for (const BadgeID &index : src) { |
| 253 | /* Is badge already present? */ |
| 254 | if (std::ranges::find(dst, index) != std::end(dst)) continue; |
| 255 | |
| 256 | /* Is badge copyable? */ |
| 257 | Badge *badge = GetBadge(index); |
| 258 | if (badge == nullptr) continue; |
| 259 | if (!badge->flags.Test(BadgeFlag::Copy)) continue; |
| 260 | |
| 261 | dst.push_back(index); |
| 262 | badge->features.Set(feature); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | /** Apply features from all badges to their badge classes. */ |
| 267 | void ApplyBadgeFeaturesToClassBadges() |