From: <wel...@us...> - 2010-02-18 15:13:37
|
Revision: 5575 http://planeshift.svn.sourceforge.net/planeshift/?rev=5575&view=rev Author: weltall2 Date: 2010-02-18 15:13:30 +0000 (Thu, 18 Feb 2010) Log Message: ----------- fixed PS#4096 - weapon changing shortcut failing patch by rlydontknow Modified Paths: -------------- trunk/src/client/cmdusers.cpp trunk/src/client/gui/inventorywindow.cpp trunk/src/client/gui/inventorywindow.h Modified: trunk/src/client/cmdusers.cpp =================================================================== --- trunk/src/client/cmdusers.cpp 2010-02-18 10:36:07 UTC (rev 5574) +++ trunk/src/client/cmdusers.cpp 2010-02-18 15:13:30 UTC (rev 5575) @@ -45,6 +45,7 @@ #include "gui/pawscontrolwindow.h" #include "gui/psmainwidget.h" #include "gui/pawsgameboard.h" +#include "gui/pawsslot.h" #include "paws/pawsmanager.h" #include "paws/pawsyesnobox.h" @@ -313,17 +314,28 @@ else if (words[0] == "/equip" || (words[0] == "/use" && words.GetCount() > 1)) { if ( words.GetCount() < 2 ) - return "Usage: /equip [stack count] [item name]"; + return "Usage: /equip [stack count] [slot] [item name]"; + + int tail = 1; int quantity = atoi(words[1]); - csString itemName; - if (quantity == 0) + if (quantity > 0) + tail++; + else + quantity = 1; + + pawsInventoryWindow* window = (pawsInventoryWindow*)PawsManager::GetSingleton().FindWidget("InventoryWindow"); + + int slotID = -1; + pawsSlot* toSlot = dynamic_cast <pawsSlot*>(window->FindWidget(words[tail])); + if (toSlot) { - quantity = 1; - itemName = words.GetTail(1); + slotID = toSlot->ID(); + tail++; } - else itemName = words.GetTail(2); - pawsInventoryWindow* window = (pawsInventoryWindow*)PawsManager::GetSingleton().FindWidget("InventoryWindow"); - window->Equip( itemName, quantity ); + + csString itemName; + itemName = words.GetTail(tail); + window->Equip( itemName, quantity, slotID ); } else if ( words[0] == "/dequip" ) Modified: trunk/src/client/gui/inventorywindow.cpp =================================================================== --- trunk/src/client/gui/inventorywindow.cpp 2010-02-18 10:36:07 UTC (rev 5574) +++ trunk/src/client/gui/inventorywindow.cpp 2010-02-18 15:13:30 UTC (rev 5575) @@ -343,7 +343,7 @@ } } -void pawsInventoryWindow::Equip( const char* itemName, int stackCount ) +void pawsInventoryWindow::Equip( const char* itemName, int stackCount, int toSlotID ) { pawsListBox * bulkList = dynamic_cast <pawsListBox*> (FindWidget("BulkList")); if ( (itemName != NULL) && (bulkList) ) @@ -364,12 +364,13 @@ if ( fromSlot ) { + fromSlot->Clear(); int container = fromSlot->ContainerID(); int slot = fromSlot->ID(); //psItem* item = charData->GetItemInSlot( slot ); psSlotMovementMsg msg( container, slot, - CONTAINER_INVENTORY_EQUIPMENT, -1, + CONTAINER_INVENTORY_EQUIPMENT, toSlotID, stackCount ); msg.SendMessage(); } Modified: trunk/src/client/gui/inventorywindow.h =================================================================== --- trunk/src/client/gui/inventorywindow.h 2010-02-18 10:36:07 UTC (rev 5574) +++ trunk/src/client/gui/inventorywindow.h 2010-02-18 15:13:30 UTC (rev 5575) @@ -73,8 +73,9 @@ * * @param itemName The name of the item in the inventory. * @param stackCount The amount to try to equip. + * @param toSlotID The slot you want to equip it to. */ - void Equip( const char* itemName, int stackCount ); + void Equip( const char* itemName, int stackCount, int toSlotID = -1 ); /** Dequips an item into closest available bulk slot. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |