summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-01-29 01:32:21 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-01-29 17:23:02 +0100
commitd52b917c549719addf45788413210ea1700cd0d5 (patch)
treefde2b07530985399054640435b638d00bbb4f10c /src
parentUpdate build-cmake-conan.yml (diff)
downloadre3-d52b917c549719addf45788413210ea1700cd0d5.tar
re3-d52b917c549719addf45788413210ea1700cd0d5.tar.gz
re3-d52b917c549719addf45788413210ea1700cd0d5.tar.bz2
re3-d52b917c549719addf45788413210ea1700cd0d5.tar.lz
re3-d52b917c549719addf45788413210ea1700cd0d5.tar.xz
re3-d52b917c549719addf45788413210ea1700cd0d5.tar.zst
re3-d52b917c549719addf45788413210ea1700cd0d5.zip
Diffstat (limited to 'src')
-rw-r--r--src/control/Garages.cpp8
-rw-r--r--src/core/Radar.cpp2
-rw-r--r--src/core/main.cpp5
-rw-r--r--src/peds/Ped.cpp2
-rw-r--r--src/skel/crossplatform.cpp8
5 files changed, 19 insertions, 6 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index afbae005..d6e36875 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -2034,7 +2034,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())
continue;
@@ -2052,7 +2056,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 || !pVehicle->IsCar())
continue;
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 116e9e94..4fd7f1a5 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -908,7 +908,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/core/main.cpp b/src/core/main.cpp
index 66cb5635..af0d556a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1110,8 +1110,13 @@ DisplayGameDebugText()
#endif // #ifdef DRAW_GAME_VERSION_TEXT
FrameSamples++;
+#ifdef FIX_BUGS
+ FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds
+ FramesPerSecond = FrameSamples / FramesPerSecondCounter;
+#else
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
+#endif
if ( FrameSamples > 30 )
{
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index a9529d2d..87e77ef3 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -1545,7 +1545,7 @@ CPed::ProcessBuoyancy(void)
CRGBA color(((0.5f * CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed()) * 127.5f),
((0.5f * CTimeCycle::GetDirectionalBlue() + CTimeCycle::GetAmbientBlue()) * 127.5f),
((0.5f * CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen()) * 127.5f),
- (CGeneral::GetRandomNumber() % 256 * 48.0f) + 48);
+ CGeneral::GetRandomNumberInRange(48.0f, 96.0f));
if (bInVehicle)
return;
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp
index f2f9d5ee..1d49ebd2 100644
--- a/src/skel/crossplatform.cpp
+++ b/src/skel/crossplatform.cpp
@@ -32,8 +32,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
char *folder = strtok(pathCopy, "*");
char *extension = strtok(NULL, "*");
- // because strtok doesn't return NULL for last delimiter
- if (extension - folder == strlen(pathname))
+ // because I remember like strtok might not return NULL for last delimiter
+ if (extension && extension - folder == strlen(pathname))
extension = nil;
// Case-sensitivity and backslashes...
@@ -187,7 +187,7 @@ char* casepath(char const* path, bool checkPathFirst)
rl = 1;
}
- bool cantProceed = false; // just convert slashes in what's left in string, not case sensitivity
+ bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't)
bool mayBeTrailingSlash = false;
char* c;
while (c = strsep(&p, "/\\"))
@@ -251,7 +251,7 @@ char* casepath(char const* path, bool checkPathFirst)
}
if (rl > l + 2) {
- printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%d chars)\n\tCorrected: %s (%d chars)\n\n", path, l, out, rl);
+ printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%zu chars)\n\tCorrected: %s (%zu chars)\n\n", path, l, out, rl);
}
return out;
}