Further adjust handling of ryzomclassic/#31 temp bag take all

ryzomclassic-develop
kaetemi 5 years ago
parent 35a9e747f7
commit f18f4196b4

@ -7966,7 +7966,7 @@ void CCharacter::endHarvest(bool sendCloseTempImpulsion)
if (sendCloseTemp && sendCloseTempImpulsion)
{
sendCloseTempInventoryImpulsion();
sendCloseTempInventoryImpulsion(true);
}
} // endHarvest //
@ -14477,17 +14477,35 @@ bool CCharacter::pickUpRawMaterial( uint32 indexInTempInv, bool * lastMaterial )
//-----------------------------------------------
// sendCloseTempInventoryImpulsion
//-----------------------------------------------
void CCharacter::sendCloseTempInventoryImpulsion()
void CCharacter::sendCloseTempInventoryImpulsion(bool onlyIfEmpty)
{
// Sage: May 9 2007
// The live servers are crashing due to an infinite indirect recursion loop
// itemTempInventoryToBag() calls endHarvest() calls sendCloseTempInventoryImpulsion() calls getAllTempInventoryItems() calls itemTempInventoryToBag() ...
// the following anti bug is a temporaray fix to prevent inifinte recursion and stack overflow
static bool isRecursing= false; // **** Temp Fix 1/4 **** //
BOMB_IF(isRecursing,"CCharacter::sendCloseTempInventoryImpulsion is recursing!",return); // **** Temp Fix 2/4 **** //
isRecursing= true; // **** Temp Fix 3/4 **** //
static bool isRecursing = false; // **** Temp Fix 1/4 **** //
getAllTempInventoryItems(); // false);
if (onlyIfEmpty)
{
CInventoryPtr tempInv = getInventory(INVENTORIES::temporary);
nlassert(tempInv != NULL);
if (tempInv->getUsedSlotCount())
{
nldebug("Temporary inventory is not empty, do not send impulsion to close");
return;
}
}
if (!onlyIfEmpty)
{
BOMB_IF(isRecursing, "CCharacter::sendCloseTempInventoryImpulsion is recursing!", return); // **** Temp Fix 2/4 **** //
isRecursing = true; // **** Temp Fix 3/4 **** //
// Take all items
getAllTempInventoryItems();
isRecursing= false; // **** Temp Fix 4/4 **** //
}
CMessage msgout( "IMPULSION_ID" );
msgout.serial( _Id );
@ -14500,7 +14518,6 @@ void CCharacter::sendCloseTempInventoryImpulsion()
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout );
isRecursing= false; // **** Temp Fix 4/4 **** //
} // sendCloseTempInventoryImpulsion //
//-----------------------------------------------

@ -1860,7 +1860,7 @@ public:
virtual float getActualDamageFromExplosionWithArmor( float dmg ) const;
/// send temp inventory close impulsion to client
void sendCloseTempInventoryImpulsion();
void sendCloseTempInventoryImpulsion(bool onlyIfEmpty = false);
/// set a fame value for the player, send info to the client.
void setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint32 fameMax, uint16 fameTrend);

Loading…
Cancel
Save