Cleanup: Simplify GRFLabel linked-list with std::vector. (#10284)

This commit is contained in:
PeterN
2022-12-25 22:32:22 +00:00
committed by GitHub
parent c53f29df53
commit 4f26f6b8aa
2 changed files with 12 additions and 31 deletions

View File

@@ -98,7 +98,8 @@ struct GRFLabel {
byte label;
uint32 nfo_line;
size_t pos;
struct GRFLabel *next;
GRFLabel(byte label, uint32 nfo_line, size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {}
};
/** Dynamic data of a loaded NewGRF */
@@ -121,7 +122,7 @@ struct GRFFile : ZeroedMemoryAllocator {
uint32 param[0x80];
uint param_end; ///< one more than the highest set parameter
GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array.
std::vector<GRFLabel> labels; ///< List of labels
std::vector<CargoLabel> cargo_list; ///< Cargo translation table (local ID -> label)
uint8 cargo_map[NUM_CARGO]; ///< Inverse cargo translation table (CargoID -> local ID)