From df1219af270712f8473fd5fe75d4e54dd1785750 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 Nov 2023 15:47:00 -0500 Subject: Improved feature and inventory printing --- src/creature.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') 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(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 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 inventoryText; + std::map inventoryText; // map implementation maintains keys in sorted order double totalWeight = 0; int totalCost = 0; for(auto i : getInventory()) { -- cgit v1.2.3