diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index f0e2137af..3ea5ee9f1 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -5608,8 +5608,8 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) UINT32 result = Random(100); if ( result < gGameExternalOptions.ubPrisonerProcessInfoDetectChance ) { - // there need to be enemies here... - if ( NumStationaryEnemiesInSector( sX, sY ) == 0 ) + // there need to be mobile enemies here - that the quenn has troops in towns we do not own is hardly worthy information + if ( NumMobileEnemiesInSector( sX, sY ) == 0 ) continue; // enemy patrol detected diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 2dcda0b74..d7477ba27 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -2086,6 +2086,35 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr // Make copy of item gTempObject = gWorldItems[ pItemPool->iItemIndex ].object; + // Flugente: if we allow militia to use sector equipment, then mark gear they pick up, so that they drop it too. + if ( pSoldier->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory ) + { + if ( Item[gTempObject.usItem].usItemClass & IC_ARMOUR && gGameExternalOptions.fMilitiaUseSectorInventory_Armour ) + { + gTempObject[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gTempObject.usItem].usItemClass & IC_FACE && gGameExternalOptions.fMilitiaUseSectorInventory_Face ) + { + gTempObject[0]->data.sObjectFlag |= IC_FACE; + } + else if ( Item[gTempObject.usItem].usItemClass & (IC_BLADE|IC_PUNCH) && gGameExternalOptions.fMilitiaUseSectorInventory_Melee ) + { + gTempObject[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gTempObject.usItem].usItemClass & IC_GRENADE && gGameExternalOptions.fMilitiaUseSectorInventory_Grenade ) + { + gTempObject[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gTempObject.usItem].usItemClass & (IC_GUN|IC_AMMO) && gGameExternalOptions.fMilitiaUseSectorInventory_Gun ) + { + gTempObject[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gTempObject.usItem].usItemClass & IC_LAUNCHER && gGameExternalOptions.fMilitiaUseSectorInventory_Launcher ) + { + gTempObject[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + } + if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) { // check to see if the object has been swapped with one in inventory @@ -2211,6 +2240,35 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr */ RemoveItemFromPool( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); + // Flugente: if we allow militia to use sector equipment, then mark gear they pick up, so that they drop it too. + if ( pSoldier->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory ) + { + if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & IC_ARMOUR && gGameExternalOptions.fMilitiaUseSectorInventory_Armour ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & IC_FACE && gGameExternalOptions.fMilitiaUseSectorInventory_Face ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= IC_FACE; + } + else if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & (IC_BLADE|IC_PUNCH) && gGameExternalOptions.fMilitiaUseSectorInventory_Melee ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & IC_GRENADE && gGameExternalOptions.fMilitiaUseSectorInventory_Grenade ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & (IC_GUN|IC_AMMO) && gGameExternalOptions.fMilitiaUseSectorInventory_Gun ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + else if ( Item[gWorldItems[ iItemIndex ].object.usItem].usItemClass & IC_LAUNCHER && gGameExternalOptions.fMilitiaUseSectorInventory_Launcher ) + { + gWorldItems[ iItemIndex ].object[0]->data.sObjectFlag |= TAKEN_BY_MILITIA; + } + } + if ( !AutoPlaceObject( pSoldier, &(gWorldItems[ iItemIndex ].object ), TRUE ) ) { //ADB well we made an animation, should we still use up points? diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index f02292972..463845efa 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -4585,7 +4585,9 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI if ( pWorldItem[ uiCount ].object.ubNumberOfObjects < 1 ) { - RemoveItemFromPool(pWorldItem[ uiCount ].sGridNo, uiCount, pWorldItem[ uiCount ].ubLevel); + if ( pWorldItem[ uiCount ].sGridNo != NOWHERE ) + RemoveItemFromPool(pWorldItem[ uiCount ].sGridNo, uiCount, pWorldItem[ uiCount ].ubLevel); + pWorldItem[ uiCount ].fExists = FALSE; } } @@ -4615,7 +4617,9 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI if ( pWorldItem[ uiCount ].object.ubNumberOfObjects < 1 ) { - RemoveItemFromPool(pWorldItem[ uiCount ].sGridNo, uiCount, pWorldItem[ uiCount ].ubLevel); + if ( pWorldItem[ uiCount ].sGridNo != NOWHERE ) + RemoveItemFromPool(pWorldItem[ uiCount ].sGridNo, uiCount, pWorldItem[ uiCount ].ubLevel); + pWorldItem[ uiCount ].fExists = FALSE; } } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index fb9b20015..b35bc55b0 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -15738,7 +15738,11 @@ void SOLDIERTYPE::DropSectorEquipment() if ( !gGameExternalOptions.fMilitiaUseSectorInventory_Ammo && Item[ pObj->usItem ].usItemClass & IC_GUN ) (*pObj)[0]->data.gun.ubGunShotsLeft = 0; - AddItemToPool( this->sGridNo, pObj, 1 , this->pathing.bLevel, (WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO|WORLD_ITEM_REACHABLE), -1 ); + INT32 sPutGridNo = this->sGridNo; + if ( sPutGridNo == NOWHERE ) + sPutGridNo = RandomGridNo(); + + AddItemToPool( sPutGridNo, pObj, 1 , this->pathing.bLevel, (WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO|WORLD_ITEM_REACHABLE), -1 ); DeleteObj( &(this->inv[cnt]) ); } }