diff options
-rw-r--r-- | src/openvic-simulation/units/Unit.cpp | 12 | ||||
-rw-r--r-- | src/openvic-simulation/units/Unit.hpp | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/src/openvic-simulation/units/Unit.cpp b/src/openvic-simulation/units/Unit.cpp index 55ff08d..63053c1 100644 --- a/src/openvic-simulation/units/Unit.cpp +++ b/src/openvic-simulation/units/Unit.cpp @@ -1,5 +1,4 @@ #include "Unit.hpp" -#include <string_view> #define UNIT_ARGS icon, sprite, active, type, floating_flag, priority, max_strength, \ default_organisation, maximum_speed, weighted_value, build_time, build_cost, supply_consumption, \ @@ -177,13 +176,18 @@ bool UnitManager::_check_shared_parameters(const std::string_view identifier, UN return false; } - //TODO check that icon and sprite exist + if (sprite.empty()) { + Logger::error("Invalid sprite identifier - empty!"); + return false; + } - if (!allowed_unit_types.contains(type)) { - Logger::error("Invalid unit type \"", type, "\" specified!"); + if (type.empty()) { + Logger::error("Invalid unit type - empty!"); return false; } + //TODO check that icon and sprite exist + return true; } diff --git a/src/openvic-simulation/units/Unit.hpp b/src/openvic-simulation/units/Unit.hpp index 9653526..ccda35e 100644 --- a/src/openvic-simulation/units/Unit.hpp +++ b/src/openvic-simulation/units/Unit.hpp @@ -1,10 +1,8 @@ #pragma once #include <cstdint> -#include <set> #include <string> #include <string_view> -#include <unordered_set> #include "openvic-simulation/economy/Good.hpp" #include "openvic-simulation/types/IdentifierRegistry.hpp" #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" @@ -150,16 +148,6 @@ namespace OpenVic { bool _check_shared_parameters(const std::string_view identifier, UNIT_PARAMS); public: - const std::unordered_set<std::string_view> allowed_unit_types { //TODO is this useful? - "infantry", //guard, infantry, irregular - "cavalry", //cavalry, cuirassier, dragoon, hussar, plane - "support", //artillery - "special", //engineer, tank - "transport", //clipper transport, steam transport - "light_ship", //commerce raider, cruiser, frigate - "big_ship" //battleship, dreadnought, ironclad, manowar, monitor - }; - UnitManager(GoodManager& good_manager); bool add_land_unit(const std::string_view identifier, UNIT_PARAMS, LAND_PARAMS); |