Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 0 additions & 217 deletions .astylesrc

This file was deleted.

15 changes: 13 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ InsertNewlineAtEOF: true
InsertBraces: true
MaxEmptyLinesToKeep: 2
RequiresClausePosition: OwnLine
AttributeMacros:
- OV_ALWAYS_INLINE
- OV_SPEED_INLINE
- OV_NO_UNIQUE_ADDRESS
IfMacros:
- CHECK_IF
- CHECK_FALSE_IF
IncludeCategories:
- Regex: <[[:alnum:]_]+>
Priority: 1
Expand All @@ -90,7 +97,11 @@ IncludeCategories:
Priority: 8
- Regex: ^<spdlog/
Priority: 9
- Regex: ^"openvic-simulation/
- Regex: ^<function2/
Priority: 10
- Regex: .*
- Regex: ^<type_safe/
Priority: 11
- Regex: ^"openvic-simulation/
Priority: 12
- Regex: .*
Priority: 13
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ default_language_version:

repos:
# Waiting on Hop311 to approve clang-format
# - repo: https://github.com/pre-commit/mirrors-clang-format
# rev: v19.1.3
# hooks:
# - id: clang-format
# files: \.(c|h|cpp|hpp|inc)$
# types_or: [text]
# # exclude: |
# # (?x)^(
# # )
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.1
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|inc)$
types_or: [text]
# exclude: |
# (?x)^(
# )

- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
Expand Down Expand Up @@ -49,4 +49,4 @@ repos:
# exclude: |
# (?x)^(
# )
additional_dependencies: [tomli]
additional_dependencies: [tomli]
6 changes: 0 additions & 6 deletions astyle.sh

This file was deleted.

6 changes: 0 additions & 6 deletions clang-format.sh

This file was deleted.

13 changes: 6 additions & 7 deletions src/headless/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ static bool run_headless(fs::path const& root, memory::vector<memory::string>& m

SPDLOG_INFO("===== Setting up instance... =====");
ret &= game_manager.setup_instance(
game_manager.get_definition_manager()
.get_history_manager()
.get_bookmark_manager()
.get_front_bookmark()
game_manager.get_definition_manager().get_history_manager().get_bookmark_manager().get_front_bookmark()
);

print_memory_usage("Instance Setup");
Expand All @@ -267,17 +264,19 @@ static bool run_headless(fs::path const& root, memory::vector<memory::string>& m
"\n\t{} - Total #{} ({}), Prestige #{} ({}), Industry #{} ({}), Military #{} ({})", //
country, //
country.get_total_rank(), country.total_score.get_untracked().to_string(1), //
country.get_prestige_rank(), country.get_prestige_untracked().to_string(1),
country.get_prestige_rank(), country.get_prestige_untracked().to_string(1), //
country.get_industrial_rank(), country.get_industrial_power_untracked().to_string(1),
country.get_military_rank(), country.military_power.get_untracked().to_string(1)
);
}
SPDLOG_INFO("{}:{}", title, countries_str);
};

CountryInstanceManager const& country_instance_manager = game_manager.get_instance_manager()->get_country_instance_manager();
CountryInstanceManager const& country_instance_manager =
game_manager.get_instance_manager()->get_country_instance_manager();

OpenVic::forwardable_span<const std::reference_wrapper<CountryInstance>> great_powers = country_instance_manager.get_great_powers();
OpenVic::forwardable_span<const std::reference_wrapper<CountryInstance>> great_powers =
country_instance_manager.get_great_powers();
print_ranking_list("Great Powers", great_powers);
print_ranking_list("Secondary Powers", country_instance_manager.get_secondary_powers());
print_ranking_list("All countries", country_instance_manager.get_total_ranking());
Expand Down
1 change: 0 additions & 1 deletion src/openvic-simulation/DefinitionManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "openvic-simulation/population/PopManager.hpp"
#include "openvic-simulation/research/ResearchManager.hpp"
#include "openvic-simulation/scripts/ScriptManager.hpp"
#include "openvic-simulation/interface/UI.hpp"

namespace OpenVic {
struct DefinitionManager {
Expand Down
24 changes: 9 additions & 15 deletions src/openvic-simulation/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ GameManager::elapsed_time_getter_func_t GameManager::get_elapsed_msec_time_callb

GameManager::GameManager(
InstanceManager::gamestate_updated_func_t new_gamestate_updated_callback,
elapsed_time_getter_func_t new_get_elapsed_usec_callback,
elapsed_time_getter_func_t new_get_elapsed_msec_callback
) : gamestate_updated_callback {
new_gamestate_updated_callback ? std::move(new_gamestate_updated_callback) : []() {}
}, definitions_loaded { false }, mod_descriptors_loaded { false } {
elapsed_time_getter_func_t new_get_elapsed_usec_callback, elapsed_time_getter_func_t new_get_elapsed_msec_callback
)
: gamestate_updated_callback { new_gamestate_updated_callback ? std::move(new_gamestate_updated_callback) : []() {} },
definitions_loaded { false }, mod_descriptors_loaded { false } {
if (new_get_elapsed_usec_callback) {
get_elapsed_usec_time_callback = { std::move(new_get_elapsed_usec_callback) };
}
Expand Down Expand Up @@ -83,11 +82,10 @@ bool GameManager::load_mods(memory::vector<memory::string> const& mods_to_find)
* (Historical Project Mod 0.4.6 or HPM both valid, for example), and load them plus their dependencies.
*/
for (std::string_view requested_mod : mods_to_find) {
memory::vector<Mod>::const_iterator it = ranges::find_if(mod_manager.get_mods(),
[&requested_mod](Mod const& mod) -> bool {
memory::vector<Mod>::const_iterator it =
ranges::find_if(mod_manager.get_mods(), [&requested_mod](Mod const& mod) -> bool {
return mod.get_identifier() == requested_mod || mod.get_user_dir() == requested_mod;
}
);
});

if (it == mod_manager.get_mods().end()) {
spdlog::warn_s("Requested mod \"{}\" does not exist!", requested_mod);
Expand All @@ -97,7 +95,7 @@ bool GameManager::load_mods(memory::vector<memory::string> const& mods_to_find)

Mod const& mod = *it;
vector_ordered_set<std::reference_wrapper<const Mod>> dependencies = mod.generate_dependency_list(&ret);
if(!ret) {
if (!ret) {
continue;
}

Expand Down Expand Up @@ -177,11 +175,7 @@ bool GameManager::setup_instance(Bookmark const& bookmark) {

SPDLOG_INFO("Initialising new game instance.");

instance_manager.emplace(
game_rules_manager,
definition_manager,
gamestate_updated_callback
);
instance_manager.emplace(game_rules_manager, definition_manager, gamestate_updated_callback);

SPDLOG_INFO("Setting up new game instance.");

Expand Down
Loading
Loading