Skip to content

Commit

Permalink
Fix some minor errors (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
Idhrendur authored Oct 17, 2022
1 parent a8b58ae commit 59527d3
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 8 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default = {
small_plane_airframe = {
pool = {
icons = {

}
models= {

}
}
}
}
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions src/HOI4World/Characters/AdvisorData.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AdvisorData
std::string idea_token,
std::optional<std::string> ledger,
std::optional<std::string> available,
std::string allowed,
std::optional<std::string> allowed,
std::optional<std::string> visible,
std::optional<std::string> research_bonus,
std::vector<std::string> traits,
Expand Down Expand Up @@ -54,7 +54,7 @@ class AdvisorData
std::string idea_token_;
std::optional<std::string> ledger_;
std::optional<std::string> available_;
std::string allowed_;
std::optional<std::string> allowed_;
std::optional<std::string> visible_;
std::optional<std::string> research_bonus_;
std::vector<std::string> traits_;
Expand Down
2 changes: 1 addition & 1 deletion src/HOI4World/Characters/AdvisorDataFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ HoI4::AdvisorData HoI4::AdvisorDataFactory::importAdvisorData(std::istream& inpu
idea_token_.clear();
ledger_.reset();
available_.reset();
allowed_.clear();
allowed_.reset();
visible_.reset();
research_bonus_.reset();
traits_.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/HOI4World/Characters/AdvisorDataFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AdvisorDataFactory: commonItems::parser
std::string idea_token_;
std::optional<std::string> ledger_;
std::optional<std::string> available_;
std::string allowed_;
std::optional<std::string> allowed_;
std::optional<std::string> visible_;
std::optional<std::string> research_bonus_;
std::vector<std::string> traits_;
Expand Down
8 changes: 5 additions & 3 deletions src/HOI4World/Characters/AdvisorDataTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TEST(HoI4World_Characters_AdvisorData, ItemsAreAsSet)
"",
std::nullopt,
std::nullopt,
"",
std::nullopt,
std::nullopt,
std::nullopt,
{},
Expand All @@ -24,7 +24,7 @@ TEST(HoI4World_Characters_AdvisorData, ItemsAreAsSet)
EXPECT_TRUE(advisor_data.getIdeaToken().empty());
EXPECT_FALSE(advisor_data.getLedger().has_value());
EXPECT_FALSE(advisor_data.getAvailable().has_value());
EXPECT_TRUE(advisor_data.getAllowed().empty());
EXPECT_FALSE(advisor_data.getAllowed().has_value());
EXPECT_FALSE(advisor_data.getVisible().has_value());
EXPECT_FALSE(advisor_data.getResearchBonus().has_value());
EXPECT_TRUE(advisor_data.getTraits().empty());
Expand Down Expand Up @@ -102,6 +102,7 @@ TEST(HoI4World_Characters_AdvisorData, TraitsCanBeSet)
"\t\t\t\t\thas_idea = USA_henry_morgenthau\n"
"\t\t\t\t}\n"
"\t\t\t}");
ASSERT_TRUE(advisor_data.getAllowed().has_value());
EXPECT_EQ(advisor_data.getAllowed(),
"{\n"
"\t\t\t\toriginal_tag = USA\n"
Expand Down Expand Up @@ -159,7 +160,7 @@ TEST(HoI4World_Characters_AdvisorData, ImportedItemsAreDefaulted)
EXPECT_TRUE(advisor_data.getIdeaToken().empty());
EXPECT_FALSE(advisor_data.getLedger().has_value());
EXPECT_FALSE(advisor_data.getAvailable().has_value());
EXPECT_TRUE(advisor_data.getAllowed().empty());
EXPECT_FALSE(advisor_data.getAllowed().has_value());
EXPECT_FALSE(advisor_data.getVisible().has_value());
EXPECT_FALSE(advisor_data.getResearchBonus().has_value());
EXPECT_TRUE(advisor_data.getTraits().empty());
Expand Down Expand Up @@ -245,6 +246,7 @@ TEST(HoI4World_Characters_AdvisorData, ImportedItemsCanBeSet)
"\t\t\t\t\thas_idea = USA_henry_morgenthau\n"
"\t\t\t\t}\n"
"\t\t\t}");
ASSERT_TRUE(advisor_data.getAllowed().has_value());
EXPECT_EQ(advisor_data.getAllowed(),
"{\n"
"\t\t\t\toriginal_tag = USA\n"
Expand Down
1 change: 1 addition & 0 deletions src/HOI4World/Characters/CharacterFactoryTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ TEST(HoI4World_Characters_CharacterFactory, ItemsAreSetWhenImportingCharacter)
ASSERT_TRUE(character.getAdvisorData().has_value());
EXPECT_EQ(character.getAdvisorData()->getSlot(), "political_advisor");
EXPECT_EQ(character.getAdvisorData()->getIdeaToken(), "thomas_kinkaid");
ASSERT_TRUE(character.getAdvisorData()->getAllowed().has_value());
EXPECT_EQ(character.getAdvisorData()->getAllowed(),
"{\n"
"\t\t\t\toriginal_tag = USA\n"
Expand Down
5 changes: 4 additions & 1 deletion src/OutHoi4/Characters/OutAdvisorData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ std::ostream& HoI4::operator<<(std::ostream& out, const AdvisorData& advisor_dat
{
out << "\t\t\tavailable = " << *available << "\n";
}
out << "\t\t\tallowed = " << advisor_data.getAllowed() << "\n";
if (const auto& allowed = advisor_data.getAllowed(); allowed.has_value())
{
out << "\t\t\tallowed = " << *allowed << "\n";
}
if (const auto& visible = advisor_data.getVisible(); visible.has_value())
{
out << "\t\t\tvisible = " << *visible << "\n";
Expand Down

0 comments on commit 59527d3

Please sign in to comment.