summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/AccidentManager.cpp59
-rw-r--r--src/control/CarAI.cpp2
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/core/Accident.h (renamed from src/control/AccidentManager.h)7
4 files changed, 7 insertions, 63 deletions
diff --git a/src/control/AccidentManager.cpp b/src/control/AccidentManager.cpp
deleted file mode 100644
index a42280b7..00000000
--- a/src/control/AccidentManager.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "AccidentManager.h"
-
-#include "Ped.h"
-
-CAccidentManager& gAccidentManager = *(CAccidentManager*)0x87FD10;
-
-WRAPPER void CAccidentManager::Update(void) { EAXJMP(0x456710); }
-
-uint16
-CAccidentManager::CountActiveAccidents()
-{
- uint16 accidents = 0;
- for (int i = 0; i < NUM_ACCIDENTS; i++){
- if (m_aAccidents[i].m_pVictim)
- accidents++;
- }
- return accidents;
-}
-
-CAccident*
-CAccidentManager::FindNearestAccident(CVector vecPos, float* pDistance)
-{
- for (int i = 0; i < MAX_MEDICS_TO_ATTEND_ACCIDENT; i++){
- int accidentId = -1;
- float minDistance = 999999;
- for (int j = 0; j < NUM_ACCIDENTS; j++){
- CPed* pVictim = m_aAccidents[j].m_pVictim;
- if (!pVictim)
- continue;
- if (pVictim->CharCreatedBy == MISSION_CHAR)
- continue;
- if (pVictim->m_fHealth != 0.0f)
- continue;
- if (m_aAccidents[j].m_nMedicsPerformingCPR != i)
- continue;
- float distance = (pVictim->GetPosition() - vecPos).Magnitude2D();
- if (distance / 2 > pVictim->GetPosition().z - vecPos.z && distance < minDistance){
- minDistance = distance;
- accidentId = j;
- }
- }
- *pDistance = minDistance;
- if (accidentId != -1)
- return &m_aAccidents[accidentId];
- }
- return nil;
-}
-
-bool
-CAccidentManager::UnattendedAccidents(void)
-{
- for (int i = 0; i < NUM_ACCIDENTS; i++) {
- if (m_aAccidents[i].m_pVictim && m_aAccidents[i].m_nMedicsAttending == 0)
- return true;
- }
- return false;
-} \ No newline at end of file
diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp
index b4dd8777..6032c51f 100644
--- a/src/control/CarAI.cpp
+++ b/src/control/CarAI.cpp
@@ -2,7 +2,7 @@
#include "patcher.h"
#include "CarAI.h"
-#include "AccidentManager.h"
+#include "Accident.h"
#include "AutoPilot.h"
#include "CarCtrl.h"
#include "General.h"
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 80cb8211..cd657815 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2,7 +2,7 @@
#include "patcher.h"
#include "CarCtrl.h"
-#include "AccidentManager.h"
+#include "Accident.h"
#include "Automobile.h"
#include "Camera.h"
#include "CarAI.h"
diff --git a/src/control/AccidentManager.h b/src/core/Accident.h
index 6a3088e7..69889645 100644
--- a/src/control/AccidentManager.h
+++ b/src/core/Accident.h
@@ -20,10 +20,13 @@ class CAccidentManager
MAX_MEDICS_TO_ATTEND_ACCIDENT = 2
};
public:
+ CAccident *GetNextFreeAccident();
+ void ReportAccident(CPed *ped);
+ void Update();
+ CAccident *FindNearestAccident(CVector vecPos, float *pDistance);
uint16 CountActiveAccidents();
bool UnattendedAccidents();
- CAccident* FindNearestAccident(CVector, float*);
- void Update(void);
+ bool WorkToDoForMedics();
};
extern CAccidentManager& gAccidentManager; \ No newline at end of file