mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- prisoners give information only on mobile patrols, not on city sectors
- if using militia equipment, items stolen by militia are dropped after combat if their class is distributed to militia by the player - Fix: do not delete world items with invalid gridno - Fix: militia drop gear on valid GridNo git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5892 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user