diff --git a/src/openrct2/core/FileScanner.cpp b/src/openrct2/core/FileScanner.cpp index 5fbc8a16a0..7a5214e5a1 100644 --- a/src/openrct2/core/FileScanner.cpp +++ b/src/openrct2/core/FileScanner.cpp @@ -27,10 +27,8 @@ #include #include #elif defined(_WIN32) - extern "C" { - // Windows needs this for widechar <-> utf8 conversion utils - #include "../localisation/language.h" - } + // Windows needs this for widechar <-> utf8 conversion utils + #include "../localisation/language.h" #endif #include diff --git a/src/openrct2/drawing/Sprite.cpp b/src/openrct2/drawing/Sprite.cpp index 851a89028a..a0c7bc72c2 100644 --- a/src/openrct2/drawing/Sprite.cpp +++ b/src/openrct2/drawing/Sprite.cpp @@ -28,13 +28,10 @@ #include "../sprites.h" #include "../ui/UiContext.h" -extern "C" -{ - #include "../platform/platform.h" - #include "../rct2/addresses.h" - #include "../util/util.h" - #include "drawing.h" -} +#include "../platform/platform.h" +#include "../rct2/addresses.h" +#include "../util/util.h" +#include "drawing.h" using namespace OpenRCT2; using namespace OpenRCT2::Ui; diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 41c6ab3782..f41eac9b5c 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -53,7 +53,6 @@ sint32 _pickup_peep_old_x = SPRITE_LOCATION_NULL; #include "../ParkImporter.h" #include "../rct2/S6Exporter.h" -extern "C" { #include "../config/Config.h" #include "../game.h" #include "../interface/chat.h" @@ -69,7 +68,6 @@ extern "C" { #include "NetworkAction.h" #include // just for OpenSSL_add_all_algorithms() -} #pragma comment(lib, "Ws2_32.lib") diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 38280cce86..0fbc28eb5a 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -21,15 +21,12 @@ #include "../ui/UiContext.h" #include "Painter.h" -extern "C" -{ - #include "../drawing/drawing.h" - #include "../game.h" - #include "../interface/chat.h" - #include "../interface/console.h" - #include "../intro.h" - #include "../localisation/localisation.h" -} +#include "../drawing/drawing.h" +#include "../game.h" +#include "../interface/chat.h" +#include "../interface/console.h" +#include "../intro.h" +#include "../localisation/localisation.h" using namespace OpenRCT2; using namespace OpenRCT2::Drawing; diff --git a/src/openrct2/paint/supports.h b/src/openrct2/paint/supports.h index 4672eb20b5..6bef8dae67 100644 --- a/src/openrct2/paint/supports.h +++ b/src/openrct2/paint/supports.h @@ -20,6 +20,10 @@ #include "../common.h" #include "../world/footpath.h" +#ifdef __cplusplus +extern "C" { +#endif + bool wooden_a_supports_paint_setup(paint_session * session, sint32 supportType, sint32 special, sint32 height, uint32 imageColourFlags, bool* underground); bool wooden_b_supports_paint_setup(paint_session * session, sint32 supportType, sint32 special, sint32 height, uint32 imageColourFlags, bool* underground); bool metal_a_supports_paint_setup(paint_session * session, uint8 supportType, uint8 segment, sint32 special, sint32 height, uint32 imageColourFlags); @@ -44,4 +48,8 @@ enum { METAL_SUPPORTS_BOXED_COATED // Does not seem to be used in RCT2, but it was used in RCT1 for one of the path support types. }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/openrct2/platform/Platform2.cpp b/src/openrct2/platform/Platform2.cpp index 959d168bdd..758b00b90c 100644 --- a/src/openrct2/platform/Platform2.cpp +++ b/src/openrct2/platform/Platform2.cpp @@ -16,10 +16,7 @@ #include "Platform2.h" -extern "C" -{ - #include "platform.h" -} +#include "platform.h" namespace Platform { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 77dfd2a140..e4f25e82a9 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -35,33 +35,30 @@ #include "Tables.h" #include "../object_list.h" -extern "C" -{ - #include "../audio/audio.h" - #include "../cheats.h" - #include "../Editor.h" - #include "../game.h" - #include "../interface/window.h" - #include "../localisation/date.h" - #include "../localisation/localisation.h" - #include "../management/finance.h" - #include "../management/marketing.h" - #include "../object.h" - #include "../object/ObjectManager.h" - #include "../peep/peep.h" - #include "../peep/staff.h" - #include "../rct1.h" - #include "../ride/ride_data.h" - #include "../ride/track.h" - #include "../util/sawyercoding.h" - #include "../util/util.h" - #include "../world/Climate.h" - #include "../world/footpath.h" - #include "../world/map_animation.h" - #include "../world/park.h" - #include "../world/entrance.h" - #include "../world/scenery.h" -} +#include "../audio/audio.h" +#include "../cheats.h" +#include "../Editor.h" +#include "../game.h" +#include "../interface/window.h" +#include "../localisation/date.h" +#include "../localisation/localisation.h" +#include "../management/finance.h" +#include "../management/marketing.h" +#include "../object.h" +#include "../object/ObjectManager.h" +#include "../peep/peep.h" +#include "../peep/staff.h" +#include "../rct1.h" +#include "../ride/ride_data.h" +#include "../ride/track.h" +#include "../util/sawyercoding.h" +#include "../util/util.h" +#include "../world/Climate.h" +#include "../world/footpath.h" +#include "../world/map_animation.h" +#include "../world/park.h" +#include "../world/entrance.h" +#include "../world/scenery.h" class EntryList { diff --git a/src/openrct2/rct1/Tables.cpp b/src/openrct2/rct1/Tables.cpp index 7b195ae96e..74fa44117b 100644 --- a/src/openrct2/rct1/Tables.cpp +++ b/src/openrct2/rct1/Tables.cpp @@ -19,12 +19,9 @@ #include "../core/Util.hpp" #include "Tables.h" -extern "C" -{ - #include "../interface/colour.h" - #include "../rct1.h" - #include "../ride/ride.h" -} +#include "../interface/colour.h" +#include "../rct1.h" +#include "../ride/ride.h" namespace RCT1 { diff --git a/src/openrct2/rct12/SawyerChunkReader.cpp b/src/openrct2/rct12/SawyerChunkReader.cpp index a3588446fa..db2919f34a 100644 --- a/src/openrct2/rct12/SawyerChunkReader.cpp +++ b/src/openrct2/rct12/SawyerChunkReader.cpp @@ -19,10 +19,7 @@ #include "../core/Math.hpp" #include "SawyerChunkReader.h" -extern "C" -{ - #include "../util/sawyercoding.h" -} +#include "../util/sawyercoding.h" // Allow chunks to be uncompressed to a maximum of 16 MiB constexpr size_t MAX_UNCOMPRESSED_CHUNK_SIZE = 16 * 1024 * 1024; diff --git a/src/openrct2/rct12/SawyerChunkWriter.cpp b/src/openrct2/rct12/SawyerChunkWriter.cpp index e3a08d7233..d02d335dfd 100644 --- a/src/openrct2/rct12/SawyerChunkWriter.cpp +++ b/src/openrct2/rct12/SawyerChunkWriter.cpp @@ -19,10 +19,7 @@ #include "../core/Math.hpp" #include "SawyerChunkWriter.h" -extern "C" -{ - #include "../util/sawyercoding.h" -} +#include "../util/sawyercoding.h" // Maximum buffer size to store compressed data, maximum of 16 MiB constexpr size_t MAX_COMPRESSED_CHUNK_SIZE = 16 * 1024 * 1024; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 0e879864c7..bd4b29b59a 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -27,32 +27,29 @@ #include "S6Exporter.h" #include -extern "C" -{ - #include "../config/Config.h" - #include "../game.h" - #include "../interface/viewport.h" - #include "../interface/window.h" - #include "../localisation/date.h" - #include "../localisation/localisation.h" - #include "../management/finance.h" - #include "../management/marketing.h" - #include "../management/news_item.h" - #include "../management/research.h" - #include "../object.h" - #include "../OpenRCT2.h" - #include "../peep/staff.h" - #include "../ride/ride.h" - #include "../ride/ride_ratings.h" - #include "../ride/track_data.h" - #include "../scenario/scenario.h" - #include "../util/sawyercoding.h" - #include "../util/util.h" - #include "../world/Climate.h" - #include "../world/map_animation.h" - #include "../world/park.h" - #include "../world/sprite.h" -} +#include "../config/Config.h" +#include "../game.h" +#include "../interface/viewport.h" +#include "../interface/window.h" +#include "../localisation/date.h" +#include "../localisation/localisation.h" +#include "../management/finance.h" +#include "../management/marketing.h" +#include "../management/news_item.h" +#include "../management/research.h" +#include "../object.h" +#include "../OpenRCT2.h" +#include "../peep/staff.h" +#include "../ride/ride.h" +#include "../ride/ride_ratings.h" +#include "../ride/track_data.h" +#include "../scenario/scenario.h" +#include "../util/sawyercoding.h" +#include "../util/util.h" +#include "../world/Climate.h" +#include "../world/map_animation.h" +#include "../world/park.h" +#include "../world/sprite.h" S6Exporter::S6Exporter() { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index a7a83f7079..c85816f78d 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -30,28 +30,25 @@ #include "../rct12/SawyerEncoding.h" #include "../ride/station.h" -extern "C" -{ - #include "../config/Config.h" - #include "../game.h" - #include "../interface/viewport.h" - #include "../localisation/date.h" - #include "../localisation/localisation.h" - #include "../management/finance.h" - #include "../management/marketing.h" - #include "../management/news_item.h" - #include "../management/research.h" - #include "../OpenRCT2.h" - #include "../peep/staff.h" - #include "../ride/ride.h" - #include "../ride/ride_ratings.h" - #include "../scenario/scenario.h" - #include "../util/sawyercoding.h" - #include "../world/Climate.h" - #include "../world/entrance.h" - #include "../world/map_animation.h" - #include "../world/park.h" -} +#include "../config/Config.h" +#include "../game.h" +#include "../interface/viewport.h" +#include "../localisation/date.h" +#include "../localisation/localisation.h" +#include "../management/finance.h" +#include "../management/marketing.h" +#include "../management/news_item.h" +#include "../management/research.h" +#include "../OpenRCT2.h" +#include "../peep/staff.h" +#include "../ride/ride.h" +#include "../ride/ride_ratings.h" +#include "../scenario/scenario.h" +#include "../util/sawyercoding.h" +#include "../world/Climate.h" +#include "../world/entrance.h" +#include "../world/map_animation.h" +#include "../world/park.h" class ObjectLoadException : public Exception { diff --git a/src/openrct2/rct2/hook.h b/src/openrct2/rct2/hook.h index 5e40f2121b..ddc17001c2 100644 --- a/src/openrct2/rct2/hook.h +++ b/src/openrct2/rct2/hook.h @@ -33,8 +33,16 @@ enum { typedef uint8 (hook_function)(registers *regs); +#ifdef __cplusplus +extern "C" { +#endif + void addhook(uintptr_t address, hook_function *function); +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/openrct2/ride/RideGroupManager.cpp b/src/openrct2/ride/RideGroupManager.cpp index ea942ab6e3..0ac7a04c45 100644 --- a/src/openrct2/ride/RideGroupManager.cpp +++ b/src/openrct2/ride/RideGroupManager.cpp @@ -20,15 +20,12 @@ #include "../config/Config.h" #include "../core/String.hpp" -extern "C" -{ - #include "../localisation/string_ids.h" - #include "../management/research.h" - #include "ride.h" - #include "ride_data.h" - #include "track.h" - #include "track_data.h" -} +#include "../localisation/string_ids.h" +#include "../management/research.h" +#include "ride.h" +#include "ride_data.h" +#include "track.h" +#include "track_data.h" class RideGroupManager final : public IRideGroupManager { diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 5c35136ca9..41f816c50f 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -23,25 +23,22 @@ #include "../rct1/Tables.h" #include "TrackDesignRepository.h" -extern "C" -{ - #include "../audio/audio.h" - #include "../cheats.h" - #include "../game.h" - #include "../localisation/localisation.h" - #include "../localisation/string_ids.h" - #include "../management/finance.h" - #include "../rct1.h" - #include "../util/sawyercoding.h" - #include "../util/util.h" - #include "../world/footpath.h" - #include "../world/scenery.h" - #include "ride.h" - #include "ride_data.h" - #include "track.h" - #include "track_data.h" - #include "TrackDesign.h" -} +#include "../audio/audio.h" +#include "../cheats.h" +#include "../game.h" +#include "../localisation/localisation.h" +#include "../localisation/string_ids.h" +#include "../management/finance.h" +#include "../rct1.h" +#include "../util/sawyercoding.h" +#include "../util/util.h" +#include "../world/footpath.h" +#include "../world/scenery.h" +#include "ride.h" +#include "ride_data.h" +#include "track.h" +#include "track_data.h" +#include "TrackDesign.h" typedef struct map_backup { diff --git a/test/testpaint/FunctionCall.cpp b/test/testpaint/FunctionCall.cpp index 2c4f02d19a..bb558ccc8a 100644 --- a/test/testpaint/FunctionCall.cpp +++ b/test/testpaint/FunctionCall.cpp @@ -16,9 +16,7 @@ #include "FunctionCall.hpp" -extern "C" { #include -} enum SpriteGroup { SPRITEGROUP_NONE, diff --git a/test/testpaint/PaintIntercept.cpp b/test/testpaint/PaintIntercept.cpp index 4b7d484603..1ff5315d0d 100644 --- a/test/testpaint/PaintIntercept.cpp +++ b/test/testpaint/PaintIntercept.cpp @@ -18,13 +18,11 @@ #include "PaintIntercept.hpp" #include "FunctionCall.hpp" -extern "C" { #include #include #include #include #include -} paint_session gPaintSession; diff --git a/test/testpaint/Printer.cpp b/test/testpaint/Printer.cpp index 2ac7a7e83b..f6b3b75f84 100644 --- a/test/testpaint/Printer.cpp +++ b/test/testpaint/Printer.cpp @@ -19,9 +19,7 @@ #include #include "FunctionCall.hpp" -extern "C" { #include -} namespace Printer { diff --git a/test/testpaint/SegmentSupportHeightCall.cpp b/test/testpaint/SegmentSupportHeightCall.cpp index e4cdc88134..a9e21083bd 100644 --- a/test/testpaint/SegmentSupportHeightCall.cpp +++ b/test/testpaint/SegmentSupportHeightCall.cpp @@ -19,9 +19,7 @@ #include "SegmentSupportHeightCall.hpp" -extern "C" { #include -} static bool SortSegmentSupportCalls(SegmentSupportCall lhs, SegmentSupportCall rhs) { diff --git a/test/testpaint/TestPaint.cpp b/test/testpaint/TestPaint.cpp index 6dec3d5adc..9fdb03a6df 100644 --- a/test/testpaint/TestPaint.cpp +++ b/test/testpaint/TestPaint.cpp @@ -23,13 +23,11 @@ #include "TestPaint.hpp" #include "Utils.hpp" -extern "C" { - #include - #include - #include - #include - #include -} +#include +#include +#include +#include +#include namespace TestPaint { diff --git a/test/testpaint/TestTrack.cpp b/test/testpaint/TestTrack.cpp index 3b498085ac..9c7b01adfe 100644 --- a/test/testpaint/TestTrack.cpp +++ b/test/testpaint/TestTrack.cpp @@ -29,13 +29,11 @@ #include "Utils.hpp" #include "VerticalTunnelCall.hpp" -extern "C" { #include #include #include #include #include -} interface ITestTrackFilter { public: diff --git a/test/testpaint/Utils.cpp b/test/testpaint/Utils.cpp index d444bfa89e..9fc37d9d15 100644 --- a/test/testpaint/Utils.cpp +++ b/test/testpaint/Utils.cpp @@ -16,11 +16,9 @@ #include "Utils.hpp" -extern "C" { - #include - #include - #include -} +#include +#include +#include namespace Utils { int getTrackSequenceCount(uint8 rideType, uint8 trackType) { diff --git a/test/testpaint/generate.cpp b/test/testpaint/generate.cpp index 1c51dad5ad..67823726ff 100644 --- a/test/testpaint/generate.cpp +++ b/test/testpaint/generate.cpp @@ -26,16 +26,13 @@ #include "String.hpp" #include "Utils.hpp" -extern "C" -{ - #include "data.h" - #include - #include - #include - #include - #include - #include -} +#include "data.h" +#include +#include +#include +#include +#include +#include class PaintCodeGenerator { diff --git a/test/testpaint/main.cpp b/test/testpaint/main.cpp index 03476e67f7..4ede1e36d8 100644 --- a/test/testpaint/main.cpp +++ b/test/testpaint/main.cpp @@ -28,14 +28,12 @@ #include "TestTrack.hpp" #include "Utils.hpp" -extern "C" { #include "data.h" #include #include #include #include #include -} typedef struct { uint8 rideType; diff --git a/test/tests/IniWriterTest.cpp b/test/tests/IniWriterTest.cpp index a7dfac6fbd..19a7b10445 100644 --- a/test/tests/IniWriterTest.cpp +++ b/test/tests/IniWriterTest.cpp @@ -4,10 +4,7 @@ #include "openrct2/config/IniWriter.hpp" #include "openrct2/core/MemoryStream.h" -extern "C" -{ - #include "openrct2/platform/platform.h" -} +#include "openrct2/platform/platform.h" class IniWriterTest : public testing::Test { diff --git a/test/tests/MultiLaunch.cpp b/test/tests/MultiLaunch.cpp index 0219422678..ff51e9f139 100644 --- a/test/tests/MultiLaunch.cpp +++ b/test/tests/MultiLaunch.cpp @@ -9,11 +9,8 @@ #include #include "TestData.h" -extern "C" -{ - #include - #include -} +#include +#include using namespace OpenRCT2; diff --git a/test/tests/RideRatings.cpp b/test/tests/RideRatings.cpp index 19a65df84e..ac4a860fbd 100644 --- a/test/tests/RideRatings.cpp +++ b/test/tests/RideRatings.cpp @@ -8,11 +8,8 @@ #include #include "TestData.h" -extern "C" -{ - #include - #include -} +#include +#include using namespace OpenRCT2;