mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Fix: preplaced items with incompatible attachments causes entire sector inventories to vanish if entering the sector a second time
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6242 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+26
-15
@@ -5619,25 +5619,36 @@ void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16
|
|||||||
if(usInfiniteLoopCount > 10){ //run through the loop 10 times before we drop items.
|
if(usInfiniteLoopCount > 10){ //run through the loop 10 times before we drop items.
|
||||||
//Anything that's still in our tempAttachList couldn't be attached, and should be dropped.
|
//Anything that's still in our tempAttachList couldn't be attached, and should be dropped.
|
||||||
for (attachmentList::iterator iter = tempAttachList.begin(); iter != tempAttachList.end();) {
|
for (attachmentList::iterator iter = tempAttachList.begin(); iter != tempAttachList.end();) {
|
||||||
if (iter->exists()) {
|
if (iter->exists())
|
||||||
if ( pSoldier && AutoPlaceObject( pSoldier, &(*iter), FALSE ) )
|
{
|
||||||
|
// Flugente: placing objects at a soldier is only advised if the soldier exists in the first place
|
||||||
|
if ( pSoldier )
|
||||||
{
|
{
|
||||||
iter = tempAttachList.erase(iter);
|
if ( !AutoPlaceObject( pSoldier, &(*iter), FALSE ) )
|
||||||
} else { // put it on the ground
|
{
|
||||||
INT8 pathing = (pSoldier?pSoldier->pathing.bLevel:0);
|
AutoPlaceObjectToWorld(pSoldier, &(*iter), TRUE);
|
||||||
INT32 sGridNo = (pSoldier?pSoldier->sGridNo:0);
|
}
|
||||||
AutoPlaceObjectToWorld(pSoldier, &(*iter), TRUE);
|
}
|
||||||
iter = tempAttachList.erase(iter);
|
else
|
||||||
/*if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool){
|
{
|
||||||
|
// put it on the ground
|
||||||
|
INT32 sGridNo = 1;
|
||||||
|
|
||||||
|
if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool)
|
||||||
|
{
|
||||||
AutoPlaceObjectInInventoryStash(&(*iter), sGridNo);
|
AutoPlaceObjectInInventoryStash(&(*iter), sGridNo);
|
||||||
//AddItemToPool( sGridNo, &(*iter), 1, pathing, WORLD_ITEM_REACHABLE, 0 );
|
//AddItemToPool( sGridNo, &(*iter), 1, pathing, WORLD_ITEM_REACHABLE, 0 );
|
||||||
iter = tempAttachList.erase(iter);
|
}
|
||||||
} else {
|
else
|
||||||
AddItemToPool( sGridNo, &(*iter), 1, pathing, WORLD_ITEM_REACHABLE, 0 );
|
{
|
||||||
iter = tempAttachList.erase(iter);
|
AddItemToPool( sGridNo, &(*iter), 1, 0, WORLD_ITEM_REACHABLE, 0 );
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
iter = tempAttachList.erase(iter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user