fixed issue with player not being able to pick up multiple piles of gold on the same tile

This commit is contained in:
2024-07-18 18:59:30 -04:00
parent 7cc757f003
commit 145e094684

View File

@ -182,13 +182,17 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
} else if (cmd >= move_north && cmd <= move_southwest) {
auto res = move(lvl, pos + MOVE[cmd - move_north]);
gold g = get_gold_at(pos, lvl->get_glist());
gold_cnt += g.get_amount();
gold g{{0, 0}, 0};
int gold_tmp = 0;
if (g.get_amount())
res.msg += "PC picked up " + std::to_string(g.get_amount()) +
while ((g = get_gold_at(pos, lvl->get_glist())).get_amount() != 0)
gold_tmp += g.get_amount();
if (gold_tmp)
res.msg += "PC picked up " + std::to_string(gold_tmp) +
" pieces of gold. ";
if (enabled_features & FEATURE_INVENTORY) {
size_t idx = get_potion_at(pos, lvl->get_plist());