summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-01-29 01:44:12 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-01-29 17:16:26 +0100
commitc4328afce7e2a0b48b9d0d2b225496e29fff1c0a (patch)
treecbed53aea63f025992b16be9b8ad1d13097df20b
parentFix some UBs (diff)
downloadre3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar.gz
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar.bz2
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar.lz
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar.xz
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.tar.zst
re3-c4328afce7e2a0b48b9d0d2b225496e29fff1c0a.zip
-rw-r--r--src/control/Garages.cpp8
-rw-r--r--src/core/Frontend.cpp2
-rw-r--r--src/core/Radar.cpp2
-rw-r--r--src/peds/Ped.cpp2
4 files changed, 11 insertions, 3 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index e3b5aa8c..333f3a6f 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1997,7 +1997,11 @@ float CGarages::FindDoorHeightForMI(int32 mi)
void CGarage::TidyUpGarage()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (pVehicle && (pVehicle->IsCar() || pVehicle->IsBike())) {
if (IsPointInsideGarage(pVehicle->GetPosition())) {
@@ -2013,7 +2017,11 @@ void CGarage::TidyUpGarage()
void CGarage::TidyUpGarageClose()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle)
continue;
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index f38efb66..16a70697 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -5582,7 +5582,7 @@ CMenuManager::DrawQuitGameScreen(void)
}
#else
static PauseModeTime firstTick = CTimer::GetTimeInMillisecondsPauseMode();
- if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - firstTick > 1000) {
+ if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - firstTick > 750) {
exitSignalTimer = 150;
}
#endif
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 8cd86344..4bb9c966 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -824,7 +824,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i)
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{
- int32 c;
+ uint32 c;
switch (color) {
case RADAR_TRACE_RED:
if (bright)
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 6a3df18b..cec88580 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -1609,7 +1609,7 @@ CPed::ProcessBuoyancy(void)
color.r = (0.5f * CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed()) * 127.5f;
color.g = (0.5f * CTimeCycle::GetDirectionalBlue() + CTimeCycle::GetAmbientBlue()) * 127.5f;
color.b = (0.5f * CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen()) * 127.5f;
- color.a = (CGeneral::GetRandomNumber() % 256 * 48.0f) + 48;
+ color.a = CGeneral::GetRandomNumberInRange(48.0f, 96.0f);
bIsInWater = true;
ApplyMoveForce(buoyancyImpulse);
if (!DyingOrDead()) {