From: Laszlo T. <ave...@us...> - 2007-01-28 15:56:19
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4579/plugins/Core Modified Files: Inventory.cpp Inventory.h Store.cpp Store.h Log Message: fixed InfiniteSupply flag causing empty stores improved store scripts for bg Index: Inventory.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Inventory.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** Inventory.cpp 31 Dec 2006 13:48:22 -0000 1.105 --- Inventory.cpp 28 Jan 2007 15:56:17 -0000 1.106 *************** *** 556,560 **** // just set up STOItem) for (int i = 0; i < item->PurchasedAmount; i++) { ! if (item->InfiniteSupply==(ieDword) -1) { if (!item->AmountInStock) { break; --- 556,560 ---- // just set up STOItem) for (int i = 0; i < item->PurchasedAmount; i++) { ! if (item->InfiniteSupply==-1) { if (!item->AmountInStock) { break; Index: Store.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Store.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Store.h 5 Jul 2006 08:42:19 -0000 1.19 --- Store.h 28 Jan 2007 15:56:17 -0000 1.20 *************** *** 56,70 **** STA_CURE=3, STA_DONATE=4, STA_DRINK=5, STA_ROOMRENT=6, STA_OPTIONAL=0x80} StoreActionType; ! #define IE_STORE_BUY 1 ! #define IE_STORE_SELL 2 ! #define IE_STORE_ID 4 ! #define IE_STORE_STEAL 8 ! #define IE_STORE_DONATE 16 //gemrb extension ! #define IE_STORE_CURE 32 ! #define IE_STORE_DRINK 64 ! #define IE_STORE_SELECT 0x40 //valid when these flags used as store action ! #define IE_STORE_RENT 128 //gemrb extension ! #define IE_STORE_QUALITY 0x600 //2 bits ! #define IE_STORE_FENCE 0x2000 // --- 56,71 ---- STA_CURE=3, STA_DONATE=4, STA_DRINK=5, STA_ROOMRENT=6, STA_OPTIONAL=0x80} StoreActionType; ! #define IE_STORE_BUY 1 ! #define IE_STORE_SELL 2 ! #define IE_STORE_ID 4 ! #define IE_STORE_STEAL 8 ! #define IE_STORE_DONATE 16 //gemrb extension ! #define IE_STORE_CURE 32 ! #define IE_STORE_DRINK 64 ! #define IE_STORE_SELECT 0x40 //valid when these flags used as store action ! #define IE_STORE_RENT 128 //gemrb extension ! #define IE_STORE_QUALITY 0x600 //2 bits ! #define IE_STORE_FENCE 0x2000 // ! #define IE_STORE_RECHARGE 0x4000 //gemrb extension, if set, store won't recharge *************** *** 83,87 **** int StackAmount; ieDword AmountInStock; ! ieDword InfiniteSupply; // V1.1 //ieDword TriggerRef; use infinitesupply --- 84,88 ---- int StackAmount; ieDword AmountInStock; ! ieDwordSigned InfiniteSupply; // V1.1 //ieDword TriggerRef; use infinitesupply Index: Inventory.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Inventory.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Inventory.h 31 Dec 2006 13:48:22 -0000 1.60 --- Inventory.h 28 Jan 2007 15:56:17 -0000 1.61 *************** *** 100,104 **** IE_INV_ITEM_TWOHANDED = 0x200, IE_INV_ITEM_MOVABLE = 0x400, //same as undroppable ! IE_INV_ITEM_UNKNOWN800 = 0x800, //displayable in shop??? IE_INV_ITEM_CURSED = 0x1000, //item is cursed IE_INV_ITEM_UNKNOWN2000 = 0x2000, //totally unknown --- 100,104 ---- IE_INV_ITEM_TWOHANDED = 0x200, IE_INV_ITEM_MOVABLE = 0x400, //same as undroppable ! IE_INV_ITEM_RESELLABLE = 0x800, //item will appear in shop when sold IE_INV_ITEM_CURSED = 0x1000, //item is cursed IE_INV_ITEM_UNKNOWN2000 = 0x2000, //totally unknown Index: Store.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Store.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Store.cpp 5 Jul 2006 08:42:19 -0000 1.17 --- Store.cpp 28 Jan 2007 15:56:17 -0000 1.18 *************** *** 58,69 **** //other - pst trigger ref ! int trigger = (int) items[slot]->InfiniteSupply; if (trigger>0) { ! char *TriggerCode = core->GetString( trigger ); bool ret = GameScript::EvaluateString (game->GetPC(game->GetSelectedPCSingle(), false),TriggerCode)!=0; core->FreeString(TriggerCode); return ret; } ! return false; } --- 58,69 ---- //other - pst trigger ref ! ieDwordSigned trigger = items[slot]->InfiniteSupply; if (trigger>0) { ! char *TriggerCode = core->GetString( (ieStrRef) trigger ); bool ret = GameScript::EvaluateString (game->GetPC(game->GetSelectedPCSingle(), false),TriggerCode)!=0; core->FreeString(TriggerCode); return ret; } ! return true; } *************** *** 113,117 **** for (ieDword i=0;i<PurchasedCategoriesCount;i++) { - printf ("%d == %d\n", type, purchased_categories[i]); if (type==purchased_categories[i]) { return ret; --- 113,116 ---- *************** *** 186,190 **** } if(exact) { ! if (temp->InfiniteSupply==(ieDword) -1) { return temp; } --- 185,189 ---- } if(exact) { ! if (temp->InfiniteSupply==-1) { return temp; } *************** *** 207,218 **** return; } ! for (int i=0;i<3;i++) { ! ITMExtHeader *h = itm->GetExtHeader(i); ! if (!h) { ! item->Usages[i]=0; ! continue; ! } ! if (h->RechargeFlags&IE_ITEM_RECHARGE) { ! item->Usages[i] = h->Charges; } } --- 206,223 ---- return; } ! if (!itm->LoreToID) { ! item->Flags |= IE_INV_ITEM_IDENTIFIED; ! } ! //gemrb extension, some shops won't recharge items ! if (!(Flags&IE_STORE_RECHARGE)) { ! for (int i=0;i<3;i++) { ! ITMExtHeader *h = itm->GetExtHeader(i); ! if (!h) { ! item->Usages[i]=0; ! continue; ! } ! if (h->RechargeFlags&IE_ITEM_RECHARGE) { ! item->Usages[i] = h->Charges; ! } } } *************** *** 226,230 **** if (temp) { ! if (temp->InfiniteSupply!=(ieDword) -1) { temp->StackAmount++; } --- 231,235 ---- if (temp) { ! if (temp->InfiniteSupply!=-1) { temp->StackAmount++; } |