summaryrefslogtreecommitdiffstats
path: root/src/core/Fire.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-09-15 09:36:38 +0200
committerGitHub <noreply@github.com>2019-09-15 09:36:38 +0200
commitca6d2d3181c740d98205ea3fd0f20e87ea52ddc3 (patch)
tree6e3b9e8bb1f43b4952ed5f4910e3d7f05d47037f /src/core/Fire.cpp
parentMerge pull request #207 from Nick007J/master (diff)
parentMerge branch 'carctrl_dev' (diff)
downloadre3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.gz
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.bz2
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.lz
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.xz
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.tar.zst
re3-ca6d2d3181c740d98205ea3fd0f20e87ea52ddc3.zip
Diffstat (limited to '')
-rw-r--r--src/core/Fire.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index a2894d43..2181f91c 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -6,5 +6,30 @@ CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
+CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance)
+{
+ for (int i = 0; i < MAX_FIREMEN_ATTENDING; i++) {
+ int fireId = -1;
+ float minDistance = 999999;
+ for (int j = 0; j < NUM_FIRES; j++) {
+ if (!m_aFires[j].m_bIsOngoing)
+ continue;
+ if (m_aFires[j].m_bIsScriptFire)
+ continue;
+ if (m_aFires[j].m_nFiremenPuttingOut != i)
+ continue;
+ float distance = (m_aFires[j].m_vecPos - vecPos).Magnitude2D();
+ if (distance < minDistance) {
+ minDistance = distance;
+ fireId = j;
+ }
+ }
+ *pDistance = minDistance;
+ if (fireId != -1)
+ return &m_aFires[fireId];
+ }
+ return nil;
+}
+
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }