From: Enar <eva...@us...> - 2006-08-07 19:04:07
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17830 Modified Files: psserverchar.cpp Log Message: Made containers in character's inventory working and fixed server crashes related to containers in the inventory. Index: psserverchar.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/psserverchar.cpp,v retrieving revision 1.379 retrieving revision 1.380 diff -C2 -d -r1.379 -r1.380 *** psserverchar.cpp 5 Aug 2006 00:28:56 -0000 1.379 --- psserverchar.cpp 7 Aug 2006 19:04:04 -0000 1.380 *************** *** 2273,2276 **** --- 2273,2277 ---- { holdingContainer = FindContainer( fromClient, mesg.fromContainer, mesg.fromParentContainer ); + if ( holdingContainer && holdingContainer->GetGemObject() ) // Container exists in world { *************** *** 2304,2307 **** --- 2305,2313 ---- } } + else if (holdingContainer) + { + // Containers in character's inventory + holdingItem = holdingContainer->RemoveItemsInContainer(mesg.fromSlot, mesg.stackCount); + } break; } *************** *** 2583,2587 **** { // Check range ignoring Y co-ordinate ! if ( fromClient->GetActor()->RangeTo(toContainer->GetGemObject(), true) > RANGE_TO_USE ) { psserver->SendSystemError(clientNum,"You are not in range to use %s.",toContainer->GetName()); --- 2589,2594 ---- { // Check range ignoring Y co-ordinate ! if ( toContainer->GetGemObject() && ! fromClient->GetActor()->RangeTo(toContainer->GetGemObject(), true) > RANGE_TO_USE ) { psserver->SendSystemError(clientNum,"You are not in range to use %s.",toContainer->GetName()); *************** *** 2595,2612 **** //psserver->GetCharManager()->SendItemContents( fromClient, toContainer ); ! // Detect if this is an actionlocation container entity id's will not match ! if ( toContainer->GetGemObject()->GetEntity()->GetID() != mesg.toContainer ) { ! psserver->GetCharManager()->ViewItem( fromClient, mesg.toContainer, 0 , 0 ); } else { ! psserver->GetCharManager()->ViewItem( fromClient, toContainer->GetGemObject()->GetEntity()->GetID(), 0 , 0 ); } ! ! // check to see if this container will start an auto transform of item(s) ! psItem *item = toContainer->GetItemInSlot(mesg.toSlot); ! psserver->GetWorkManager()->StartAutoWork( ! fromClient, toContainer, item, item->GetStackCount()); holdingItem = NULL; } --- 2602,2628 ---- //psserver->GetCharManager()->SendItemContents( fromClient, toContainer ); ! if (!toContainer->GetGemObject()) { ! // Containers in character's inventory need different code to handle them ! psserver->GetCharManager()->ViewItem( fromClient, -1, mesg.toContainer, 0); } else { ! // Detect if this is an actionlocation container entity id's will not match ! if ( toContainer->GetGemObject()->GetEntity()->GetID() != mesg.toContainer ) ! { ! psserver->GetCharManager()->ViewItem( fromClient, mesg.toContainer, 0 , 0 ); ! } ! else ! { ! psserver->GetCharManager()->ViewItem( fromClient, toContainer->GetGemObject()->GetEntity()->GetID(), 0 , 0 ); ! } ! ! // check to see if this container will start an auto transform of item(s) ! psItem *item = toContainer->GetItemInSlot(mesg.toSlot); ! psserver->GetWorkManager()->StartAutoWork( ! fromClient, toContainer, item, item->GetStackCount()); } ! holdingItem = NULL; } |