Codechange: Use std::optional for GRF Parameter list.

This commit is contained in:
Peter Nelson
2023-05-18 12:19:51 +01:00
committed by PeterN
parent c51a7f629e
commit f14479d27d
4 changed files with 62 additions and 65 deletions

View File

@@ -153,7 +153,6 @@ struct GRFParameterInfo {
struct GRFConfig : ZeroedMemoryAllocator {
GRFConfig(const std::string &filename = std::string{});
GRFConfig(const GRFConfig &config);
~GRFConfig();
/* Remove the copy assignment, as the default implementation will not do the right thing. */
GRFConfig &operator=(GRFConfig &rhs) = delete;
@@ -175,7 +174,7 @@ struct GRFConfig : ZeroedMemoryAllocator {
uint8 num_params; ///< Number of used parameters
uint8 num_valid_params; ///< NOSAVE: Number of valid parameters (action 0x14)
uint8 palette; ///< GRFPalette, bitset
std::vector<GRFParameterInfo *> param_info; ///< NOSAVE: extra information about the parameters
std::vector<std::optional<GRFParameterInfo>> param_info; ///< NOSAVE: extra information about the parameters
bool has_param_defaults; ///< NOSAVE: did this newgrf specify any defaults for it's parameters
struct GRFConfig *next; ///< NOSAVE: Next item in the linked list