Codechange: use std::vector for _sorted_cargo_specs

This commit is contained in:
glx
2019-04-12 17:47:13 +02:00
committed by glx22
parent f0b3267615
commit 0797de06be
3 changed files with 19 additions and 21 deletions

View File

@@ -17,6 +17,7 @@
#include "gfx_type.h"
#include "strings_type.h"
#include "landscape_type.h"
#include <vector>
/** Globally unique label of a cargo type. */
typedef uint32 CargoLabel;
@@ -137,8 +138,7 @@ CargoID GetCargoIDByLabel(CargoLabel cl);
CargoID GetCargoIDByBitnum(uint8 bitnum);
void InitializeSortedCargoSpecs();
extern const CargoSpec *_sorted_cargo_specs[NUM_CARGO];
extern uint8 _sorted_cargo_specs_size;
extern std::vector<const CargoSpec *> _sorted_cargo_specs;
extern uint8 _sorted_standard_cargo_specs_size;
/**
@@ -163,7 +163,7 @@ static inline bool IsCargoInClass(CargoID c, CargoClass cc)
* @param var Reference getting the cargospec.
* @see CargoSpec
*/
#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_cargo_specs_size && (var = _sorted_cargo_specs[index], true) ; index++)
#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_cargo_specs.size() && (var = _sorted_cargo_specs[index], true) ; index++)
/**
* Loop header for iterating over 'real' cargoes, sorted by name. Phony cargoes like regearing cargoes are skipped.