From: Laszlo T. <ave...@us...> - 2011-07-24 14:13:41
|
gemrb: Infinity Engine emulator The branch master has been updated via 9fb7c41acccedcdcff4d2055203cbd98dbec069e (commit) Summary of changes: gemrb/core/Inventory.cpp | 4 ++-- gemrb/core/Item.cpp | 2 +- gemrb/core/Store.cpp | 6 +++--- gemrb/plugins/GUIScript/GUIScript.cpp | 2 +- gemrb/plugins/ITMImporter/ITMImporter.cpp | 6 ++++++ 5 files changed, 13 insertions(+), 7 deletions(-) from fd3ff3686ea1752f3f7b8b78fb6adb9fc6a55654 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=9fb7c41acccedcdcff4d2055203cbd98dbec069e commit 9fb7c41acccedcdcff4d2055203cbd98dbec069e Author: Avenger <ave...@so...> Date: Sun Jul 24 16:12:08 2011 +0200 hack MaxStackAmount at load time, so it could be used as a simple boolean later diff --git a/gemrb/core/Inventory.cpp b/gemrb/core/Inventory.cpp index e77c95e..b843327 100644 --- a/gemrb/core/Inventory.cpp +++ b/gemrb/core/Inventory.cpp @@ -245,7 +245,7 @@ void Inventory::CalculateWeight() slot->Flags &= ~IE_INV_ITEM_ACQUIRED; } if (slot->Weight > 0) { - Weight += slot->Weight * ((slot->Usages[0] && slot->MaxStackAmount > 1) ? slot->Usages[0] : 1); + Weight += slot->Weight * ((slot->Usages[0] && slot->MaxStackAmount) ? slot->Usages[0] : 1); } } Changed = false; @@ -638,7 +638,7 @@ int Inventory::AddSlotItem(CREItem* item, int slot, int slottype) } CREItem *myslot = Slots[slot]; - if (myslot->MaxStackAmount > 1 && ItemsAreCompatible(myslot, item)) { + if (myslot->MaxStackAmount && ItemsAreCompatible(myslot, item)) { //calculate with the max movable stock int chunk = item->Usages[0]; if (myslot->Usages[0] + chunk > myslot->MaxStackAmount) { diff --git a/gemrb/core/Item.cpp b/gemrb/core/Item.cpp index b576414..8f74a89 100644 --- a/gemrb/core/Item.cpp +++ b/gemrb/core/Item.cpp @@ -176,7 +176,7 @@ int Item::UseCharge(ieWord *Charges, int header, bool expend) const int type = ieh->ChargeDepletion; int ccount = 0; - if ((header>=CHARGE_COUNTERS) || (header<0/*weapon header*/)) { + if ((header>=CHARGE_COUNTERS) || (header<0) || MaxStackAmount) { header = 0; } ccount=Charges[header]; diff --git a/gemrb/core/Store.cpp b/gemrb/core/Store.cpp index a615681..a03202a 100644 --- a/gemrb/core/Store.cpp +++ b/gemrb/core/Store.cpp @@ -203,7 +203,7 @@ STOItem *Store::FindItem(CREItem *item, bool exact) return temp; } // Check if we have a non-stackable item with a different number of charges. - if (item->MaxStackAmount < 2 && memcmp(temp->Usages, item->Usages, sizeof(item->Usages))) { + if (!item->MaxStackAmount && memcmp(temp->Usages, item->Usages, sizeof(item->Usages))) { continue; } } @@ -246,7 +246,7 @@ void Store::AddItem(CREItem *item) if (temp) { if (temp->InfiniteSupply!=-1) { - if (item->MaxStackAmount > 1) { + if (item->MaxStackAmount) { // Stacked, so increase usages. ieDword newAmount = 1; if (item->Usages[0] != temp->Usages[0] && item->Usages[0] > 0) { @@ -271,7 +271,7 @@ void Store::AddItem(CREItem *item) memset( temp, 0, sizeof (STOItem ) ); memcpy( temp, item, sizeof( CREItem ) ); temp->AmountInStock = 1; - if (temp->MaxStackAmount > 1 && temp->Usages[0] > 1) { + if (temp->MaxStackAmount && temp->Usages[0] > 1) { // For now, we do what bg2 does and add new items in stacks of 1. temp->AmountInStock = item->Usages[0]; temp->Usages[0] = 1; diff --git a/gemrb/plugins/GUIScript/GUIScript.cpp b/gemrb/plugins/GUIScript/GUIScript.cpp index 9637e84..a8ff6b7 100644 --- a/gemrb/plugins/GUIScript/GUIScript.cpp +++ b/gemrb/plugins/GUIScript/GUIScript.cpp @@ -6161,7 +6161,7 @@ static PyObject* GemRB_GetStoreItem(PyObject * /*self*/, PyObject* args) //calculate depreciation too //store->DepreciationRate, mount - if (item->MaxStackAmount>1) { + if (item->MaxStackAmount) { price *= si->Usages[0]; } //is this correct? diff --git a/gemrb/plugins/ITMImporter/ITMImporter.cpp b/gemrb/plugins/ITMImporter/ITMImporter.cpp index bdc1fe0..b82cba8 100644 --- a/gemrb/plugins/ITMImporter/ITMImporter.cpp +++ b/gemrb/plugins/ITMImporter/ITMImporter.cpp @@ -149,6 +149,12 @@ Item* ITMImporter::GetItem(Item *s) str->Read( &s->unknown3, 1 ); str->ReadDword( &s->Price ); str->ReadWord( &s->MaxStackAmount ); + + //hack for non stacked items, so MaxStackAmount could be used as a boolean + if (s->MaxStackAmount==1) { + s->MaxStackAmount = 0; + } + str->ReadResRef( s->ItemIcon ); str->ReadWord( &s->LoreToID ); str->ReadResRef( s->GroundIcon ); ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |