From 1e40569a49ab0d557a2a43ee900f4f28d5c81cd3 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 28 Sep 2023 23:33:46 +0100 Subject: Data types, defaults, callback cleanup --- src/openvic-simulation/map/Building.hpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/openvic-simulation/map/Building.hpp') diff --git a/src/openvic-simulation/map/Building.hpp b/src/openvic-simulation/map/Building.hpp index 1c2ded0..9b445bf 100644 --- a/src/openvic-simulation/map/Building.hpp +++ b/src/openvic-simulation/map/Building.hpp @@ -7,10 +7,10 @@ #include "openvic-simulation/economy/ProductionType.hpp" #include "openvic-simulation/Modifier.hpp" -#define ARGS BuildingType const& type, std::string_view on_completion, fixed_point_t completion_size, level_t max_level, \ - std::map goods_cost, fixed_point_t cost, Timespan build_time, bool visibility, bool on_map, bool default_enabled, \ +#define ARGS std::string_view on_completion, fixed_point_t completion_size, level_t max_level, \ + std::map goods_cost, fixed_point_t cost, Timespan build_time, bool visibility, bool on_map, bool default_enabled, \ ProductionType const* production_type, bool pop_build_factory, bool strategic_factory, bool advanced_factory, level_t fort_level, \ - uint64_t naval_capacity, std::vector colonial_points, bool in_province, bool one_per_state, fixed_point_t colonial_range, \ + uint64_t naval_capacity, std::vector colonial_points, bool in_province, bool one_per_state, fixed_point_t colonial_range, \ fixed_point_t infrastructure, fixed_point_t movement_cost, fixed_point_t local_ship_build, bool spawn_railway_track, bool sail, bool steam, \ bool capital, bool port, ModifierValue&& modifiers @@ -27,19 +27,19 @@ namespace OpenVic { struct Building : HasIdentifier, ModifierValue { friend struct BuildingManager; - using level_t = uint8_t; + using level_t = int8_t; private: BuildingType const& type; - const std::string_view on_completion; //probably sound played on completion + const std::string on_completion; //probably sound played on completion const fixed_point_t completion_size; const level_t max_level; - const std::map goods_cost; + const std::map goods_cost; const fixed_point_t cost; const Timespan build_time; //time const bool visibility; const bool on_map; //onmap - + const bool default_enabled; ProductionType const* production_type; const bool pop_build_factory; @@ -49,7 +49,7 @@ namespace OpenVic { const level_t fort_level; //probably the step-per-level const uint64_t naval_capacity; - const std::vector colonial_points; + const std::vector colonial_points; const bool in_province; //province const bool one_per_state; const fixed_point_t colonial_range; @@ -64,16 +64,16 @@ namespace OpenVic { const bool capital; //only in naval base const bool port; //only in naval base - Building(std::string_view identifier, ARGS); + Building(std::string_view identifier, BuildingType const& type, ARGS); public: Building(Building&&) = default; BuildingType const& get_type() const; - std::string_view get_on_completion() const; + std::string const& get_on_completion() const; fixed_point_t get_completion_size() const; level_t get_max_level() const; - std::map const& get_goods_cost() const; + std::map const& get_goods_cost() const; fixed_point_t get_cost() const; Timespan get_build_time() const; bool has_visibility() const; @@ -84,15 +84,15 @@ namespace OpenVic { bool is_pop_built_factory() const; bool is_strategic_factory() const; bool is_advanced_factory() const; - + level_t get_fort_level() const; uint64_t get_naval_capacity() const; - std::vector const& get_colonial_points() const; + std::vector const& get_colonial_points() const; bool is_in_province() const; bool is_one_per_state() const; fixed_point_t get_colonial_range() const; - + fixed_point_t get_infrastructure() const; fixed_point_t get_movement_cost() const; fixed_point_t get_local_ship_build() const; @@ -119,7 +119,7 @@ namespace OpenVic { struct BuildingInstance : HasIdentifier { //used in the actual game friend struct BuildingManager; using level_t = Building::level_t; - + private: Building const& building; @@ -164,7 +164,7 @@ namespace OpenVic { bool add_building_type(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(BuildingType, building_type) - bool add_building(std::string_view identifier, ARGS); + bool add_building(std::string_view identifier, BuildingType const* type, ARGS); IDENTIFIER_REGISTRY_ACCESSORS(Building, building) bool load_buildings_file(GoodManager const& good_manager, ProductionTypeManager const& production_type_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root); -- cgit v1.2.3-56-ga3b1