summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2021-01-31 20:44:39 +0100
committerFilip Gawin <filip.gawin@zoho.com>2021-01-31 20:44:39 +0100
commit7a3b80a9b7f414967fe59f89ab0fe5416735babe (patch)
treea84fb5e1dbdb00959d6916594d43b9c82c9bef23 /src/control
parentfix realloc (diff)
downloadre3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.gz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.bz2
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.lz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.xz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.zst
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Pickups.cpp9
-rw-r--r--src/control/Script.cpp9
-rw-r--r--src/control/Script4.cpp9
-rw-r--r--src/control/Script6.cpp6
4 files changed, 26 insertions, 7 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 96a8a670..8318bc1a 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -814,6 +814,9 @@ void
CPickups::RenderPickUpText()
{
wchar *strToPrint;
+#ifdef FIX_BUGS
+ strToPrint = nil;
+#endif
for (int32 i = 0; i < NumMessages; i++) {
if (aMessages[i].m_quantity <= 39) {
switch (aMessages[i].m_quantity) // could use some enum maybe
@@ -1285,7 +1288,11 @@ CPacManPickups::GeneratePMPickUpsForRace(int32 race)
int i = 0;
if (race == 0) pPos = aRacePoints1; // there's only one available
- assert(pPos != nil);
+
+ if(!pPos) {
+ debug("This shouldn't happen");
+ return;
+ }
while (!pPos->IsZero()) {
while (aPMPickUps[i].m_eType != PACMAN_NONE)
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index e70bd508..83f43276 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -3439,8 +3439,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
}
else {
CVehicle* car;
- if (!CModelInfo::IsBikeModel(ScriptParams[0]))
- car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
+ if(!CModelInfo::IsBikeModel(ScriptParams[0])) car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
+#ifdef FIX_BUGS
+ else {
+ debug("This shouldn't happen");
+ return 0;
+ }
+#endif
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 40f9f2f1..740a8e2e 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -1817,8 +1817,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
if (model == -1)
return 0;
CVehicle* car;
- if (!CModelInfo::IsBikeModel(model))
- car = new CAutomobile(model, RANDOM_VEHICLE);
+ if(!CModelInfo::IsBikeModel(model)) car = new CAutomobile(model, RANDOM_VEHICLE);
+#ifdef FIX_BUGS
+ else {
+ debug("This shouldn't happen");
+ return 0;
+ }
+#endif
CVector pos = *(CVector*)&ScriptParams[0];
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->SetPosition(pos);
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 31be6987..f8e2d8f1 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -971,8 +971,10 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pClosestEntity = apEntities[i];
}
}
- if (pClosestEntity->IsDummy())
- pClosestEntity = nil;
+#ifdef FIX_BUGS
+ if(pClosestEntity)
+#endif
+ if(pClosestEntity->IsDummy()) pClosestEntity = nil;
}
if (pClosestEntity) {
script_assert(pClosestEntity->IsObject());