aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-06-13 01:25:21 +0200
committer GitHub <noreply@github.com>2024-06-13 01:25:21 +0200
commit01a8f60aaca9784d814f4cb35a3fc4be86e1dd20 (patch)
treeebc9c03b5bd0a6b11068ac37aca302f6ceb24a18 /src/openvic-simulation/military
parenta49e4d0975e2b5dfd13ae50aa716f1a0307e618d (diff)
parentc0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (diff)
Merge pull request #163 from OpenVicProject/good-instance
Add GoodInstance
Diffstat (limited to 'src/openvic-simulation/military')
-rw-r--r--src/openvic-simulation/military/UnitType.cpp12
-rw-r--r--src/openvic-simulation/military/UnitType.hpp10
2 files changed, 12 insertions, 10 deletions
diff --git a/src/openvic-simulation/military/UnitType.cpp b/src/openvic-simulation/military/UnitType.cpp
index 1fafe35..45ce5d9 100644
--- a/src/openvic-simulation/military/UnitType.cpp
+++ b/src/openvic-simulation/military/UnitType.cpp
@@ -146,10 +146,10 @@ bool UnitTypeManager::add_ship_type(
}
bool UnitTypeManager::load_unit_type_file(
- GoodManager const& good_manager, TerrainTypeManager const& terrain_type_manager, ModifierManager const& modifier_manager,
- ast::NodeCPtr root
+ GoodDefinitionManager const& good_definition_manager, TerrainTypeManager const& terrain_type_manager,
+ ModifierManager const& modifier_manager, ast::NodeCPtr root
) {
- return expect_dictionary([this, &good_manager, &terrain_type_manager, &modifier_manager](
+ return expect_dictionary([this, &good_definition_manager, &terrain_type_manager, &modifier_manager](
std::string_view key, ast::NodeCPtr value
) -> bool {
@@ -194,9 +194,11 @@ bool UnitTypeManager::load_unit_type_file(
"move_sound", ZERO_OR_ONE, expect_identifier(assign_variable_callback(unit_args.move_sound)),
"select_sound", ZERO_OR_ONE, expect_identifier(assign_variable_callback(unit_args.select_sound)),
"build_time", ONE_EXACTLY, expect_days(assign_variable_callback(unit_args.build_time)),
- "build_cost", ONE_EXACTLY, good_manager.expect_good_decimal_map(move_variable_callback(unit_args.build_cost)),
+ "build_cost", ONE_EXACTLY,
+ good_definition_manager.expect_good_definition_decimal_map(move_variable_callback(unit_args.build_cost)),
"supply_consumption", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(unit_args.supply_consumption)),
- "supply_cost", ONE_EXACTLY, good_manager.expect_good_decimal_map(move_variable_callback(unit_args.supply_cost))
+ "supply_cost", ONE_EXACTLY,
+ good_definition_manager.expect_good_definition_decimal_map(move_variable_callback(unit_args.supply_cost))
);
const auto add_terrain_modifier = [&unit_args, &terrain_type_manager, &modifier_manager](
diff --git a/src/openvic-simulation/military/UnitType.hpp b/src/openvic-simulation/military/UnitType.hpp
index 201708e..9e7ecdc 100644
--- a/src/openvic-simulation/military/UnitType.hpp
+++ b/src/openvic-simulation/military/UnitType.hpp
@@ -5,7 +5,7 @@
#include "openvic-simulation/misc/Modifier.hpp"
#include "openvic-simulation/dataloader/NodeTools.hpp"
-#include "openvic-simulation/economy/Good.hpp"
+#include "openvic-simulation/economy/GoodDefinition.hpp"
#include "openvic-simulation/types/Date.hpp"
#include "openvic-simulation/types/IdentifierRegistry.hpp"
#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"
@@ -33,7 +33,7 @@ namespace OpenVic {
fixed_point_t max_strength = 0, default_organisation = 0, maximum_speed = 0, weighted_value = 0,
supply_consumption = 0;
Timespan build_time;
- Good::good_map_t build_cost, supply_cost;
+ GoodDefinition::good_definition_map_t build_cost, supply_cost;
terrain_modifiers_t terrain_modifiers;
unit_type_args_t() = default;
@@ -58,9 +58,9 @@ namespace OpenVic {
std::string PROPERTY(select_sound);
const Timespan PROPERTY(build_time);
- Good::good_map_t PROPERTY(build_cost);
+ GoodDefinition::good_definition_map_t PROPERTY(build_cost);
const fixed_point_t PROPERTY(supply_consumption);
- Good::good_map_t PROPERTY(supply_cost);
+ GoodDefinition::good_definition_map_t PROPERTY(supply_cost);
terrain_modifiers_t PROPERTY(terrain_modifiers);
@@ -173,7 +173,7 @@ namespace OpenVic {
}
bool load_unit_type_file(
- GoodManager const& good_manager, TerrainTypeManager const& terrain_type_manager,
+ GoodDefinitionManager const& good_definition_manager, TerrainTypeManager const& terrain_type_manager,
ModifierManager const& modifier_manager, ast::NodeCPtr root
);
bool generate_modifiers(ModifierManager& modifier_manager) const;