aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-10-28 11:39:08 +0200
committer hop311 <hop3114@gmail.com>2023-10-29 20:42:47 +0100
commit164264b047921dbe1567d2af183e1cffb200a8cb (patch)
tree21c3c81f65ac3259db4808ebe9fd32a94ca993af /src/openvic-simulation/misc
parentd8ec90f07342876e9331819bd3cc372050f78248 (diff)
Astyle formatting (with manual cleanup)
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r--src/openvic-simulation/misc/Define.cpp60
1 files changed, 32 insertions, 28 deletions
diff --git a/src/openvic-simulation/misc/Define.cpp b/src/openvic-simulation/misc/Define.cpp
index 509b0a5..3da1f4a 100644
--- a/src/openvic-simulation/misc/Define.cpp
+++ b/src/openvic-simulation/misc/Define.cpp
@@ -52,14 +52,17 @@ const Date& DefineManager::get_end_date() const {
}
bool DefineManager::add_date_define(std::string_view name, Date date) {
- if (name != "start_date" && name != "end_date") return false;
+ if (name != "start_date" && name != "end_date") {
+ return false;
+ }
bool ret = defines.add_item({ name, date.to_string(), Define::Type::None });
- if (name == "start_date")
+ if (name == "start_date") {
start_date.reset(new Date(date));
- else if (name == "end_date")
+ } else if (name == "end_date") {
end_date.reset(new Date(date));
+ }
return ret;
}
@@ -67,7 +70,8 @@ bool DefineManager::add_date_define(std::string_view name, Date date) {
bool DefineManager::load_defines_file(ast::NodeCPtr root) {
bool ret = expect_dictionary_keys(
"defines", ONE_EXACTLY, expect_dictionary([this](std::string_view key, ast::NodeCPtr value) -> bool {
- if (key == "country" || key == "economy" || key == "military" || key == "diplomacy" || key == "pops" || key == "ai" || key == "graphics") {
+ if (key == "country" || key == "economy" || key == "military" || key == "diplomacy"
+ || key == "pops" || key == "ai" || key == "graphics") {
return expect_dictionary([this, &key](std::string_view inner_key, ast::NodeCPtr value) -> bool {
std::string str_val;
@@ -76,30 +80,30 @@ bool DefineManager::load_defines_file(ast::NodeCPtr root) {
Define::Type type;
switch (key[0]) {
using enum Define::Type;
- case 'c': // country
- type = Country;
- break;
- case 'e': // economy
- type = Economy;
- break;
- case 'm': // military
- type = Military;
- break;
- case 'd': // diplomacy
- type = Diplomacy;
- break;
- case 'p': // pops
- type = Pops;
- break;
- case 'a': // ai
- type = Ai;
- break;
- case 'g': // graphics
- type = Graphics;
- break;
- default:
- Logger::error("Unknown define type ", key, " found in defines!");
- return false;
+ case 'c': // country
+ type = Country;
+ break;
+ case 'e': // economy
+ type = Economy;
+ break;
+ case 'm': // military
+ type = Military;
+ break;
+ case 'd': // diplomacy
+ type = Diplomacy;
+ break;
+ case 'p': // pops
+ type = Pops;
+ break;
+ case 'a': // ai
+ type = Ai;
+ break;
+ case 'g': // graphics
+ type = Graphics;
+ break;
+ default:
+ Logger::error("Unknown define type ", key, " found in defines!");
+ return false;
}
ret &= add_define(inner_key, std::move(str_val), type);