mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Fixed incorrect vehicle group id after reloading the game and vehicle movement plot issues. (#207)
This commit is contained in:
@@ -4582,6 +4582,28 @@ void HandleSettingTheSelectedListOfMercs( void )
|
|||||||
INT8 pbErrorNumber = -1;
|
INT8 pbErrorNumber = -1;
|
||||||
pSoldier = MercPtrs[gCharactersList[GetSelectedDestChar()].usSolID];
|
pSoldier = MercPtrs[gCharactersList[GetSelectedDestChar()].usSolID];
|
||||||
INT8 bSquadValue = pSoldier->bAssignment;
|
INT8 bSquadValue = pSoldier->bAssignment;
|
||||||
|
if (bSquadValue == VEHICLE)
|
||||||
|
{
|
||||||
|
for (INT8 bCounter = 0; bCounter < NUMBER_OF_SQUADS; ++bCounter)
|
||||||
|
{
|
||||||
|
if (Squad[bCounter][0] != NULL && IsVehicle(Squad[bCounter][0]) &&
|
||||||
|
Squad[bCounter][0]->bVehicleID == pSoldier->iVehicleId)
|
||||||
|
{
|
||||||
|
bSquadValue = bCounter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bSquadValue >= NUMBER_OF_SQUADS)
|
||||||
|
{
|
||||||
|
if (pbErrorNumber != -1)
|
||||||
|
{
|
||||||
|
ReportMapScreenMovementError(pbErrorNumber);
|
||||||
|
}
|
||||||
|
SetSelectedDestChar(-1);
|
||||||
|
giDestHighLine = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// find number of characters in particular squad.
|
// find number of characters in particular squad.
|
||||||
for (INT8 bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; ++bCounter)
|
for (INT8 bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; ++bCounter)
|
||||||
@@ -4693,17 +4715,21 @@ INT8 FindSquadThatSoldierCanJoin( SOLDIERTYPE *pSoldier )
|
|||||||
// run through the list of squads
|
// run through the list of squads
|
||||||
for( bCounter = 0; bCounter < NUMBER_OF_SQUADS; bCounter++ )
|
for( bCounter = 0; bCounter < NUMBER_OF_SQUADS; bCounter++ )
|
||||||
{
|
{
|
||||||
// is this squad in this sector
|
// anv: don't automatically put people in vehicle squads
|
||||||
if( IsThisSquadInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, bCounter ) )
|
if (Squad[bCounter][0] == NULL || !IsVehicle(Squad[bCounter][0]))
|
||||||
{
|
{
|
||||||
// does it have room?
|
// is this squad in this sector
|
||||||
if( IsThisSquadFull( bCounter ) == FALSE )
|
if (IsThisSquadInThisSector(pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, bCounter))
|
||||||
{
|
{
|
||||||
// is it doing the same thing as the soldier is (staying or going) ?
|
// does it have room?
|
||||||
if( IsSquadSelectedForMovement( bCounter ) == IsSoldierSelectedForMovement( pSoldier ) )
|
if (IsThisSquadFull(bCounter) == FALSE)
|
||||||
{
|
{
|
||||||
// go ourselves a match, then
|
// is it doing the same thing as the soldier is (staying or going) ?
|
||||||
return( bCounter );
|
if (IsSquadSelectedForMovement(bCounter) == IsSoldierSelectedForMovement(pSoldier))
|
||||||
|
{
|
||||||
|
// go ourselves a match, then
|
||||||
|
return(bCounter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-1
@@ -1700,7 +1700,20 @@ void CheckSquadMovementGroups( void )
|
|||||||
for (INT8 iSoldier = 0; iSoldier < NUMBER_OF_SOLDIERS_PER_SQUAD; iSoldier++) {
|
for (INT8 iSoldier = 0; iSoldier < NUMBER_OF_SOLDIERS_PER_SQUAD; iSoldier++) {
|
||||||
if (Squad[iSquad][iSoldier] != NULL)
|
if (Squad[iSquad][iSoldier] != NULL)
|
||||||
{
|
{
|
||||||
Squad[iSquad][iSoldier]->ubGroupID = pGroup->ubGroupID;
|
if (IsVehicle(Squad[iSquad][iSoldier]))
|
||||||
|
{
|
||||||
|
INT32 iCounter = 0;
|
||||||
|
for (iCounter = 0; iCounter < ubNumberOfVehicles; iCounter++)
|
||||||
|
{
|
||||||
|
if (pVehicleList[iCounter].ubProfileID == Squad[iSquad][iSoldier]->ubProfile)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Squad[iSquad][iSoldier]->ubGroupID = pVehicleList[iCounter].ubMovementGroup;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Squad[iSquad][iSoldier]->ubGroupID = pGroup->ubGroupID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user