diff --git a/scripts/build b/scripts/build index 076909ecee..c1dbe3a00a 100755 --- a/scripts/build +++ b/scripts/build @@ -26,7 +26,7 @@ if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then # Build everything echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m" - vstool msbuild openrct2.proj -t:build -p:Breakpad=true + vstool msbuild openrct2.proj -t:build -p:Breakpad=true -p:UsePCH=true # Create openrct2.exe and openrct2.com with correct subsystem cp bin/openrct2.exe bin/openrct2.com diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index e85e1b3d88..70eaf2c83e 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -1175,7 +1175,7 @@ namespace OpenRCT2 // TODO: This variable has been never "variable" in time, some code expects // this to be 40Hz (25 ms). Refactor this once the UI is decoupled. - gCurrentDeltaTime = static_cast(GAME_UPDATE_TIME_MS * 1000.0f); + gCurrentDeltaTime = static_cast(GAME_UPDATE_TIME_MS * 1000.0f); if (GameIsNotPaused()) { diff --git a/src/openrct2/common.h b/src/openrct2/common.h index 0038928dba..b9ecf06a39 100644 --- a/src/openrct2/common.h +++ b/src/openrct2/common.h @@ -11,6 +11,11 @@ #undef M_PI +// Ignore isatty warning on WIN32 +#ifndef _CRT_NONSTDC_NO_WARNINGS +# define _CRT_NONSTDC_NO_WARNINGS +#endif + #ifdef _MSC_VER # include #endif diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 6d3186db63..3033fbb88a 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -381,11 +381,11 @@ void LightFXPrepareLightList() continue; } - entry->LightIntensity = std::min( - 0xFF, (entry->LightIntensity * lightIntensityOccluded) / (totalSamplePoints * 100)); + entry->LightIntensity = static_cast( + std::min(0xFF, (entry->LightIntensity * lightIntensityOccluded) / (totalSamplePoints * 100))); } - entry->LightIntensity = std::max( - 0x00, entry->LightIntensity - static_cast(_current_view_zoom_front) * 5); + entry->LightIntensity = static_cast( + std::max(0x00, entry->LightIntensity - static_cast(_current_view_zoom_front) * 5)); if (_current_view_zoom_front > ZoomLevel{ 0 }) { @@ -1012,7 +1012,7 @@ static uint8_t MixLight(uint32_t a, uint32_t b, uint32_t intensity) intensity = intensity * 6; uint32_t bMul = (b * intensity) >> 8; uint32_t ab = a + bMul; - uint8_t result = std::min(255, ab); + uint8_t result = static_cast(std::min(255, ab)); return result; } diff --git a/src/openrct2/interface/StdInOutConsole.cpp b/src/openrct2/interface/StdInOutConsole.cpp index 23b84349eb..bd64b005c1 100644 --- a/src/openrct2/interface/StdInOutConsole.cpp +++ b/src/openrct2/interface/StdInOutConsole.cpp @@ -7,11 +7,6 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -// Ignore isatty warning on WIN32 -#ifndef _CRT_NONSTDC_NO_WARNINGS -# define _CRT_NONSTDC_NO_WARNINGS -#endif - #include "../Context.h" #include "../OpenRCT2.h" #include "../platform/Platform.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 51a3fccbb8..90fe33c23f 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -54,6 +54,9 @@ __ENABLE_DISCORD__;USE_BENCHMARK;%(PreprocessorDefinitions) USE_BREAKPAD;%(PreprocessorDefinitions) USE_FRIBIDI;%(PreprocessorDefinitions) + Use + openrct2_pch.h + openrct2_pch.h @@ -348,6 +351,7 @@ + @@ -840,6 +844,9 @@ + + Create + @@ -1039,6 +1046,8 @@ + NotUsing + TurnOffAllWarnings diff --git a/src/openrct2/openrct2_pch.cpp b/src/openrct2/openrct2_pch.cpp new file mode 100644 index 0000000000..f59bda8635 --- /dev/null +++ b/src/openrct2/openrct2_pch.cpp @@ -0,0 +1,2 @@ +// Empty file for MSVC's PCH +// Do not include the header file - it is set up with MSVC solution diff --git a/src/openrct2/openrct2_pch.h b/src/openrct2/openrct2_pch.h new file mode 100644 index 0000000000..58c125034e --- /dev/null +++ b/src/openrct2/openrct2_pch.h @@ -0,0 +1,9 @@ +#pragma once + +// Include some expensive headers here to improve compilation speed + +#include "common.h" +#include "core/FileSystem.hpp" +#include "object/Object.h" +#include "rct2/RCT2.h" +#include "ride/Ride.h"