summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/PathFind.cpp7
-rw-r--r--src/control/PathFind.h1
-rw-r--r--src/control/RoadBlocks.cpp10
3 files changed, 16 insertions, 2 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index f8bc2df6..81d87b05 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -1869,6 +1869,13 @@ CPathFind::TakeWidthIntoAccountForWandering(CPathNode* nextNode, uint16 random)
return CVector(newX, newY, pos.z);
}
+void
+CPathFind::TakeWidthIntoAccountForCoors(CPathNode* node1, CPathNode* node2, uint16 random, float* x, float* y)
+{
+ *x += (Min(node1->width, node2->width) * ((random % 16) - 7));
+ *y += (Min(node1->width, node2->width) * (((random / 16) % 16) - 7));
+}
+
CPathNode*
CPathFind::GetNode(int16 index)
{
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index 2896237a..013d9d31 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -255,6 +255,7 @@ public:
void Load(uint8 *buf, uint32 size);
static CVector TakeWidthIntoAccountForWandering(CPathNode*, uint16);
+ static void TakeWidthIntoAccountForCoors(CPathNode*, CPathNode*, uint16, float*, float*);
CPathNode *GetNode(int16 index);
int16 GetIndex(CPathNode *node);
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index e8630bde..e7831b82 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -92,10 +92,16 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
pCopPed->SetIdle();
pCopPed->bKindaStayInSamePlace = true;
pCopPed->bNotAllowedToDuck = false;
- pCopPed->bCrouchWhenShooting = roadBlockType != 2;
+ pCopPed->m_nExtendedRangeTimer = CTimer::GetTimeInMilliseconds() + 10000;
+ pCopPed->m_nRoadblockVeh = pVehicle;
+ pCopPed->m_nRoadblockVeh->RegisterReference((CEntity**)&pCopPed->m_nRoadblockVeh);
+ pCopPed->bCrouchWhenShooting = roadBlockType == 2 ? false : true;
if (pEntityToAttack) {
+ if (pCopPed->m_pPointGunAt)
+ pCopPed->m_pPointGunAt->CleanUpOldReference(&pCopPed->m_pPointGunAt);
pCopPed->m_pPointGunAt = pEntityToAttack;
- pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
+ if (pEntityToAttack)
+ pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
pCopPed->SetAttack(pEntityToAttack);
}
pCopPed->m_pMyVehicle = pVehicle;