Skip to content

Commit 0059314

Browse files
authored
Fix Auto Bank not removing coins from monster corpse (#266)
1 parent e6abcc8 commit 0059314

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/creatures/creature.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,16 @@ bool Creature::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreatur
731731
if (mostDamageCreature && mostDamageCreature->getPlayer() && !corpses) {
732732
Player* player = mostDamageCreature->getPlayer();
733733
if (g_configManager().getBoolean(AUTOBANK)) {
734-
int32_t money = 0;
735734
if (!corpse->getContainer()) {
736735
return true;
737736
}
738737

738+
int32_t money = 0;
739739
for (Item* item : corpse->getContainer()->getItems()) {
740-
money += item->getWorth();
741-
g_game.internalRemoveItem(item, money);
740+
if (uint32_t worth = item->getWorth(); worth > 0) {
741+
money += worth;
742+
g_game.internalRemoveItem(item);
743+
}
742744
}
743745

744746
if (money > 0) {

0 commit comments

Comments
 (0)