diff options
author | Your Name <you@example.com> | 2023-11-29 15:47:00 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2023-11-29 15:47:00 -0500 |
commit | df1219af270712f8473fd5fe75d4e54dd1785750 (patch) | |
tree | 43ebd4c0229a77ceaabf59c654b66b463f423f55 | |
parent | a454169f8efae6511dfe737c38021e40554f87ea (diff) | |
download | dmtool-df1219af270712f8473fd5fe75d4e54dd1785750.tar.gz dmtool-df1219af270712f8473fd5fe75d4e54dd1785750.tar.bz2 dmtool-df1219af270712f8473fd5fe75d4e54dd1785750.zip |
Improved feature and inventory printing
-rw-r--r-- | src/creature.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/creature.cc b/src/creature.cc index 955da4d..d181f76 100644 --- a/src/creature.cc +++ b/src/creature.cc @@ -291,9 +291,9 @@ namespace creature { int baseBonus = 10 + dex; int miscBonus = 0; for(auto a : utils::castPtrs<entry::Item, entry::Armor>(c.getInventory())) { - if(c.getScore(rules::Ability::Str()) < a->getStrRequirement()) { - continue; - } + //if(c.getScore(rules::Ability::Str()) < a->getStrRequirement()) { + // continue; + //} auto armorType = a->getArmorType(); if(armorType == "misc" || armorType == "shield") { miscBonus += a->getACBonus(); @@ -452,12 +452,14 @@ namespace creature { } if(! getFeatures().empty()) { text << std::endl << "Features:" << std::endl; - for(auto f: getFeatures()) { - text << " * " << f->getText(*this) << std::endl; + std::set<std::string> sortedFeatures; // set implementation sorts (but masks repeats...) + for(auto f : getFeatures()) sortedFeatures.insert(f->getText(*this)); + for(auto str : sortedFeatures) { + text << " * " << str << std::endl; } } if(! getInventory().empty()) { - std::map<std::string, int> inventoryText; + std::map<std::string, int> inventoryText; // map implementation maintains keys in sorted order double totalWeight = 0; int totalCost = 0; for(auto i : getInventory()) { |