summaryrefslogtreecommitdiff
path: root/src/control/RoadBlocks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/RoadBlocks.cpp')
-rw-r--r--src/control/RoadBlocks.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index ed092391..e39fe481 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -1,7 +1,37 @@
#include "common.h"
#include "patcher.h"
#include "RoadBlocks.h"
+#include "PathFind.h"
+
+int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34;
+int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8;
+bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810;
-WRAPPER void CRoadBlocks::Init(void) { EAXJMP(0x436F50); }
WRAPPER void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle*, int32, int16) { EAXJMP(0x4376A0); }
-WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); } \ No newline at end of file
+WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); }
+
+void
+CRoadBlocks::Init(void)
+{
+ NumRoadBlocks = 0;
+ for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
+ if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
+ if (NumRoadBlocks < 600) {
+ InOrOut[NumRoadBlocks] = true;
+ RoadBlockObjects[NumRoadBlocks] = objId;
+ NumRoadBlocks++;
+ } else {
+#ifndef MASTER
+ printf("Not enough room for the potential roadblocks\n");
+#endif
+ // FIX: Don't iterate loop after NUMROADBLOCKS
+ return;
+ }
+ }
+ }
+
+}
+
+STARTPATCHES
+ InjectHook(0x436F50, &CRoadBlocks::Init, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file