Permalink
Browse files

make TakePartyItemNum work properly with containers

  • Loading branch information...
1 parent 1ad1d67 commit cdda13db4ee81f5c8ecd9597836b46e8feb619e7 @fizzet fizzet committed Jun 29, 2013
Showing with 3 additions and 7 deletions.
  1. +3 −7 gemrb/core/GameScript/Actions.cpp
@@ -3987,17 +3987,13 @@ void GameScript::TakePartyItemNum(Scriptable* Sender, Action* parameters)
int count = parameters->int0Parameter;
Game *game=core->GetGame();
int i=game->GetPartySize(false);
- while (i--) {
+ while (i-- && count) {
Actor *pc = game->GetPC(i, false);
- int personal_count = pc->inventory.CountItems(parameters->string0Parameter, true);
- if (!personal_count) continue;
- int res=MoveItemCore(pc, Sender, parameters->string0Parameter,IE_INV_ITEM_UNDROPPABLE, IE_INV_ITEM_UNSTEALABLE, count);
+ int res = MoveItemCore(pc, Sender, parameters->string0Parameter, IE_INV_ITEM_UNDROPPABLE, IE_INV_ITEM_UNSTEALABLE, 1);
if (res == MIC_GOTITEM) {
i++;
- // decrease only by the removed amount, since multiple slots may have been involved
- count -= (personal_count - pc->inventory.CountItems(parameters->string0Parameter, true));
+ count--;
}
- if (count < 1) return;
}
}

0 comments on commit cdda13d

Please sign in to comment.