Fix gold/food with custom charges not working/displaying right

This commit is contained in:
2015-09-24 17:21:54 -04:00
parent 249e0e0027
commit 6646097e04
2 changed files with 10 additions and 6 deletions

View File

@@ -886,6 +886,7 @@ std::string get_item_interesting_string(cItem item) {
if(item.cursed) {
return "Cursed item.";
}
bool got_string = true;
std::ostringstream sout;
switch(item.variety) {
case eItemType::ONE_HANDED:
@@ -924,12 +925,13 @@ std::string get_item_interesting_string(cItem item) {
sout << "Poison: " << item.item_level << '-' << item.item_level * 6 << " damage";
break;
default:
if(item.charges > 0)
sout << "Uses: " << item.charges << '.';
return sout.str();
got_string = false;
break;
}
if(item.charges > 0) {
if(got_string) sout << "; ";
sout << "Uses: " << item.charges;
}
if(item.charges > 0)
sout << "; Uses: " << item.charges;
sout << '.';
return sout.str();
}

View File

@@ -408,8 +408,10 @@ void start_town_mode(short which_town, short entry_dir) {
if(univ.town->preset_items[i].charges > 0) {
eItemType variety = univ.town.items[j].variety;
if(univ.town.items[j].charges > 0 || variety == eItemType::GOLD || variety == eItemType::FOOD)
if(univ.town.items[j].charges > 0)
univ.town.items[j].charges = univ.town->preset_items[i].charges;
else if(variety == eItemType::GOLD || variety == eItemType::FOOD)
univ.town.items[j].item_level = univ.town->preset_items[i].charges;
}
if(town_toast)