Move speed literal _mph to Speed.hpp (#22033)

This commit is contained in:
Aaron van Geffen authored and GitHub committed 2024-05-14 17:04:49 +00:00
1 parent 3c35558f3f
commit 308219d32e
6 files changed
+24 -8

No files matched your search

-8
View File
@@ -105,14 +105,6 @@ constexpr money64 ToMoney64(money16 value)
return value == kMoney16Undefined ? kMoney64Undefined : value;
}
// Note: Only valid for 5 decimal places.
constexpr int32_t operator"" _mph(long double speedMph)
{
uint32_t wholeNumber = speedMph;
uint64_t fraction = (speedMph - wholeNumber) * 100000;
return wholeNumber << 16 | ((fraction << 16) / 100000);
}
using StringId = uint16_t;
#define abstract = 0
+20
View File
@@ -0,0 +1,20 @@
/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include <cstdint>
// Note: Only valid for 5 decimal places.
constexpr int32_t operator"" _mph(long double speedMph)
{
uint32_t wholeNumber = speedMph;
uint64_t fraction = (speedMph - wholeNumber) * 100000;
return wholeNumber << 16 | ((fraction << 16) / 100000);
}
+1
View File
@@ -218,6 +218,7 @@
<ClInclude Include="core\Range.hpp" />
<ClInclude Include="core\RTL.h" />
<ClInclude Include="core\FixedVector.h" />
<ClInclude Include="core\Speed.hpp" />
<ClInclude Include="core\String.hpp" />
<ClInclude Include="core\StringBuilder.h" />
<ClInclude Include="core\StringReader.h" />
+1
View File
@@ -20,6 +20,7 @@
#include "../audio/audio.h"
#include "../config/Config.h"
#include "../core/Memory.hpp"
#include "../core/Speed.hpp"
#include "../entity/EntityRegistry.h"
#include "../entity/Particle.h"
#include "../entity/Yaw.hpp"
+1
View File
@@ -11,6 +11,7 @@
#include "../Game.h"
#include "../GameState.h"
#include "../core/Speed.hpp"
#include "../drawing/Drawing.h"
#include "../drawing/LightFX.h"
#include "../entity/EntityRegistry.h"
@@ -7,6 +7,7 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../core/Speed.hpp"
#include "../entity/EntityRegistry.h"
#include "Vehicle.h"