Skip to content

Commit

Permalink
ChangeEquipment: Prevent equipping of items that are not usable by th…
Browse files Browse the repository at this point in the history
…e actor

Fix #2902
  • Loading branch information
Ghabry committed Sep 13, 2023
1 parent e413733 commit f3a7f1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/game_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ int Game_Actor::SetEquipment(int equip_type, int new_item_id) {
}

void Game_Actor::ChangeEquipment(int equip_type, int item_id) {
if (!IsItemUsable(item_id)) {
return;
}

int prev_item = SetEquipment(equip_type, item_id);

if (prev_item != 0) {
Expand Down
4 changes: 0 additions & 4 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1862,10 +1862,6 @@ bool Game_Interpreter::CommandChangeEquipment(lcf::rpg::EventCommand const& com)
continue;
}

if (Main_Data::game_party->GetItemCount(item_id) == 0 && !actor->IsEquipped(item_id)) {
Main_Data::game_party->AddItem(item_id, 1);
}

if (actor->HasTwoWeapons() && slot == lcf::rpg::Item::Type_weapon && item_id != 0) {
lcf::rpg::Item* new_equipment = lcf::ReaderUtil::GetElement(lcf::Data::items, item_id);
lcf::rpg::Item* equipment1 = lcf::ReaderUtil::GetElement(lcf::Data::items, actor->GetWeaponId());
Expand Down

0 comments on commit f3a7f1d

Please sign in to comment.