diff --git a/rsrc/dialogs/edit-town-details.xml b/rsrc/dialogs/edit-town-details.xml index 80e62a13..143e5f23 100644 --- a/rsrc/dialogs/edit-town-details.xml +++ b/rsrc/dialogs/edit-town-details.xml @@ -22,6 +22,9 @@ (When this many monsters are killed, the dungeon will be abandoned) + + This town has {{num}} hostile creatures. + Town difficulty (0-10): diff --git a/src/scenario/town.cpp b/src/scenario/town.cpp index 6327094d..330d9f84 100644 --- a/src/scenario/town.cpp +++ b/src/scenario/town.cpp @@ -177,6 +177,15 @@ bool cTown::cWandering::isNull() const { return true; } +size_t cTown::count_hostiles() const { + size_t count = 0; + static std::set hostile_attitudes = { eAttitude::HOSTILE_A, eAttitude::HOSTILE_B }; + for(const cTownperson& creature : creatures){ + count += hostile_attitudes.count(creature.start_attitude); + } + return count; +} + bool cTown::is_cleaned_out() const { if(max_num_monst < 0) return false; return m_killed >= max_num_monst; diff --git a/src/scenario/town.hpp b/src/scenario/town.hpp index 7f5177d4..34c2e8cf 100644 --- a/src/scenario/town.hpp +++ b/src/scenario/town.hpp @@ -84,6 +84,7 @@ public: rectangle in_town_rect; std::vector preset_items; std::vector creatures; + size_t count_hostiles() const; long max_num_monst; std::vector preset_fields; short spec_on_entry,spec_on_entry_if_dead; diff --git a/src/scenedit/scen.townout.cpp b/src/scenedit/scen.townout.cpp index 2f2ffc60..a9dcb876 100644 --- a/src/scenedit/scen.townout.cpp +++ b/src/scenedit/scen.townout.cpp @@ -694,6 +694,7 @@ static void put_town_details_in_dlog(cDialog& me) { me["chop"].setTextToNum(town->town_chop_time); me["key"].setTextToNum(town->town_chop_key); me["population"].setTextToNum(town->max_num_monst); + me["population-hint"].replaceText("{{num}}", std::to_string(town->count_hostiles())); me["difficulty"].setTextToNum(town->difficulty); cLedGroup& lighting = dynamic_cast(me["lighting"]); switch(town->lighting_type) {