aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/research
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2024-02-12 12:15:04 +0100
committer zaaarf <me@zaaarf.foo>2024-03-16 14:01:15 +0100
commit023860d53a90774dcdba84ad7c0dca3c944c9a49 (patch)
treed5b186facf7c3a08e6ccf2e8261b7de054957a41 /src/openvic-simulation/research
parent2c892c99a6647be15ef23cabf6cc40f08769283d (diff)
feat: unit instance type definition, renamed existing structs for consistencymilitary-units
Diffstat (limited to 'src/openvic-simulation/research')
-rw-r--r--src/openvic-simulation/research/Invention.cpp8
-rw-r--r--src/openvic-simulation/research/Invention.hpp8
-rw-r--r--src/openvic-simulation/research/Technology.cpp6
-rw-r--r--src/openvic-simulation/research/Technology.hpp6
4 files changed, 14 insertions, 14 deletions
diff --git a/src/openvic-simulation/research/Invention.cpp b/src/openvic-simulation/research/Invention.cpp
index 792dcba..0f92632 100644
--- a/src/openvic-simulation/research/Invention.cpp
+++ b/src/openvic-simulation/research/Invention.cpp
@@ -2,7 +2,7 @@
#include "openvic-simulation/economy/BuildingType.hpp"
#include "openvic-simulation/map/Crime.hpp"
-#include "openvic-simulation/military/Unit.hpp"
+#include "openvic-simulation/military/UnitType.hpp"
using namespace OpenVic;
using namespace OpenVic::NodeTools;
@@ -40,11 +40,11 @@ bool InventionManager::add_invention(
}
bool InventionManager::load_inventions_file(
- ModifierManager const& modifier_manager, UnitManager const& unit_manager, BuildingTypeManager const& building_type_manager,
+ ModifierManager const& modifier_manager, UnitTypeManager const& unit_type_manager, BuildingTypeManager const& building_type_manager,
CrimeManager const& crime_manager, ast::NodeCPtr root
) {
return expect_dictionary_reserve_length(
- inventions, [this, &modifier_manager, &unit_manager, &building_type_manager, &crime_manager](
+ inventions, [this, &modifier_manager, &unit_type_manager, &building_type_manager, &crime_manager](
std::string_view identifier, ast::NodeCPtr value) -> bool {
ModifierValue loose_modifiers;
ModifierValue modifiers;
@@ -68,7 +68,7 @@ bool InventionManager::load_inventions_file(
move_variable_callback(modifiers),
"gas_attack", ZERO_OR_ONE, expect_bool(assign_variable_callback(unlock_gas_attack)),
"gas_defence", ZERO_OR_ONE, expect_bool(assign_variable_callback(unlock_gas_defence)),
- "activate_unit", ZERO_OR_MORE, unit_manager.expect_unit_identifier(set_callback_pointer(activated_units)),
+ "activate_unit", ZERO_OR_MORE, unit_type_manager.expect_unit_type_identifier(set_callback_pointer(activated_units)),
"activate_building", ZERO_OR_MORE, building_type_manager.expect_building_type_identifier(
set_callback_pointer(activated_buildings)
),
diff --git a/src/openvic-simulation/research/Invention.hpp b/src/openvic-simulation/research/Invention.hpp
index 2b8100d..43a4e10 100644
--- a/src/openvic-simulation/research/Invention.hpp
+++ b/src/openvic-simulation/research/Invention.hpp
@@ -6,18 +6,18 @@
#include "openvic-simulation/types/OrderedContainers.hpp"
namespace OpenVic {
- struct Unit;
+ struct UnitType;
struct BuildingType;
struct Crime;
- struct UnitManager;
+ struct UnitTypeManager;
struct BuildingTypeManager;
struct CrimeManager;
struct Invention : Modifier {
friend struct InventionManager;
//TODO implement limit and chance
- using unit_set_t = ordered_set<Unit const*>;
+ using unit_set_t = ordered_set<UnitType const*>;
using building_set_t = ordered_set<BuildingType const*>;
using crime_set_t = ordered_set<Crime const*>;
@@ -54,7 +54,7 @@ namespace OpenVic {
);
bool load_inventions_file(
- ModifierManager const& modifier_manager, UnitManager const& unit_manager,
+ ModifierManager const& modifier_manager, UnitTypeManager const& unit_type_manager,
BuildingTypeManager const& building_type_manager, CrimeManager const& crime_manager, ast::NodeCPtr root
); // inventions/*.txt
diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp
index 00b736c..027268e 100644
--- a/src/openvic-simulation/research/Technology.cpp
+++ b/src/openvic-simulation/research/Technology.cpp
@@ -144,10 +144,10 @@ bool TechnologyManager::load_technology_file_schools(
}
bool TechnologyManager::load_technologies_file(
- ModifierManager const& modifier_manager, UnitManager const& unit_manager, BuildingTypeManager const& building_type_manager,
+ ModifierManager const& modifier_manager, UnitTypeManager const& unit_type_manager, BuildingTypeManager const& building_type_manager,
ast::NodeCPtr root
) {
- return expect_dictionary_reserve_length(technologies, [this, &modifier_manager, &unit_manager, &building_type_manager](
+ return expect_dictionary_reserve_length(technologies, [this, &modifier_manager, &unit_type_manager, &building_type_manager](
std::string_view tech_key, ast::NodeCPtr tech_value
) -> bool {
ModifierValue modifiers;
@@ -167,7 +167,7 @@ bool TechnologyManager::load_technologies_file(
"cost", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(cost)),
"unciv_military", ZERO_OR_ONE, expect_bool(assign_variable_callback(unciv_military)),
"unit", ZERO_OR_ONE, expect_uint(assign_variable_callback(unit)),
- "activate_unit", ZERO_OR_MORE, unit_manager.expect_unit_identifier(set_callback_pointer(activated_units)),
+ "activate_unit", ZERO_OR_MORE, unit_type_manager.expect_unit_type_identifier(set_callback_pointer(activated_units)),
"activate_building", ZERO_OR_MORE, building_type_manager.expect_building_type_identifier(
set_callback_pointer(activated_buildings)
),
diff --git a/src/openvic-simulation/research/Technology.hpp b/src/openvic-simulation/research/Technology.hpp
index aa47301..c67ebc0 100644
--- a/src/openvic-simulation/research/Technology.hpp
+++ b/src/openvic-simulation/research/Technology.hpp
@@ -3,7 +3,7 @@
#include <cstdint>
#include "openvic-simulation/economy/BuildingType.hpp"
-#include "openvic-simulation/military/Unit.hpp"
+#include "openvic-simulation/military/UnitType.hpp"
#include "openvic-simulation/misc/Modifier.hpp"
#include "openvic-simulation/scripts/ConditionalWeight.hpp"
#include "openvic-simulation/types/Date.hpp"
@@ -42,7 +42,7 @@ namespace OpenVic {
struct Technology : Modifier {
friend struct TechnologyManager;
- using unit_set_t = ordered_set<Unit const*>;
+ using unit_set_t = ordered_set<UnitType const*>;
using building_set_t = ordered_set<BuildingType const*>;
private:
@@ -100,7 +100,7 @@ namespace OpenVic {
/* Loaded from "technologies/.txt" files named after technology folders. */
bool load_technologies_file(
- ModifierManager const& modifier_manager, UnitManager const& unit_manager,
+ ModifierManager const& modifier_manager, UnitTypeManager const& unit_type_manager,
BuildingTypeManager const& building_type_manager, ast::NodeCPtr root
);