mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-11 01:49:50 +00:00
Codechange: Use std::array for water features.
Replaces a memset() with fill().
This commit is contained in:
parent
ebc57634e4
commit
b9ae833e96
@ -8838,7 +8838,7 @@ void ResetNewGRFData()
|
|||||||
ResetCustomRoadStops();
|
ResetCustomRoadStops();
|
||||||
|
|
||||||
/* Reset canal sprite groups and flags */
|
/* Reset canal sprite groups and flags */
|
||||||
memset(_water_feature, 0, sizeof(_water_feature));
|
_water_feature.fill({});
|
||||||
|
|
||||||
/* Reset the snowline table. */
|
/* Reset the snowline table. */
|
||||||
ClearSnowLine();
|
ClearSnowLine();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/** Table of canal 'feature' sprite groups */
|
/** Table of canal 'feature' sprite groups */
|
||||||
WaterFeature _water_feature[CF_END];
|
std::array<WaterFeature, CF_END> _water_feature;
|
||||||
|
|
||||||
/** Scope resolver of a canal tile. */
|
/** Scope resolver of a canal tile. */
|
||||||
struct CanalScopeResolver : public ScopeResolver {
|
struct CanalScopeResolver : public ScopeResolver {
|
||||||
|
@ -20,15 +20,15 @@ enum CanalFeatureFlag : uint8_t {
|
|||||||
|
|
||||||
/** Information about a water feature. */
|
/** Information about a water feature. */
|
||||||
struct WaterFeature {
|
struct WaterFeature {
|
||||||
const SpriteGroup *group; ///< Sprite group to start resolving.
|
const SpriteGroup *group = nullptr; ///< Sprite group to start resolving.
|
||||||
const GRFFile *grffile; ///< NewGRF where 'group' belongs to.
|
const GRFFile *grffile = nullptr; ///< NewGRF where 'group' belongs to.
|
||||||
uint8_t callback_mask; ///< Bitmask of canal callbacks that have to be called.
|
uint8_t callback_mask = 0; ///< Bitmask of canal callbacks that have to be called.
|
||||||
uint8_t flags; ///< Flags controlling display.
|
uint8_t flags = 0; ///< Flags controlling display.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Table of canal 'feature' sprite groups */
|
/** Table of canal 'feature' sprite groups */
|
||||||
extern WaterFeature _water_feature[CF_END];
|
extern std::array<WaterFeature, CF_END> _water_feature;
|
||||||
|
|
||||||
|
|
||||||
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile);
|
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile);
|
||||||
|
Loading…
Reference in New Issue
Block a user