summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-02-16 17:08:19 +0100
committerSergeanur <s.anureev@yandex.ua>2021-02-16 17:08:19 +0100
commite38467ef3affef25b83daf0c0c3b8a61f04e8a65 (patch)
tree3628aed1314f21147e7a46f3095fa341088d8044 /src/control
parentfix mailbox particle (diff)
parentPR rules (diff)
downloadre3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar.gz
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar.bz2
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar.lz
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar.xz
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.tar.zst
re3-e38467ef3affef25b83daf0c0c3b8a61f04e8a65.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/control/Garages.cpp8
-rw-r--r--src/control/PathFind.cpp2
-rw-r--r--src/control/PathFind.h8
-rw-r--r--src/control/Phones.cpp10
-rw-r--r--src/control/Pickups.cpp7
-rw-r--r--src/control/Replay.cpp20
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/control/Script4.cpp4
-rw-r--r--src/control/Script5.cpp8
-rw-r--r--src/control/Script7.cpp6
-rw-r--r--src/control/Script8.cpp4
-rw-r--r--src/control/Script9.cpp4
-rw-r--r--src/control/SetPieces.cpp4
14 files changed, 49 insertions, 40 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index e92f26c9..ac02abec 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2790,7 +2790,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
up.Normalise();
CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ);
forward.Normalise();
- CVector right = CrossProduct(forward, up);
+ CVector right = CrossProduct(up, forward);
right.z -= 5.0f * pPlane->m_fPlaneSteer;
right.Normalise();
up = CrossProduct(forward, right);
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index a3e91f85..c0eac806 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -2357,7 +2357,11 @@ float CGarages::FindDoorHeightForMI(int32 mi)
void CGarage::TidyUpGarage()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (pVehicle && (pVehicle->IsCar() || pVehicle->IsBike())) {
if (IsPointInsideGarage(pVehicle->GetPosition())) {
@@ -2373,7 +2377,11 @@ void CGarage::TidyUpGarage()
void CGarage::TidyUpGarageClose()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle)
continue;
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index bc9af2e9..3d18eb0d 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -859,7 +859,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
mag = Sqrt(dx*dx + dy*dy);
dx /= mag;
dy /= mag;
- int width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
+ uint8 width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
if(i < j){
dx = -dx;
dy = -dy;
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index acf9929a..99759590 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -120,7 +120,7 @@ struct CCarPathLink
uint8 trafficLightDirection : 1;
uint8 trafficLightType : 2;
uint8 bBridgeLights : 1; // at least in LCS...
- int8 width;
+ uint8 width;
CVector2D GetPosition(void) { return CVector2D(x/8.0f, y/8.0f); }
CVector2D GetDirection(void) { return CVector2D(dirX/100.0f, dirY/100.0f); }
@@ -151,7 +151,7 @@ struct CPathInfoForObject
int8 numLeftLanes;
int8 numRightLanes;
int8 speedLimit;
- int8 width;
+ uint8 width;
uint8 crossing : 1;
uint8 onlySmallBoats : 1;
@@ -177,7 +177,7 @@ struct CTempNode
int16 link2;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
int8 linkState;
};
@@ -188,7 +188,7 @@ struct CTempNodeExternal // made up name
int16 next;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
};
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index 411dc8c3..9b50a7ec 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -48,9 +48,9 @@ CPhoneInfo::Update(void)
TheCamera.SetWideScreenOff();
pPhoneDisplayingMessages = nil;
bDisplayingPhoneMessage = false;
- CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_PHONE_TALK);
+ CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_STD_PHONE_TALK);
if (talkAssoc && talkAssoc->blendAmount > 0.5f) {
- CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_OUT, 8.0f);
+ CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_OUT, 8.0f);
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else {
@@ -107,7 +107,7 @@ CPhoneInfo::Update(void)
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true);
- CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
+ CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_IN, 4.0f);
phonePickAssoc->SetFinishCallback(PhonePickUpCB, &m_aPhones[phoneId]);
bPickingUpPhone = true;
pCallBackPed = player;
@@ -363,10 +363,10 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
CPed *ped = CPhoneInfo::pCallBackPed;
ped->m_nMoveState = PEDMOVE_STILL;
- CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
+ CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_IDLE, 8.0f);
if (assoc->blendAmount > 0.5f && ped)
- CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
+ CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_TALK, 8.0f);
CPhoneInfo::pCallBackPed = nil;
}
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 9dff91dd..0b4a8b6b 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -274,10 +274,11 @@ CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
- (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
- || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
+ (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.2f)
+ || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.2f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->GetWantedLevel() == 0)
- || (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
+ || (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame))
+ || (m_eType == PICKUP_ASSET_REVENUE && m_fRevenue < 10.0f);
return !cannotBePickedUp;
}
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 5f481234..61345785 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -521,7 +521,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
state->aFunctionCallbackID[i] = 0;
}
}else{
- state->aAnimId[i] = NUM_STD_ANIMS;
+ state->aAnimId[i] = ANIM_STD_NUM;
state->aCurTime[i] = 0;
state->aSpeed[i] = 85;
state->aFunctionCallbackID[i] = 0;
@@ -548,7 +548,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
else {
- state->aAnimId2[i] = NUM_STD_ANIMS;
+ state->aAnimId2[i] = ANIM_STD_NUM;
state->aCurTime2[i] = 0;
state->aSpeed2[i] = 85;
state->aFunctionCallbackID2[i] = 0;
@@ -611,13 +611,13 @@ bool HasAnimGroupLoaded(uint8 group)
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
{
CAnimBlendAssociation* anim1;
- if (state->animId <= 3)
+ if (state->animId <= ANIM_STD_IDLE)
anim1 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, ped->m_animGroup, (AnimationId)state->animId, 100.0f);
else if (HasAnimGroupLoaded(state->groupId))
anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, (AssocGroupId)state->groupId, (AnimationId)state->animId, 100.0f);
else
- anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WALK, 100.0f);
+ anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_STD_WALK, 100.0f);
anim1->SetCurrentTime(state->time * 4.0f / 255.0f);
anim1->speed = state->speed * 3.0f / 255.0f;
@@ -629,7 +629,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
float blend = state->blendAmount * 2.0f / 255.0f;
CAnimBlendAssociation* anim2 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
- (state->secAnimId > 3) ? (AssocGroupId)state->secGroupId : ped->m_animGroup,
+ (state->secAnimId > ANIM_STD_IDLE) ? (AssocGroupId)state->secGroupId : ped->m_animGroup,
(AnimationId)state->secAnimId, 100.0f);
anim2->SetCurrentTime(time);
anim2->speed = speed;
@@ -641,7 +641,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
float time = state->partAnimTime * 4.0f / 255.0f;
float speed = state->partAnimSpeed * 3.0f / 255.0f;
float blend = state->partBlendAmount * 2.0f / 255.0f;
- if (blend > 0.0f && state->partAnimId != ANIM_IDLE_STANCE && HasAnimGroupLoaded(state->partGroupId)){
+ if (blend > 0.0f && state->partAnimId != ANIM_STD_IDLE && HasAnimGroupLoaded(state->partGroupId)){
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, (AssocGroupId)state->partGroupId, (AnimationId)state->partAnimId, 1000.0f);
anim3->SetCurrentTime(time);
@@ -659,10 +659,10 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
for (int i = 0; ((assoc = RpAnimBlendClumpGetMainPartialAssociation_N(ped->GetClump(), i))); i++)
assoc->SetBlend(0.0f, -1.0f);
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++) {
- if (state->aAnimId[i] == NUM_STD_ANIMS)
+ if (state->aAnimId[i] == ANIM_STD_NUM)
continue;
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
- state->aAnimId[i] > 3 ? (AssocGroupId)state->aGroupId[i] : ped->m_animGroup,
+ state->aAnimId[i] > ANIM_STD_IDLE ? (AssocGroupId)state->aGroupId[i] : ped->m_animGroup,
(AnimationId)state->aAnimId[i]);
anim->SetCurrentTime(state->aCurTime[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed[i] * 3.0f / 255.0f;
@@ -677,10 +677,10 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
for (int i = 0; i < NUM_PARTIAL_ANIMS_IN_REPLAY; i++) {
- if (state->aAnimId2[i] == NUM_STD_ANIMS)
+ if (state->aAnimId2[i] == ANIM_STD_NUM)
continue;
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
- state->aAnimId2[i] > 3 ? (AssocGroupId)state->aGroupId2[i] : ped->m_animGroup,
+ state->aAnimId2[i] > ANIM_STD_IDLE ? (AssocGroupId)state->aGroupId2[i] : ped->m_animGroup,
(AnimationId)state->aAnimId2[i]);
anim->SetCurrentTime(state->aCurTime2[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed2[i] * 3.0f / 255.0f;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 8ce2d84d..1bf94156 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -5165,7 +5165,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPlayer->m_pPed->m_pVehicleAnim->blendDelta = -1000.0f;
pPlayer->m_pPed->m_pVehicleAnim = nil;
pPlayer->m_pPed->SetMoveState(PEDMOVE_NONE);
- CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+ CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
pPlayer->m_pPed->RestartNonPartialAnims();
AudioManager.PlayerJustLeftCar();
pos.z += pPlayer->m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index d1dba350..4f443ad2 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -817,7 +817,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}
}
pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags;
- pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, NUM_STD_ANIMS, 0.0f);
+ pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, ANIM_STD_NUM, 0.0f);
}
}
}
@@ -834,7 +834,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->m_pVehicleAnim = nil;
pPed->RestartNonPartialAnims();
pPed->SetMoveState(PEDMOVE_NONE);
- CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+ CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel();
pPed->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, pPed);
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 502bc005..8354492e 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -2674,10 +2674,10 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
CPed* pPed = pPlayer->m_pPed;
if (pPed->InVehicle())
return IsVehicleStopped(pPed->m_pMyVehicle);
- if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP_R) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
+ if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP1) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP2) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_LAUNCH) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_GLIDE))
return false;
return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index 6dd6e281..de389a13 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -452,12 +452,12 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
if (GET_INTEGER_PARAM(1)) {
- pPed->bIsDucking = true;
+ pPed->bCrouchWhenShooting = true;
pPed->SetDuck(GET_INTEGER_PARAM(2), true);
}
else {
pPed->ClearDuck(true);
- pPed->bIsDucking = false;
+ pPed->bCrouchWhenShooting = false;
}
return 0;
}
@@ -771,7 +771,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CHud::SetHelpMessage(text, false, true); // + true
if (text != CHud::gLastPrintForeverString) {
CHud::gLastPrintForeverString = text;
- DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
+ DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
}
return 0;
}
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 8a1612fb..6c7cbe91 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -53,7 +53,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
((CPlayerPed*)pPed)->m_fMoveSpeed = 0.0f;
else
pPed->m_nStoredMoveState = PEDMOVE_STILL;
- CAnimManager::AddAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE);
+ CAnimManager::AddAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE);
pPed->bIsPedDieAnimPlaying = false;
}
return 0;
@@ -346,7 +346,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil);
+ UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_DUCK_DOWN) != nil);
return 0;
}
case COMMAND_CREATE_DUST_EFFECT_FOR_CUTSCENE_HELI:
diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp
index 3a68e239..42851bbc 100644
--- a/src/control/Script9.cpp
+++ b/src/control/Script9.cpp
@@ -453,8 +453,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
assert(pVehicle);
- pVehicle->ProcessOpenDoor(CAR_DOOR_RR, ANIM_VAN_OPEN, 1.0f);
- pVehicle->ProcessOpenDoor(CAR_DOOR_LR, ANIM_VAN_OPEN_L, 1.0f);
+ pVehicle->ProcessOpenDoor(CAR_DOOR_RR, ANIM_STD_VAN_OPEN_DOOR_REAR_RHS, 1.0f);
+ pVehicle->ProcessOpenDoor(CAR_DOOR_LR, ANIM_STD_VAN_OPEN_DOOR_REAR_LHS, 1.0f);
return 0;
}
case COMMAND_GET_CHAR_THREAT_CHAR:
diff --git a/src/control/SetPieces.cpp b/src/control/SetPieces.cpp
index 143115b8..0409a8bf 100644
--- a/src/control/SetPieces.cpp
+++ b/src/control/SetPieces.cpp
@@ -260,8 +260,8 @@ void CSetPiece::Update(void)
CCarAI::AddPoliceCarOccupants(pVehicle1);
CVehicle* pVehicle2 = TryToGenerateCopCar(m_vSpawn2, m_vTarget2);
if (!pVehicle2) {
- CWorld::Remove(pVehicle2);
- delete pVehicle2;
+ CWorld::Remove(pVehicle1);
+ delete pVehicle1;
return;
}
pVehicle2->SetStatus(STATUS_PHYSICS);