Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
This commit is contained in:
@@ -40,10 +40,10 @@ void Timer::advanceTime()
|
||||
accumMs += passedMs;
|
||||
if (accumMs > 1000)
|
||||
{
|
||||
int64_t msSysTime = (int64_t)(now * 1000.0);
|
||||
int64_t passedMsSysTime = msSysTime - lastMsSysTime;
|
||||
const int64_t msSysTime = static_cast<int64_t>(now * 1000.0);
|
||||
const int64_t passedMsSysTime = msSysTime - lastMsSysTime;
|
||||
|
||||
double adjustTimeT = accumMs / (double) passedMsSysTime;
|
||||
const double adjustTimeT = accumMs / static_cast<double>(passedMsSysTime);
|
||||
adjustTime += (adjustTimeT - adjustTime) * 0.2f;
|
||||
|
||||
lastMsSysTime = msSysTime;
|
||||
@@ -51,7 +51,7 @@ void Timer::advanceTime()
|
||||
}
|
||||
if (accumMs < 0)
|
||||
{
|
||||
lastMsSysTime = (int64_t)(now * 1000.0);
|
||||
lastMsSysTime = static_cast<int64_t>(now * 1000.0);
|
||||
}
|
||||
}
|
||||
lastMs = nowMs;
|
||||
@@ -62,9 +62,9 @@ void Timer::advanceTime()
|
||||
if (passedSeconds < 0) passedSeconds = 0;
|
||||
if (passedSeconds > 1) passedSeconds = 1;
|
||||
|
||||
passedTime = (float)( passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
passedTime = static_cast<float>(passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
|
||||
ticks = (int) passedTime;
|
||||
ticks = static_cast<int>(passedTime);
|
||||
passedTime -= ticks;
|
||||
|
||||
if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE;
|
||||
@@ -75,10 +75,10 @@ void Timer::advanceTime()
|
||||
void Timer::advanceTimeQuickly()
|
||||
{
|
||||
|
||||
double passedSeconds = (double) MAX_TICKS_PER_UPDATE / (double) ticksPerSecond;
|
||||
double passedSeconds = static_cast<double>(MAX_TICKS_PER_UPDATE) / static_cast<double>(ticksPerSecond);
|
||||
|
||||
passedTime = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
ticks = (int) passedTime;
|
||||
passedTime = static_cast<float>(passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
ticks = static_cast<int>(passedTime);
|
||||
passedTime -= ticks;
|
||||
a = passedTime;
|
||||
|
||||
@@ -110,7 +110,7 @@ void Timer::skipTime()
|
||||
{
|
||||
int64_t passedMsSysTime = msSysTime - lastMsSysTime;
|
||||
|
||||
double adjustTimeT = accumMs / (double) passedMsSysTime;
|
||||
double adjustTimeT = accumMs / static_cast<double>(passedMsSysTime);
|
||||
adjustTime += (adjustTimeT - adjustTime) * 0.2f;
|
||||
|
||||
lastMsSysTime = msSysTime;
|
||||
@@ -130,9 +130,9 @@ void Timer::skipTime()
|
||||
if (passedSeconds < 0) passedSeconds = 0;
|
||||
if (passedSeconds > 1) passedSeconds = 1;
|
||||
|
||||
passedTime = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
passedTime = static_cast<float>(passedTime + (passedSeconds * timeScale * ticksPerSecond));
|
||||
|
||||
ticks = (int) 0;
|
||||
ticks = static_cast<int>(0);
|
||||
if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE;
|
||||
passedTime -= ticks;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user