diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-28 20:51:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 20:51:56 +0200 |
commit | ae0be2a8d2e1b717f6c4a4617096f17089ce8701 (patch) | |
tree | 897742b074547e4d1694ddff1f4e9e8f14d82d6a /src/openvic-simulation/units/Unit.cpp | |
parent | d21255b2ca2fe6cea7f41e88fbb22d138bac74eb (diff) | |
parent | c541a249247b7fe3bdd4c62bce6638e875790f8a (diff) |
Merge pull request #37 from OpenVicProject/dataloading-buildings
Dataloading buildings
Diffstat (limited to 'src/openvic-simulation/units/Unit.cpp')
-rw-r--r-- | src/openvic-simulation/units/Unit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/openvic-simulation/units/Unit.cpp b/src/openvic-simulation/units/Unit.cpp index f57e0a7..b965f93 100644 --- a/src/openvic-simulation/units/Unit.cpp +++ b/src/openvic-simulation/units/Unit.cpp @@ -52,7 +52,7 @@ fixed_point_t Unit::get_maximum_speed() const { return maximum_speed; } -uint32_t Unit::get_build_time() const { +Timespan Unit::get_build_time() const { return build_time; } @@ -210,14 +210,14 @@ bool UnitManager::add_naval_unit(const std::string_view identifier, UNIT_PARAMS, return units.add_item(NavalUnit { identifier, UNIT_ARGS, NAVY_ARGS }); } -//TODO forgot fcking capital flag for naval units + bool UnitManager::load_unit_file(GoodManager const& good_manager, ast::NodeCPtr root) { return NodeTools::expect_dictionary([this, &good_manager](std::string_view key, ast::NodeCPtr value) -> bool { Unit::icon_t icon; std::string_view category, type; Unit::sprite_t sprite; bool active = true, floating_flag; - uint32_t priority, build_time; + uint32_t priority, build_time_days; fixed_point_t maximum_speed, max_strength, default_organisation, weighted_value, supply_consumption; std::map<const Good*, fixed_point_t> build_cost, supply_cost; @@ -234,12 +234,14 @@ bool UnitManager::load_unit_file(GoodManager const& good_manager, ast::NodeCPtr "default_organisation", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(default_organisation)), "maximum_speed", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(maximum_speed)), "weighted_value", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(weighted_value)), - "build_time", ONE_EXACTLY, expect_uint(assign_variable_callback_uint("unit build time", build_time)), + "build_time", ONE_EXACTLY, expect_uint(assign_variable_callback_uint("unit build time", build_time_days)), "build_cost", ONE_EXACTLY, good_manager.expect_good_decimal_map(assign_variable_callback(build_cost)), "supply_consumption", ONE_EXACTLY, expect_fixed_point(move_variable_callback(supply_consumption)), "supply_cost", ONE_EXACTLY, good_manager.expect_good_decimal_map(move_variable_callback(supply_cost)) )(value); + Timespan build_time = { build_time_days }; + if (category == "land") { fixed_point_t reconnaissance, attack, defence, discipline, support, maneuver, siege; |