mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fix: crash when checking for muzzleflash
- Fix: under certain conditions, AI-selffeeding could lead to invalid inventory sizes - information from prisoner interrogation is about new sectors - no autoriot in a prison sector if militia is present git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5912 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -5608,10 +5608,14 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
UINT32 result = Random(100);
|
||||
if ( result < gGameExternalOptions.ubPrisonerProcessInfoDetectChance )
|
||||
{
|
||||
// there need to be mobile enemies here - that the quenn has troops in towns we do not own is hardly worthy information
|
||||
// there need to be mobile enemies here - that the queen has troops in towns we do not own is hardly worthy information
|
||||
if ( NumMobileEnemiesInSector( sX, sY ) == 0 )
|
||||
continue;
|
||||
|
||||
// not if we already know about this sector
|
||||
if ( SectorInfo[ SECTOR( sX, sY ) ].uiFlags & SF_ASSIGN_NOTICED_ENEMIES_HERE )
|
||||
continue;
|
||||
|
||||
// enemy patrol detected
|
||||
SectorInfo[ SECTOR( sX, sY ) ].uiFlags |= SF_ASSIGN_NOTICED_ENEMIES_HERE;
|
||||
|
||||
@@ -5783,6 +5787,7 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
|
||||
// add militia strength
|
||||
prisonguardvalue += 100 * pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + 150 * pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + 200 * pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
numprisonguards += pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
|
||||
if ( !numprisonguards )
|
||||
fBeginRiot = TRUE;
|
||||
|
||||
@@ -5223,7 +5223,7 @@ void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, WORLDI
|
||||
{
|
||||
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
|
||||
{
|
||||
(*pObj)[i]->data.bDirtLevel = max(0.0f, min( OVERHEATING_MAX_TEMPERATURE, (*pObj)[i]->data.bDirtLevel + tickspassed * dirtincreasefactor) ); // set new temperature
|
||||
(*pObj)[i]->data.bDirtLevel = max(0.0f, min( OVERHEATING_MAX_TEMPERATURE, (*pObj)[i]->data.bDirtLevel + tickspassed * dirtincreasefactor) ); // set new dirt value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5233,8 +5233,8 @@ void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, WORLDI
|
||||
if ( Food[Item[pObj->usItem].foodtype].usDecayRate > 0.0f ) // ... if the food can decay...
|
||||
{
|
||||
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
|
||||
{
|
||||
(*pObj)[i]->data.bTemperature = max(0.0f, (*pObj)[i]->data.bTemperature - foofdecaymod * Food[Item[pObj->usItem].foodtype].usDecayRate); // set new temperature
|
||||
{
|
||||
(*pObj)[i]->data.bTemperature = max(0.0f, (*pObj)[i]->data.bTemperature - foofdecaymod * Food[Item[pObj->usItem].foodtype].usDecayRate); // set new temperature
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -11586,8 +11586,11 @@ BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier )
|
||||
if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash )
|
||||
return TRUE;
|
||||
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
|
||||
if (Item[iter->usItem].hidemuzzleflash && iter->exists() )
|
||||
attachmentList::iterator iter = (*pObj)[0]->attachments.begin();
|
||||
attachmentList::iterator iterend = (*pObj)[0]->attachments.end();
|
||||
for (; iter != iterend; ++iter)
|
||||
{
|
||||
if (iter->exists() && Item[iter->usItem].hidemuzzleflash )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -14326,8 +14326,8 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal(UINT8* pubId1, UINT16* pGunSlot1, UINT16
|
||||
|
||||
// ok, we are facing a teammate. Check if he has a gun in any hand that still has ammo left
|
||||
UINT16 pTeamSoldierfirstslot = HANDPOS;
|
||||
UINT16 pTeamSoldierlastslot = SECONDHANDPOS;
|
||||
for (UINT16 teamsoldierinvpos = pTeamSoldierfirstslot; teamsoldierinvpos <= pTeamSoldierlastslot; ++teamsoldierinvpos)
|
||||
UINT16 pTeamSoldierlastslot = VESTPOCKPOS;
|
||||
for (UINT16 teamsoldierinvpos = pTeamSoldierfirstslot; teamsoldierinvpos < pTeamSoldierlastslot; ++teamsoldierinvpos)
|
||||
{
|
||||
OBJECTTYPE* pObjInHands = &(pTeamSoldier->inv[teamsoldierinvpos]);
|
||||
if ( pObjInHands && pObjInHands->exists() && Item [ pObjInHands->usItem ].usItemClass == IC_GUN && (HasItemFlag( pObjInHands->usItem, BELT_FED ) || HasAttachmentOfClass(pObjInHands, AC_FEEDER) ) && (*pObjInHands)[0]->data.gun.ubGunShotsLeft > 0 )
|
||||
@@ -14379,7 +14379,7 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal(UINT8* pubId1, UINT16* pGunSlot1, UINT16
|
||||
|
||||
// this determines which slots we'll search for ammo
|
||||
UINT16 firstslotforammo = MEDPOCK1POS;
|
||||
UINT16 lastslotforammo = MEDPOCK2POS;
|
||||
UINT16 lastslotforammo = MEDPOCK3POS;
|
||||
|
||||
// for robots and AI-controlled soldiers (who don't have any LBE gear), we put a change in here so that ALL their slots are checked for ammo
|
||||
if ( this->bTeam != gbPlayerNum || MercPtrs[ this->ubID ]->flags.uiStatusFlags & SOLDIER_ROBOT )
|
||||
@@ -14395,8 +14395,8 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal(UINT8* pubId1, UINT16* pGunSlot1, UINT16
|
||||
}
|
||||
|
||||
UINT16 searchgunfirstslot = HANDPOS;
|
||||
UINT16 searchgunlastslot = SECONDHANDPOS;
|
||||
for (UINT16 invpos = searchgunfirstslot; invpos <= searchgunlastslot; ++invpos)
|
||||
UINT16 searchgunlastslot = VESTPOCKPOS;
|
||||
for (UINT16 invpos = searchgunfirstslot; invpos < searchgunlastslot; ++invpos)
|
||||
{
|
||||
// check our hands for guns
|
||||
OBJECTTYPE* pObj = &(this->inv[invpos]);
|
||||
@@ -14412,7 +14412,7 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal(UINT8* pubId1, UINT16* pGunSlot1, UINT16
|
||||
usGunAmmoType = (*pObj)[0]->data.gun.ubGunAmmoType;
|
||||
|
||||
// now check the inventory for an ammo belt. If we are not from the player team or a robot, we will search the entire inventory
|
||||
for ( UINT16 bLoop = firstslotforammo; bLoop <= lastslotforammo; ++bLoop)
|
||||
for ( UINT16 bLoop = firstslotforammo; bLoop < lastslotforammo; ++bLoop)
|
||||
{
|
||||
if (this->inv[bLoop].exists() == true )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user