diff options
Diffstat (limited to 'src/openvic-simulation/military')
-rw-r--r-- | src/openvic-simulation/military/Deployment.cpp | 6 | ||||
-rw-r--r-- | src/openvic-simulation/military/UnitInstance.cpp | 22 | ||||
-rw-r--r-- | src/openvic-simulation/military/UnitInstance.hpp | 8 |
3 files changed, 21 insertions, 15 deletions
diff --git a/src/openvic-simulation/military/Deployment.cpp b/src/openvic-simulation/military/Deployment.cpp index 4550108..813cd94 100644 --- a/src/openvic-simulation/military/Deployment.cpp +++ b/src/openvic-simulation/military/Deployment.cpp @@ -126,7 +126,7 @@ bool DeploymentManager::load_oob_file( const bool ret = expect_dictionary_keys( "name", ONE_EXACTLY, expect_string(assign_variable_callback(army_name)), - "location", ONE_EXACTLY, game_manager.get_map().expect_province_definition_identifier( + "location", ONE_EXACTLY, game_manager.get_map_definition().expect_province_definition_identifier( assign_variable_callback_pointer(army_location) ), "regiment", ONE_OR_MORE, [&game_manager, &army_regiments](ast::NodeCPtr node) -> bool { @@ -138,7 +138,7 @@ bool DeploymentManager::load_oob_file( "name", ONE_EXACTLY, expect_string(assign_variable_callback(regiment_name)), "type", ONE_EXACTLY, game_manager.get_military_manager().get_unit_type_manager() .expect_regiment_type_identifier(assign_variable_callback_pointer(regiment_type)), - "home", ZERO_OR_ONE, game_manager.get_map() + "home", ZERO_OR_ONE, game_manager.get_map_definition() .expect_province_definition_identifier(assign_variable_callback_pointer(regiment_home)) )(node); @@ -170,7 +170,7 @@ bool DeploymentManager::load_oob_file( const bool ret = expect_dictionary_keys( "name", ONE_EXACTLY, expect_string(assign_variable_callback(navy_name)), - "location", ONE_EXACTLY, game_manager.get_map().expect_province_definition_identifier( + "location", ONE_EXACTLY, game_manager.get_map_definition().expect_province_definition_identifier( assign_variable_callback_pointer(navy_location) ), "ship", ONE_OR_MORE, [&game_manager, &navy_ships](ast::NodeCPtr node) -> bool { diff --git a/src/openvic-simulation/military/UnitInstance.cpp b/src/openvic-simulation/military/UnitInstance.cpp index 1cd0813..ac9c194 100644 --- a/src/openvic-simulation/military/UnitInstance.cpp +++ b/src/openvic-simulation/military/UnitInstance.cpp @@ -3,7 +3,7 @@ #include <vector> #include "openvic-simulation/country/CountryInstance.hpp" -#include "openvic-simulation/map/Map.hpp" +#include "openvic-simulation/map/MapInstance.hpp" #include "openvic-simulation/map/ProvinceInstance.hpp" #include "openvic-simulation/military/Deployment.hpp" @@ -76,7 +76,9 @@ bool UnitInstanceManager::generate_ship(ShipDeployment const& ship_deployment, S return true; } -bool UnitInstanceManager::generate_army(Map& map, CountryInstance& country, ArmyDeployment const& army_deployment) { +bool UnitInstanceManager::generate_army( + MapInstance& map_instance, CountryInstance& country, ArmyDeployment const& army_deployment +) { if (army_deployment.get_regiments().empty()) { Logger::error( "Trying to generate army \"", army_deployment.get_name(), "\" with no regiments for country \"", @@ -117,12 +119,14 @@ bool UnitInstanceManager::generate_army(Map& map, CountryInstance& country, Army armies.push_back({ army_deployment.get_name(), std::move(army_regiments), nullptr, &country }); - armies.back().set_position(map.get_province_instance_from_const(army_deployment.get_location())); + armies.back().set_position(map_instance.get_province_instance_from_const(army_deployment.get_location())); return ret; } -bool UnitInstanceManager::generate_navy(Map& map, CountryInstance& country, NavyDeployment const& navy_deployment) { +bool UnitInstanceManager::generate_navy( + MapInstance& map_instance, CountryInstance& country, NavyDeployment const& navy_deployment +) { if (navy_deployment.get_ships().empty()) { Logger::error( "Trying to generate navy \"", navy_deployment.get_name(), "\" with no ships for country \"", @@ -163,12 +167,14 @@ bool UnitInstanceManager::generate_navy(Map& map, CountryInstance& country, Navy navies.push_back({ navy_deployment.get_name(), std::move(navy_ships), nullptr, &country }); - navies.back().set_position(map.get_province_instance_from_const(navy_deployment.get_location())); + navies.back().set_position(map_instance.get_province_instance_from_const(navy_deployment.get_location())); return ret; } -bool UnitInstanceManager::generate_deployment(Map& map, CountryInstance& country, Deployment const* deployment) { +bool UnitInstanceManager::generate_deployment( + MapInstance& map_instance, CountryInstance& country, Deployment const* deployment +) { if (deployment == nullptr) { Logger::error("Trying to generate null deployment for ", country.get_identifier()); return false; @@ -179,11 +185,11 @@ bool UnitInstanceManager::generate_deployment(Map& map, CountryInstance& country bool ret = true; for (ArmyDeployment const& army_deployment : deployment->get_armies()) { - ret &= generate_army(map, country, army_deployment); + ret &= generate_army(map_instance, country, army_deployment); } for (NavyDeployment const& navy_deployment : deployment->get_navies()) { - ret &= generate_navy(map, country, navy_deployment); + ret &= generate_navy(map_instance, country, navy_deployment); } return ret; diff --git a/src/openvic-simulation/military/UnitInstance.hpp b/src/openvic-simulation/military/UnitInstance.hpp index a3a53d0..a1437ef 100644 --- a/src/openvic-simulation/military/UnitInstance.hpp +++ b/src/openvic-simulation/military/UnitInstance.hpp @@ -186,7 +186,7 @@ namespace OpenVic { struct RegimentDeployment; struct ShipDeployment; - struct Map; + struct MapInstance; struct ArmyDeployment; struct NavyDeployment; struct Deployment; @@ -201,10 +201,10 @@ namespace OpenVic { bool generate_regiment(RegimentDeployment const& regiment_deployment, RegimentInstance*& regiment); bool generate_ship(ShipDeployment const& ship_deployment, ShipInstance*& ship); - bool generate_army(Map& map, CountryInstance& country, ArmyDeployment const& army_deployment); - bool generate_navy(Map& map, CountryInstance& country, NavyDeployment const& navy_deployment); + bool generate_army(MapInstance& map_instance, CountryInstance& country, ArmyDeployment const& army_deployment); + bool generate_navy(MapInstance& map_instance, CountryInstance& country, NavyDeployment const& navy_deployment); public: - bool generate_deployment(Map& map, CountryInstance& country, Deployment const* deployment); + bool generate_deployment(MapInstance& map_instance, CountryInstance& country, Deployment const* deployment); }; } |