Fix updating armor class

This commit is contained in:
Alexander Batalov 2022-08-06 20:05:33 +03:00
parent 33bda1612c
commit d7966cdab2
1 changed files with 9 additions and 5 deletions

View File

@ -1746,7 +1746,7 @@ static void opWieldItem(Program* program)
int hand = HAND_RIGHT; int hand = HAND_RIGHT;
bool v1 = false; bool shouldAdjustArmorClass = false;
Object* oldArmor = NULL; Object* oldArmor = NULL;
Object* newArmor = NULL; Object* newArmor = NULL;
if (critter == gDude) { if (critter == gDude) {
@ -1756,10 +1756,11 @@ static void opWieldItem(Program* program)
if (itemGetType(item) == ITEM_TYPE_ARMOR) { if (itemGetType(item) == ITEM_TYPE_ARMOR) {
oldArmor = critterGetArmor(gDude); oldArmor = critterGetArmor(gDude);
}
v1 = true; // SFALL
newArmor = item; shouldAdjustArmorClass = true;
newArmor = item;
}
} }
if (_inven_wield(critter, item, hand) == -1) { if (_inven_wield(critter, item, hand) == -1) {
@ -1769,8 +1770,11 @@ static void opWieldItem(Program* program)
} }
if (critter == gDude) { if (critter == gDude) {
if (v1) { if (shouldAdjustArmorClass) {
_adjust_ac(critter, oldArmor, newArmor); _adjust_ac(critter, oldArmor, newArmor);
// SFALL
interfaceRenderArmorClass(false);
} }
bool animated = !gameUiIsDisabled(); bool animated = !gameUiIsDisabled();