Codechange: Use std::vector for industry tile layouts

This commit is contained in:
Niels Martin Hansen
2019-10-04 21:26:44 +02:00
committed by Charles Pigott
parent e5f1755629
commit 53f8d0b815
11 changed files with 272 additions and 355 deletions

View File

@@ -13,6 +13,7 @@
#define INDUSTRYTYPE_H
#include <array>
#include <vector>
#include "map_type.h"
#include "slope_type.h"
#include "industry_type.h"
@@ -23,7 +24,6 @@
enum IndustryCleanupType {
CLEAN_RANDOMSOUNDS, ///< Free the dynamically allocated sounds table
CLEAN_TILELAYOUT, ///< Free the dynamically allocated tile layout structure
};
/** Available types of industry lifetimes. */
@@ -93,17 +93,20 @@ enum IndustryTileSpecialFlags {
};
DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags)
struct IndustryTileTable {
/** Definition of one tile in an industry tile layout */
struct IndustryTileLayoutTile {
TileIndexDiffC ti;
IndustryGfx gfx;
};
/** A complete tile layout for an industry is a list of tiles */
using IndustryTileLayout = std::vector<IndustryTileLayoutTile>;
/**
* Defines the data structure for constructing industry.
*/
struct IndustrySpec {
const IndustryTileTable * const *table; ///< List of the tiles composing the industry
byte num_table; ///< Number of elements in the table
std::vector<IndustryTileLayout> layouts; ///< List of possible tile layouts for the industry
uint8 cost_multiplier; ///< Base construction cost multiplier.
uint32 removal_cost_multiplier; ///< Base removal cost multiplier.
uint32 prospecting_chance; ///< Chance prospecting succeeds
@@ -143,6 +146,8 @@ struct IndustrySpec {
Money GetConstructionCost() const;
Money GetRemovalCost() const;
bool UsesSmoothEconomy() const;
~IndustrySpec();
};
/**