Merge branch '1dot13:master' into Backgrounds

This commit is contained in:
Kitty
2024-01-03 03:01:34 +01:00
committed by GitHub
7 changed files with 45 additions and 19 deletions
+2 -2
View File
@@ -995,13 +995,13 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
if( ( pSoldier->bAssignment != VEHICLE ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) )
//if ( pSoldier->bAssignment != VEHICLE )
{ //Can only remove groups if they aren't persistant (not in a squad or vehicle)
RemoveGroup( pSoldier->ubGroupID );
RemovePlayerFromGroup(pSoldier->ubGroupID, pSoldier);
}
else
{
// remove him from any existing merc slot he could be in
RemoveMercSlot( pSoldier );
TakeSoldierOutOfVehicle( pSoldier );
TakeSoldierOutOfVehicle( pSoldier );
}
}
+3 -3
View File
@@ -1717,10 +1717,10 @@ BOOLEAN TrackerTileHasAdjTile( const INT32& ubX, const INT32& ubY, const INT32&
void CalculateFortify( )
{
// simply get all fortified gridnos and colour them
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > vec = GetAllForticationGridNo( );
auto vec = GetAllForticationGridNo();
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator itend = vec.end( );
for ( std::vector< std::pair<INT16, std::pair<UINT8, INT8> > >::iterator it = vec.begin( ); it != itend; ++it )
auto itend = vec.end();
for (auto it = vec.begin(); it != itend; ++it)
{
INT16 sX, sY;
ConvertGridNoToXY( (*it).first, &sX, &sY );
+3 -3
View File
@@ -8165,7 +8165,7 @@ void CorrectDragStructData( INT32 sGridNo, INT8 sLevel, UINT8 ausHitpoints, UINT
if ( pStruct->ubHitPoints < pStruct->pDBStructureRef->pDBStructure->ubHitPoints
|| pStruct->ubDecalFlag & STRUCTURE_DECALFLAG_BLOOD )
{
gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_STRUCTURE_DAMAGED;
gpWorldLevelData[sGridNo].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED;
//SetRenderFlags( RENDER_FLAG_FULL );
}
@@ -8713,9 +8713,9 @@ void AddFortificationPlanNode( INT32 sGridNo, INT8 sLevel, INT16 sFortificationS
UpdateFortificationPossibleAmount();
}
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > GetAllForticationGridNo( )
GetAllForticationGridNoResult GetAllForticationGridNo()
{
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > gridnovector;
GetAllForticationGridNoResult gridnovector;
if ( !gWorldSectorX || !gWorldSectorY )
return gridnovector;
+3 -2
View File
@@ -320,7 +320,8 @@ void AddFortificationPlanNode( INT32 sGridNo, INT8 sLevel, INT16 sFortificationS
void LoadSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
void SaveSectorFortificationPlan( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ );
std::vector< std::pair<INT16, std::pair<UINT8, INT8> > > GetAllForticationGridNo( );
using GetAllForticationGridNoResult = std::vector< std::pair<INT32, std::pair<UINT8, INT8> > >;
GetAllForticationGridNoResult GetAllForticationGridNo();
INT32 GetFirstObjectInSectorPosition( UINT16 ausItem );
@@ -334,4 +335,4 @@ BOOLEAN SpendMoney( SOLDIERTYPE *pSoldier, UINT32 aAmount ); // character spen
// Flugente: intel
void TakePhoto( SOLDIERTYPE* pSoldier, INT32 sGridNo, INT8 bLevel );
#endif
#endif
+3
View File
@@ -93,6 +93,9 @@ INT32 FindGridNoFromSweetSpot( SOLDIERTYPE *pSoldier, INT32 sSweetGridNo, INT8 u
soldier.pathing.bLevel = 0;
soldier.bTeam = 1;
soldier.sGridNo = sSweetGridNo;
soldier.sDragCorpseID = pSoldier->sDragCorpseID;
soldier.sDragGridNo = pSoldier->sDragGridNo;
soldier.usDragPersonID = pSoldier->usDragPersonID;
sTop = ubRadius;
sBottom = -ubRadius;
+1 -1
View File
@@ -8309,7 +8309,7 @@ void HandleTBLevelUp(void)
void HandleTBBackpacks(void)
{
if (UsingNewInventorySystem)
if (UsingNewInventorySystem())
{
bool backpackDropped = false;
SOLDIERTYPE* pTeamSoldier;
+30 -8
View File
@@ -2440,10 +2440,14 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
// MemAlloc returns a NULL pointer which the code would interpret as
// allocation failing because of no memory.
// I hope this is OK, I don't entirely understand what is done here...
// (ASDOW): Commented out the added conditional, because with an unlucky combination of sti image width and offset, eg 9x16 with x offset of -15
// pCurr->pbZChange would be null, which then crashes the game inside the blitting functions when dereferencing a nullptr
// With Bio experiencing crashes causing him to add the check, I don't know if this is just kicking the can down the road.
// if (pCurr->ubNumberOfZChanges > 0)
// (ASDOW): Adjusted the else branch to prevent DEBUG build hitting an assertion error due to this function returning false and
// preventing crashes in blitter functions due to nullptr dereference as what happened with bio's original solution.
// Allocating one INT8 and setting it to 0 means the Z-value is not adjusted in blitters.
// So far it seems to just work, albeit we're getting a screenmessage of structure not added to the world properly, when
// the game tries to add one in AddMercStructureInfoFromAnimSurface() for said anim when we're missing the actual structureinfo.
// As the game then doesn't do anything besides returning false, it seems to not cause any issues besides the screenmessage in debug build.
// So now we should not suffer from the constant assertion errors in debug build when LOBOT is active. Though this could still use a proper solution..
if (pCurr->ubNumberOfZChanges > 0)
{
pCurr->pbZChange = (INT8 *)MemAlloc(pCurr->ubNumberOfZChanges);
if (pCurr->pbZChange == NULL)
@@ -2485,10 +2489,28 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
pCurr->bInitialZChange = -(ubNumDecreasing);
}
}
// else
// {
// pCurr->pbZChange = NULL;
// }
else
{
pCurr->pbZChange = (INT8*)MemAlloc(1);
// Abort if MemAlloc fails
if (pCurr->pbZChange == NULL)
{
// augh!
for (ubLoop2 = 0; ubLoop2 < uiLoop; ubLoop2++)
{
if (hVObject->ppZStripInfo[ubLoop2] != NULL)
{
MemFree(hVObject->ppZStripInfo[uiLoop]);
}
}
MemFree(hVObject->ppZStripInfo);
hVObject->ppZStripInfo = NULL;
return(FALSE);
}
pCurr->pbZChange[0] = 0;
}
}
}
}