From 6b3d2315225468e03bef30e942263fe9b8fc06fa Mon Sep 17 00:00:00 2001 From: hop311 Date: Thu, 12 Oct 2023 23:05:49 +0100 Subject: Further cleanup and rearrangement --- src/openvic-simulation/units/Unit.hpp | 171 ---------------------------------- 1 file changed, 171 deletions(-) delete mode 100644 src/openvic-simulation/units/Unit.hpp (limited to 'src/openvic-simulation/units/Unit.hpp') diff --git a/src/openvic-simulation/units/Unit.hpp b/src/openvic-simulation/units/Unit.hpp deleted file mode 100644 index 65e6259..0000000 --- a/src/openvic-simulation/units/Unit.hpp +++ /dev/null @@ -1,171 +0,0 @@ -#pragma once - -#include -#include -#include "openvic-simulation/economy/Good.hpp" -#include "openvic-simulation/types/IdentifierRegistry.hpp" -#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" -#include "openvic-simulation/dataloader/NodeTools.hpp" -#include "openvic-simulation/economy/Good.hpp" -#include "openvic-simulation/types/Date.hpp" - -#define UNIT_PARAMS Unit::icon_t icon, std::string_view sprite, bool active, std::string_view unit_type, \ - bool floating_flag, uint32_t priority, fixed_point_t max_strength, fixed_point_t default_organisation, \ - fixed_point_t maximum_speed, fixed_point_t weighted_value, Timespan build_time, \ - std::map build_cost, fixed_point_t supply_consumption, \ - std::map supply_cost -#define LAND_PARAMS bool primary_culture, std::string_view sprite_override, std::string_view sprite_mount, \ - std::string_view sprite_mount_attach_node, fixed_point_t reconnaissance, fixed_point_t attack, \ - fixed_point_t defence, fixed_point_t discipline, fixed_point_t support, fixed_point_t maneuver, fixed_point_t siege -#define NAVY_PARAMS Unit::icon_t naval_icon, bool sail, bool transport, bool capital, std::string_view move_sound, \ - std::string_view select_sound, fixed_point_t colonial_points, bool build_overseas, uint32_t min_port_level, \ - int32_t limit_per_port, fixed_point_t supply_consumption_score, fixed_point_t hull, fixed_point_t gun_power, \ - fixed_point_t fire_range, fixed_point_t evasion, fixed_point_t torpedo_attack - -namespace OpenVic { - struct Unit : HasIdentifier { - using icon_t = uint32_t; - - enum struct type_t { - LAND, NAVAL - }; - - private: - const type_t type; - const icon_t icon; - const std::string sprite; - const bool active; - const std::string unit_type; - const bool floating_flag; - - const uint32_t priority; - const fixed_point_t max_strength; - const fixed_point_t default_organisation; - const fixed_point_t maximum_speed; - const fixed_point_t weighted_value; - - const Timespan build_time; - const std::map build_cost; - const fixed_point_t supply_consumption; - const std::map supply_cost; - - protected: - Unit(std::string_view identifier, type_t type, UNIT_PARAMS); - - public: - Unit(Unit&&) = default; - - icon_t get_icon() const; - type_t get_type() const; - std::string const& get_sprite() const; - bool is_active() const; - std::string const& get_unit_type() const; - bool has_floating_flag() const; - - uint32_t get_priority() const; - fixed_point_t get_max_strength() const; - fixed_point_t get_default_organisation() const; - fixed_point_t get_maximum_speed() const; - fixed_point_t get_weighted_value() const; - - Timespan get_build_time() const; - std::map const& get_build_cost() const; - fixed_point_t get_supply_consumption() const; - std::map const& get_supply_cost() const; - }; - - struct LandUnit : Unit { - friend struct UnitManager; - - private: - const bool primary_culture; - const std::string sprite_override, sprite_mount, sprite_mount_attach_node; - const fixed_point_t reconnaissance; - const fixed_point_t attack; - const fixed_point_t defence; - const fixed_point_t discipline; - const fixed_point_t support; - const fixed_point_t maneuver; - const fixed_point_t siege; - - LandUnit(std::string_view identifier, UNIT_PARAMS, LAND_PARAMS); - - public: - LandUnit(LandUnit&&) = default; - - bool get_primary_culture() const; - std::string const& get_sprite_override() const; - std::string const& get_sprite_mount() const; - std::string const& get_sprite_mount_attach_node() const; - - fixed_point_t get_reconnaissance() const; - fixed_point_t get_attack() const; - fixed_point_t get_defence() const; - fixed_point_t get_discipline() const; - fixed_point_t get_support() const; - fixed_point_t get_maneuver() const; - fixed_point_t get_siege() const; - }; - - struct NavalUnit : Unit { - friend struct UnitManager; - - private: - const icon_t naval_icon; - const bool sail; - const bool transport; - const bool capital; - const std::string move_sound; - const std::string select_sound; - const fixed_point_t colonial_points; - const bool build_overseas; - const uint32_t min_port_level; - const int32_t limit_per_port; - const fixed_point_t supply_consumption_score; - - const fixed_point_t hull; - const fixed_point_t gun_power; - const fixed_point_t fire_range; - const fixed_point_t evasion; - const fixed_point_t torpedo_attack; - - NavalUnit(std::string_view identifier, UNIT_PARAMS, NAVY_PARAMS); - - public: - NavalUnit(NavalUnit&&) = default; - - icon_t get_naval_icon() const; - bool can_sail() const; - bool is_transport() const; - bool is_capital() const; - std::string const& get_move_sound() const; - std::string const& get_select_sound() const; - fixed_point_t get_colonial_points() const; - bool can_build_overseas() const; - uint32_t get_min_port_level() const; - int32_t get_limit_per_port() const; - fixed_point_t get_supply_consumption_score() const; - - fixed_point_t get_hull() const; - fixed_point_t get_gun_power() const; - fixed_point_t get_fire_range() const; - fixed_point_t get_evasion() const; - fixed_point_t get_torpedo_attack() const; - }; - - struct UnitManager { - private: - IdentifierRegistry units; - - bool _check_shared_parameters(std::string_view identifier, UNIT_PARAMS); - - public: - UnitManager(); - - bool add_land_unit(std::string_view identifier, UNIT_PARAMS, LAND_PARAMS); - bool add_naval_unit(std::string_view identifier, UNIT_PARAMS, NAVY_PARAMS); - IDENTIFIER_REGISTRY_ACCESSORS(unit) - - bool load_unit_file(GoodManager const& good_manager, ast::NodeCPtr root); - }; -} \ No newline at end of file -- cgit v1.2.3-56-ga3b1