Skip to content

Commit

Permalink
Fix species description in encyclopedia
Browse files Browse the repository at this point in the history
  • Loading branch information
o01eg committed Jul 1, 2023
1 parent 81ed9d0 commit 276f8d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions parse/EffectPythonParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ namespace {
effect_group_wrapper insert_effects_group_(const py::tuple& args, const py::dict& kw) {
auto scope = py::extract<condition_wrapper>(kw["scope"])();
int priority = 100;
if (kw.has_key("priority")) {
if (kw.has_key("priority"))
priority = py::extract<int>(kw["priority"])();
}

std::vector<std::unique_ptr<Effect::Effect>> effects;
auto effects_args = py::extract<py::list>(kw["effects"]);
Expand All @@ -159,9 +158,8 @@ namespace {
}

std::string stackinggroup;
if (kw.has_key("stackinggroup")) {
if (kw.has_key("stackinggroup"))
stackinggroup = py::extract<std::string>(kw["stackinggroup"])();
}

std::unique_ptr<Condition::Condition> activation;
if (kw.has_key("activation")) {
Expand All @@ -173,18 +171,20 @@ namespace {
}

std::string accountinglabel;
if (kw.has_key("accountinglabel")) {
if (kw.has_key("accountinglabel"))
accountinglabel = py::extract<std::string>(kw["accountinglabel"])();
}
// ToDo: implement other arguments later

std::string description;
if (kw.has_key("description"))
description = py::extract<std::string>(kw["description"])();

return effect_group_wrapper(std::make_shared<Effect::EffectsGroup>(ValueRef::CloneUnique(scope.condition),
std::move(activation),
std::move(effects),
std::move(accountinglabel),
std::move(stackinggroup),
priority,
"",
std::move(description),
""));
}

Expand Down
2 changes: 1 addition & 1 deletion test/parse/TestPythonParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(parse_species) {
BOOST_TEST_MESSAGE("Dump " << species.Name() << ":");
BOOST_TEST_MESSAGE(species.Dump(0));

BOOST_REQUIRE_EQUAL(4486670, species.GetCheckSum());
BOOST_REQUIRE_EQUAL(4493747, species.GetCheckSum());

const Species test_species{"SP_ABADDONI",
"SP_ABADDONI_DESC",
Expand Down
2 changes: 2 additions & 0 deletions universe/Effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ std::string EffectsGroup::Dump(uint8_t ntabs) const {
if (!m_content_name.empty())
retval += " // from " + m_content_name;
retval += "\n";
if (!m_description.empty())
retval += DumpIndent(ntabs+1) + "description = \"" + m_description + "\"\n";
retval += DumpIndent(ntabs+1) + "scope =\n";
retval += m_scope->Dump(ntabs+2);
if (m_activation) {
Expand Down

0 comments on commit 276f8d4

Please sign in to comment.