55#include < fmt/base.h>
66
77#include " openvic-simulation/diplomacy/CountryRelation.hpp"
8+ #include " openvic-simulation/economy/BuildingLevel.hpp"
9+ #include " openvic-simulation/economy/BuildingRestrictionCategory.hpp"
810#include " openvic-simulation/military/CombatWidth.hpp"
911#include " openvic-simulation/military/UnitBranchedGetterMacro.hpp"
1012#include " openvic-simulation/modifier/ModifierSum.hpp"
@@ -155,7 +157,7 @@ namespace OpenVic {
155157 memory::vector<std::pair<CountryInstance const *, fixed_point_t >> SPAN_PROPERTY (industrial_power_from_investments);
156158 size_t PROPERTY (industrial_rank, 0 );
157159 fixed_point_map_t <CountryInstance const *> PROPERTY (foreign_investments);
158- OV_IFLATMAP_PROPERTY (BuildingType, technology_unlock_level_t , building_type_unlock_levels);
160+ OV_IFLATMAP_PROPERTY (BuildingType, building_level_t , building_type_unlock_levels);
159161 // TODO - total amount of each good produced
160162
161163 /* Budget */
@@ -410,57 +412,58 @@ namespace OpenVic {
410412 OV_UNIT_BRANCHED_GETTER (get_leaders, generals, admirals);
411413 OV_UNIT_BRANCHED_GETTER_CONST (get_leaders, generals, admirals);
412414
413- inline size_t get_general_count () const {
415+ [[nodiscard]] inline size_t get_general_count () const {
414416 return generals.size ();
415417 }
416- inline bool has_generals () const {
418+ [[nodiscard]] inline bool has_generals () const {
417419 return !generals.empty ();
418420 }
419- inline size_t get_admiral_count () const {
421+ [[nodiscard]] inline size_t get_admiral_count () const {
420422 return admirals.size ();
421423 }
422- inline bool has_admirals () const {
424+ [[nodiscard]] inline bool has_admirals () const {
423425 return !admirals.empty ();
424426 }
425- inline size_t get_leader_count () const {
427+ [[nodiscard]] inline size_t get_leader_count () const {
426428 return get_general_count () + get_admiral_count ();
427429 }
428- inline bool has_leaders () const {
430+ [[nodiscard]] inline bool has_leaders () const {
429431 return has_generals () || has_admirals ();
430432 }
431- inline size_t get_army_count () const {
433+ [[nodiscard]] inline size_t get_army_count () const {
432434 return armies.size ();
433435 }
434- inline bool has_armies () const {
436+ [[nodiscard]] inline bool has_armies () const {
435437 return !armies.empty ();
436438 }
437- inline size_t get_navy_count () const {
439+ [[nodiscard]] inline size_t get_navy_count () const {
438440 return navies.size ();
439441 }
440- inline bool has_navies () const {
442+ [[nodiscard]] inline bool has_navies () const {
441443 return !navies.empty ();
442444 }
443445
444- std::string_view get_identifier () const ;
446+ [[nodiscard]] std::string_view get_identifier () const ;
445447
446- bool exists () const ;
447- bool is_rebel_country () const ;
448- bool is_civilised () const ;
449- bool can_colonise () const ;
450- bool is_great_power () const ;
451- bool is_secondary_power () const ;
452- bool is_at_war () const ;
453- bool is_neighbour (CountryInstance const & country) const ;
448+ [[nodiscard]] bool exists () const ;
449+ [[nodiscard]] bool is_rebel_country () const ;
450+ [[nodiscard]] bool is_civilised () const ;
451+ [[nodiscard]] bool can_colonise () const ;
452+ [[nodiscard]] bool is_great_power () const ;
453+ [[nodiscard]] bool is_secondary_power () const ;
454+ [[nodiscard]] bool is_at_war () const ;
455+ [[nodiscard]] bool is_neighbour (CountryInstance const & country) const ;
456+ [[nodiscard]] bool may_build_in (const BuildingRestrictionCategory restriction_category, ProvinceInstance const & location) const ;
454457
455458 // Double-sided diplomacy functions
456459
457460 CountryRelationManager::relation_value_type get_relations_with (CountryInstance const & country) const ;
458461 void set_relations_with (CountryInstance& country, CountryRelationManager::relation_value_type relations);
459462
460- bool has_alliance_with (CountryInstance const & country) const ;
463+ [[nodiscard]] bool has_alliance_with (CountryInstance const & country) const ;
461464 void set_alliance_with (CountryInstance& country, bool alliance = true );
462465
463- bool is_at_war_with (CountryInstance const & country) const ;
466+ [[nodiscard]] bool is_at_war_with (CountryInstance const & country) const ;
464467 // Low-level setter function, should not be used to declare or join wars
465468 // Should generally be the basis for higher-level war functions
466469 void set_at_war_with (CountryInstance& country, bool at_war = true );
@@ -469,16 +472,16 @@ namespace OpenVic {
469472
470473 // Only detects military access diplomacy, do not use to validate troop movement
471474 // Prefer can_units_enter
472- bool has_military_access_to (CountryInstance const & country) const ;
475+ [[nodiscard]] bool has_military_access_to (CountryInstance const & country) const ;
473476 void set_military_access_to (CountryInstance& country, bool access = true );
474477
475- bool is_sending_war_subsidy_to (CountryInstance const & country) const ;
478+ [[nodiscard]] bool is_sending_war_subsidy_to (CountryInstance const & country) const ;
476479 void set_sending_war_subsidy_to (CountryInstance& country, bool sending = true );
477480
478- bool is_commanding_units (CountryInstance const & country) const ;
481+ [[nodiscard]] bool is_commanding_units (CountryInstance const & country) const ;
479482 void set_commanding_units (CountryInstance& country, bool commanding = true );
480483
481- bool has_vision_of (CountryInstance const & country) const ;
484+ [[nodiscard]] bool has_vision_of (CountryInstance const & country) const ;
482485 void set_has_vision_of (CountryInstance& country, bool vision = true );
483486
484487 CountryRelationManager::OpinionType get_opinion_of (CountryInstance const & country) const ;
@@ -498,8 +501,8 @@ namespace OpenVic {
498501 std::optional<Date> get_embass_banned_from_date (CountryInstance const & country) const ;
499502 void set_embassy_banned_from (CountryInstance& country, Date until);
500503
501- bool can_army_units_enter (CountryInstance const & country) const ;
502- bool can_navy_units_enter (CountryInstance const & country) const ;
504+ [[nodiscard]] bool can_army_units_enter (CountryInstance const & country) const ;
505+ [[nodiscard]] bool can_navy_units_enter (CountryInstance const & country) const ;
503506
504507 // These functions take "std::string const&" rather than "std::string_view" as they're only used with script arguments
505508 // which are always stored as "std::string"s and it significantly simplifies mutable value access.
@@ -545,36 +548,36 @@ namespace OpenVic {
545548 bool add_leader (LeaderInstance& leader);
546549 bool remove_leader (LeaderInstance const & leader);
547550
548- bool has_leader_with_name (std::string_view name) const ;
551+ [[nodiscard]] bool has_leader_with_name (std::string_view name) const ;
549552
550553 template <unit_branch_t Branch>
551554 bool modify_unit_type_unlock (UnitTypeBranched<Branch> const & unit_type, technology_unlock_level_t unlock_level_change);
552555
553556 bool modify_unit_type_unlock (UnitType const & unit_type, technology_unlock_level_t unlock_level_change);
554557 bool unlock_unit_type (UnitType const & unit_type);
555- bool is_unit_type_unlocked (UnitType const & unit_type) const ;
558+ [[nodiscard]] bool is_unit_type_unlocked (UnitType const & unit_type) const ;
556559
557560 bool modify_building_type_unlock (
558561 BuildingType const & building_type, technology_unlock_level_t unlock_level_change
559562 );
560563 bool unlock_building_type (BuildingType const & building_type);
561- bool is_building_type_unlocked (BuildingType const & building_type) const ;
564+ [[nodiscard]] bool is_building_type_unlocked (BuildingType const & building_type) const ;
562565
563566 bool modify_crime_unlock (Crime const & crime, technology_unlock_level_t unlock_level_change);
564567 bool unlock_crime (Crime const & crime);
565- bool is_crime_unlocked (Crime const & crime) const ;
568+ [[nodiscard]] bool is_crime_unlocked (Crime const & crime) const ;
566569
567570 bool modify_gas_attack_unlock (technology_unlock_level_t unlock_level_change);
568571 bool unlock_gas_attack ();
569- bool is_gas_attack_unlocked () const ;
572+ [[nodiscard]] bool is_gas_attack_unlocked () const ;
570573
571574 bool modify_gas_defence_unlock (technology_unlock_level_t unlock_level_change);
572575 bool unlock_gas_defence ();
573- bool is_gas_defence_unlocked () const ;
576+ [[nodiscard]] bool is_gas_defence_unlocked () const ;
574577
575578 bool modify_unit_variant_unlock (unit_variant_t unit_variant, technology_unlock_level_t unlock_level_change);
576579 bool unlock_unit_variant (unit_variant_t unit_variant);
577- unit_variant_t get_max_unlocked_unit_variant () const ;
580+ [[nodiscard]] unit_variant_t get_max_unlocked_unit_variant () const ;
578581
579582 bool modify_technology_unlock (
580583 Technology const & technology, technology_unlock_level_t unlock_level_change
@@ -583,7 +586,7 @@ namespace OpenVic {
583586 Technology const & technology, technology_unlock_level_t unlock_level
584587 );
585588 bool unlock_technology (Technology const & technology);
586- bool is_technology_unlocked (Technology const & technology) const ;
589+ [[nodiscard]] bool is_technology_unlocked (Technology const & technology) const ;
587590
588591 bool modify_invention_unlock (
589592 Invention const & invention, technology_unlock_level_t unlock_level_change
@@ -592,15 +595,15 @@ namespace OpenVic {
592595 Invention const & invention, technology_unlock_level_t unlock_level
593596 );
594597 bool unlock_invention (Invention const & invention);
595- bool is_invention_unlocked (Invention const & invention) const ;
598+ [[nodiscard]] bool is_invention_unlocked (Invention const & invention) const ;
596599
597- bool is_primary_culture (Culture const & culture) const ;
600+ [[nodiscard]] bool is_primary_culture (Culture const & culture) const ;
598601 // This only checks the accepted cultures list, ignoring the primary culture.
599- bool is_accepted_culture (Culture const & culture) const ;
600- bool is_primary_or_accepted_culture (Culture const & culture) const ;
602+ [[nodiscard]] bool is_accepted_culture (Culture const & culture) const ;
603+ [[nodiscard]] bool is_primary_or_accepted_culture (Culture const & culture) const ;
601604
602- fixed_point_t calculate_research_cost (Technology const & technology) const ;
603- bool can_research_tech (Technology const & technology, const Date today) const ;
605+ [[nodiscard]] fixed_point_t calculate_research_cost (Technology const & technology) const ;
606+ [[nodiscard]] bool can_research_tech (Technology const & technology, const Date today) const ;
604607 void start_research (Technology const & technology, const Date today);
605608
606609 // Sets the investment of each country in the map (rather than adding to them), leaving the rest unchanged.
0 commit comments