From 9bd812c855c33c0b6bbc551a24d1f08730f2a083 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Fri, 2 Feb 2018 23:11:41 +0100 Subject: [PATCH] Move most of _legacy.c to C++ (#7117) --- OpenRCT2.xcodeproj/project.pbxproj | 22 ++++--- .../windows/EditorInventionsList.cpp | 2 +- src/openrct2/EditorObjectSelectionSession.cpp | 2 +- src/openrct2/object/DefaultObjects.cpp | 64 ++++++++++++++++++ .../_legacy.h => object/DefaultObjects.h} | 17 +---- src/openrct2/object/Object.h | 10 ++- src/openrct2/ride/TrackDesign.cpp | 5 +- .../windows/{_legacy.c => _legacy.cpp} | 65 +++---------------- 8 files changed, 101 insertions(+), 86 deletions(-) create mode 100644 src/openrct2/object/DefaultObjects.cpp rename src/openrct2/{windows/_legacy.h => object/DefaultObjects.h} (79%) rename src/openrct2/windows/{_legacy.c => _legacy.cpp} (86%) diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index 9da1d15ae4..decb9ca31f 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -105,10 +105,10 @@ 4C7B545C20079C4000A52E21 /* Addresses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B545720079C4000A52E21 /* Addresses.cpp */; }; 4C7B545E20079C4000A52E21 /* Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B545A20079C4000A52E21 /* Data.cpp */; }; 4C7B546120079C4900A52E21 /* Hook.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B545F20079C4900A52E21 /* Hook.cpp */; }; + 4C7B54692007BF2E00A52E21 /* TTFSDLPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */; }; 4C7B54752010DF3C00A52E21 /* Android.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54742010DF3C00A52E21 /* Android.cpp */; }; 4C7B54772010DF4300A52E21 /* Linux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54762010DF4300A52E21 /* Linux.cpp */; }; 4C7B547B2010DF4C00A52E21 /* Posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54782010DF4C00A52E21 /* Posix.cpp */; }; - 4C7B54692007BF2E00A52E21 /* TTFSDLPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */; }; 4C7B547C2010DF4C00A52E21 /* Shared.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B54792010DF4C00A52E21 /* Shared.cpp */; }; 4C7B547D2010DF4C00A52E21 /* Windows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B547A2010DF4C00A52E21 /* Windows.cpp */; }; 4C8667821EEFDCDF0024AAB8 /* RideGroupManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C8667801EEFDCDF0024AAB8 /* RideGroupManager.cpp */; }; @@ -274,7 +274,6 @@ C6607F481FE2B97E00D3FC0D /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC4B8E81FE00C5D00660D62 /* Input.cpp */; }; C666ED761F33DBB20061AA04 /* ShortcutKeyChange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666ED741F33DBB20061AA04 /* ShortcutKeyChange.cpp */; }; C666ED771F33DBB20061AA04 /* ShortcutKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666ED751F33DBB20061AA04 /* ShortcutKeys.cpp */; }; - C666EE0B1F33E3650061AA04 /* _legacy.c in Sources */ = {isa = PBXBuildFile; fileRef = C666ED791F33E3520061AA04 /* _legacy.c */; }; C666EE6B1F37ACB10061AA04 /* About.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE551F37ACB10061AA04 /* About.cpp */; }; C666EE6C1F37ACB10061AA04 /* Changelog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE561F37ACB10061AA04 /* Changelog.cpp */; }; C666EE6D1F37ACB10061AA04 /* Cheats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE571F37ACB10061AA04 /* Cheats.cpp */; }; @@ -485,6 +484,8 @@ F775F5381EE3725C001F00E7 /* DummyAudioContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F775F5361EE3724F001F00E7 /* DummyAudioContext.cpp */; }; F79F428F1F3260F1009E42F8 /* changelog.txt in Resources */ = {isa = PBXBuildFile; fileRef = F79F428E1F3260F1009E42F8 /* changelog.txt */; }; F7B2048A201E91BF0000AD7E /* Platform.macOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F7B20489201E91BF0000AD7E /* Platform.macOS.mm */; }; + F7B2048C2024E7810000AD7E /* DefaultObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7B2048B2024E7800000AD7E /* DefaultObjects.cpp */; }; + F7B2048F2024E8B30000AD7E /* _legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7B2048E2024E8B30000AD7E /* _legacy.cpp */; }; F7CB863F1EEDA0B50030C877 /* WindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB863D1EEDA0B50030C877 /* WindowManager.cpp */; }; F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB86471EEDA1330030C877 /* KeyboardShortcuts.cpp */; }; F7CB864D1EEDA1A80030C877 /* DummyWindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB864B1EEDA1A80030C877 /* DummyWindowManager.cpp */; }; @@ -755,7 +756,7 @@ 4C7B545B20079C4000A52E21 /* data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = data.h; sourceTree = ""; }; 4C7B545F20079C4900A52E21 /* Hook.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Hook.cpp; sourceTree = ""; }; 4C7B546020079C4900A52E21 /* hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hook.h; sourceTree = ""; }; - 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TTFSDLPort.cpp; sourceTree = ""; }; + 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TTFSDLPort.cpp; sourceTree = ""; }; 4C7B54742010DF3C00A52E21 /* Android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Android.cpp; sourceTree = ""; }; 4C7B54762010DF4300A52E21 /* Linux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Linux.cpp; sourceTree = ""; }; 4C7B54782010DF4C00A52E21 /* Posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Posix.cpp; sourceTree = ""; }; @@ -959,8 +960,6 @@ C654DF3F1F69C18C0040F43D /* Intent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Intent.h; sourceTree = ""; }; C666ED741F33DBB20061AA04 /* ShortcutKeyChange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShortcutKeyChange.cpp; sourceTree = ""; }; C666ED751F33DBB20061AA04 /* ShortcutKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShortcutKeys.cpp; sourceTree = ""; }; - C666ED781F33E3520061AA04 /* _legacy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _legacy.h; sourceTree = ""; }; - C666ED791F33E3520061AA04 /* _legacy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = _legacy.c; sourceTree = ""; }; C666EE551F37ACB10061AA04 /* About.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = About.cpp; sourceTree = ""; }; C666EE561F37ACB10061AA04 /* Changelog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Changelog.cpp; sourceTree = ""; }; C666EE571F37ACB10061AA04 /* Cheats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cheats.cpp; sourceTree = ""; }; @@ -1414,6 +1413,9 @@ F775F5361EE3724F001F00E7 /* DummyAudioContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyAudioContext.cpp; sourceTree = ""; }; F79F428E1F3260F1009E42F8 /* changelog.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = changelog.txt; path = distribution/changelog.txt; sourceTree = SOURCE_ROOT; }; F7B20489201E91BF0000AD7E /* Platform.macOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Platform.macOS.mm; sourceTree = ""; }; + F7B2048B2024E7800000AD7E /* DefaultObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DefaultObjects.cpp; sourceTree = ""; }; + F7B2048D2024E8A90000AD7E /* DefaultObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultObjects.h; sourceTree = ""; }; + F7B2048E2024E8B30000AD7E /* _legacy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = _legacy.cpp; sourceTree = ""; }; F7CB863D1EEDA0B50030C877 /* WindowManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowManager.cpp; sourceTree = ""; }; F7CB863E1EEDA0B50030C877 /* WindowManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowManager.h; sourceTree = ""; }; F7CB86471EEDA1330030C877 /* KeyboardShortcuts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardShortcuts.cpp; sourceTree = ""; }; @@ -2014,7 +2016,7 @@ C651A8D81F30204300443BCA /* Text.h */, 4C7B53D820002CA400A52E21 /* TTF.cpp */, 4CB832AA1EFFB8D100B88761 /* ttf.h */, - 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */, + 4C7B54682007BF2E00A52E21 /* TTFSDLPort.cpp */, 4C8B426E1EEB1ABD00F015CA /* X8DrawingEngine.cpp */, 4C8B426F1EEB1ABD00F015CA /* X8DrawingEngine.h */, ); @@ -2132,6 +2134,8 @@ F76C84111EC4E7CC00FA49E2 /* object */ = { isa = PBXGroup; children = ( + F7B2048D2024E8A90000AD7E /* DefaultObjects.h */, + F7B2048B2024E7800000AD7E /* DefaultObjects.cpp */, F76C84121EC4E7CC00FA49E2 /* BannerObject.cpp */, F76C84131EC4E7CC00FA49E2 /* BannerObject.h */, F76C84141EC4E7CC00FA49E2 /* EntranceObject.cpp */, @@ -2507,8 +2511,7 @@ F76C850D1EC4E7CD00FA49E2 /* windows */ = { isa = PBXGroup; children = ( - C666ED791F33E3520061AA04 /* _legacy.c */, - C666ED781F33E3520061AA04 /* _legacy.h */, + F7B2048E2024E8B30000AD7E /* _legacy.cpp */, C654DF3E1F69C18C0040F43D /* Intent.cpp */, C654DF3F1F69C18C0040F43D /* Intent.h */, F76C854A1EC4E7CD00FA49E2 /* tile_inspector.h */, @@ -3232,6 +3235,7 @@ 4C7B544E2007646A00A52E21 /* MapHelpers.cpp in Sources */, 4C93F1761F8B745700A9330D /* MonorailCycles.cpp in Sources */, 4C93F13E1F8B744400A9330D /* CorkscrewRollerCoaster.cpp in Sources */, + F7B2048F2024E8B30000AD7E /* _legacy.cpp in Sources */, C6D2BEE71F9BAACE008B557C /* MapTooltip.cpp in Sources */, 4C93F1401F8B744400A9330D /* GigaCoaster.cpp in Sources */, 4C93F1541F8B744400A9330D /* TwisterRollerCoaster.cpp in Sources */, @@ -3278,6 +3282,7 @@ 4C5DFF421FAC69D200CB093A /* Date.cpp in Sources */, 4C93F13C1F8B744400A9330D /* BolligerMabillardTrack.cpp in Sources */, C654DF321F69C0430040F43D /* InstallTrack.cpp in Sources */, + F7B2048C2024E7810000AD7E /* DefaultObjects.cpp in Sources */, 4C93F14D1F8B744400A9330D /* MultiDimensionRollerCoaster.cpp in Sources */, C64644FF1F3FA4120026AC2D /* StaffList.cpp in Sources */, C6D2BEE81F9BAACE008B557C /* MazeConstruction.cpp in Sources */, @@ -3478,7 +3483,6 @@ F76C866A1EC4E88300FA49E2 /* LargeSceneryObject.cpp in Sources */, F76C866C1EC4E88400FA49E2 /* Object.cpp in Sources */, F76C866E1EC4E88400FA49E2 /* ObjectFactory.cpp in Sources */, - C666EE0B1F33E3650061AA04 /* _legacy.c in Sources */, F76C86701EC4E88400FA49E2 /* ObjectManager.cpp in Sources */, F76C86721EC4E88400FA49E2 /* ObjectRepository.cpp in Sources */, F76C86741EC4E88400FA49E2 /* RideObject.cpp in Sources */, diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 8ff4c2172b..40809bee96 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -15,6 +15,7 @@ #pragma endregion #include +#include #include #include #include @@ -29,7 +30,6 @@ #include #include #include -#include #pragma region Widgets diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 59333a1a40..7dbdfbd532 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -20,12 +20,12 @@ #include "EditorObjectSelectionSession.h" #include "Game.h" #include "localisation/Localisation.h" +#include "object/DefaultObjects.h" #include "object/ObjectManager.h" #include "object/ObjectRepository.h" #include "OpenRCT2.h" #include "ride/RideData.h" #include "windows/Intent.h" -#include "windows/_legacy.h" #include "world/Footpath.h" #include "world/LargeScenery.h" diff --git a/src/openrct2/object/DefaultObjects.cpp b/src/openrct2/object/DefaultObjects.cpp new file mode 100644 index 0000000000..78d10c1e2a --- /dev/null +++ b/src/openrct2/object/DefaultObjects.cpp @@ -0,0 +1,64 @@ +#pragma region Copyright (c) 2014-2018 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "DefaultObjects.h" +#include "Object.h" + +/** rct2: 0x0098DA74 */ +const rct_object_entry RequiredSelectedObjects[7] = +{ + // Objects that are always required + { 0x00000087, { "SCGTREES" } }, // Scenery: Trees + { 0x00000087, { "SCGSHRUB" } }, // Scenery: Shrubs and Ornaments + { 0x00000087, { "SCGGARDN" } }, // Scenery: Gardens + { 0x00000087, { "SCGFENCE" } }, // Scenery: Fences and Walls + { 0x00000087, { "SCGWALLS" } }, // Scenery: Walls and Roofs + { 0x00000087, { "SCGPATHX" } }, // Scenery: Signs and Items for Footpaths + { 0x00000085, { "TARMAC " } }, // Footpath: Tarmac +}; + +const rct_object_entry DefaultSelectedObjects[26] = +{ + // An initial default selection + { 0x00000080, { "TWIST1 " } }, // Ride: Twist + { 0x00000080, { "PTCT1 " } }, // Ride: Wooden Roller Coaster (Wooden Roller Coaster Trains) + { 0x00000080, { "ZLDB " } }, // Ride: Junior Roller Coaster (Ladybird Trains) + { 0x00000080, { "LFB1 " } }, // Ride: Log Flume + { 0x00000080, { "VCR " } }, // Ride: Vintage Cars + { 0x00000080, { "MGR1 " } }, // Ride: Merry-Go-Round + { 0x00000080, { "TLT1 " } }, // Ride: Restroom + { 0x00000080, { "ATM1 " } }, // Ride: Cash Machine + { 0x00000080, { "FAID1 " } }, // Ride: First Aid Room + { 0x00000080, { "INFOK " } }, // Ride: Information Kiosk + { 0x00000080, { "DRNKS " } }, // Ride: Drinks Stall + { 0x00000080, { "CNDYF " } }, // Ride: Candyfloss Stall + { 0x00000080, { "BURGB " } }, // Ride: Burger Bar + { 0x00000080, { "BALLN " } }, // Ride: Balloon Stall + { 0x00000080, { "ARRT1 " } }, // Ride: Corkscrew Roller Coaster + { 0x00000080, { "RBOAT " } }, // Ride: Rowing Boats + { 0x00000088, { "PKENT1 " } }, // Park Entrance: Traditional Park Entrance + { 0x00000089, { "WTRCYAN " } }, // Water: Natural Water + { 0x00000085, { "TARMACB " } }, // Footpath: Brown Tarmac Footpath + { 0x00000085, { "PATHSPCE" } }, // Footpath: Space Style Footpath + { 0x00000085, { "PATHDIRT" } }, // Footpath: Dirt Footpath + { 0x00000085, { "PATHCRZY" } }, // Footpath: Crazy Paving Footpath + { 0x00000085, { "PATHASH " } }, // Footpath: Ash Footpath + + // The following are for all random map generation features to work out the box + { 0x00000087, { "SCGJUNGL" } }, // Jungle Theming + { 0x00000087, { "SCGSNOW " } }, // Snow and Ice Theming + { 0x00000087, { "SCGWATER" } } // Water Feature Theming +}; diff --git a/src/openrct2/windows/_legacy.h b/src/openrct2/object/DefaultObjects.h similarity index 79% rename from src/openrct2/windows/_legacy.h rename to src/openrct2/object/DefaultObjects.h index e375880d85..fd59b9b42b 100644 --- a/src/openrct2/windows/_legacy.h +++ b/src/openrct2/object/DefaultObjects.h @@ -1,4 +1,4 @@ -#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers +#pragma region Copyright (c) 2014-2018 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * @@ -14,20 +14,9 @@ *****************************************************************************/ #pragma endregion -#include "../object/Object.h" +#pragma once -#ifndef _LEGACY_H -#define _LEGACY_H - -#ifdef __cplusplus -extern "C" { -#endif +#include "Object.h" extern const rct_object_entry RequiredSelectedObjects[7]; extern const rct_object_entry DefaultSelectedObjects[26]; - -#ifdef __cplusplus -} -#endif - -#endif // _LEGACY_H \ No newline at end of file diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 925e1484e3..9b5e83a9bf 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -81,8 +81,14 @@ typedef struct rct_object_entry { uint8 end_flag; // needed not to read past allocated buffer. uint32 flags; }; - char name[8]; - uint32 checksum; + union { + char nameWOC[12]; + struct { + char name[8]; + uint32 checksum; + }; + }; + } rct_object_entry; assert_struct_size(rct_object_entry, 0x10); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 90e6792ed7..abf3087bd4 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -183,9 +183,8 @@ static rct_track_td6 * track_design_open_from_td4(uint8 * src, size_t srcLength) td6->ride_mode = RIDE_MODE_POWERED_LAUNCH; } - // Convert RCT1 vehicle type to RCT2 vehicle type. Intialise with an string consisting of 8 spaces (and no nul terminator). - rct_object_entry vehicleObject = {0x80, "", 0}; - memset(vehicleObject.name, ' ', sizeof(vehicleObject.name)); + // Convert RCT1 vehicle type to RCT2 vehicle type. Intialise with an string consisting of 8 spaces. + rct_object_entry vehicleObject = {0x80, " "}; if (td4->type == RIDE_TYPE_MAZE) { const char * name = RCT1::GetRideTypeObject(td4->type); diff --git a/src/openrct2/windows/_legacy.c b/src/openrct2/windows/_legacy.cpp similarity index 86% rename from src/openrct2/windows/_legacy.c rename to src/openrct2/windows/_legacy.cpp index 8bd6302221..08a991a337 100644 --- a/src/openrct2/windows/_legacy.c +++ b/src/openrct2/windows/_legacy.cpp @@ -14,69 +14,21 @@ *****************************************************************************/ #pragma endregion -#include "_legacy.h" -#include "../interface/Window.h" -#include "../peep/Staff.h" -#include "Intent.h" -#include "../Context.h" #include "../audio/audio.h" -#include "../Input.h" +#include "../Cheats.h" +#include "../Context.h" +#include "../core/Util.hpp" #include "../Game.h" +#include "../Input.h" #include "../interface/Viewport.h" +#include "../network/network.h" #include "../ride/Track.h" #include "../ride/TrackData.h" -#include "../Cheats.h" -#include "../network/network.h" #include "../world/Scenery.h" - -#pragma warning(disable : 4295) // 'identifier': array is too small to include a terminating null character +#include "Intent.h" bool gDisableErrorWindowSound = false; -/** rct2: 0x0098DA74 */ -const rct_object_entry RequiredSelectedObjects[7] = { - // Objects that are always required - { 0x00000087, { "SCGTREES" }, 0 }, // Scenery: Trees - { 0x00000087, { "SCGSHRUB" }, 0 }, // Scenery: Shrubs and Ornaments - { 0x00000087, { "SCGGARDN" }, 0 }, // Scenery: Gardens - { 0x00000087, { "SCGFENCE" }, 0 }, // Scenery: Fences and Walls - { 0x00000087, { "SCGWALLS" }, 0 }, // Scenery: Walls and Roofs - { 0x00000087, { "SCGPATHX" }, 0 }, // Scenery: Signs and Items for Footpaths - { 0x00000085, { "TARMAC " }, 0 }, // Footpath: Tarmac -}; - -const rct_object_entry DefaultSelectedObjects[26] = { - // An initial default selection - { 0x00000080, { "TWIST1 " }, 0 }, // Ride: Twist - { 0x00000080, { "PTCT1 " }, 0 }, // Ride: Wooden Roller Coaster (Wooden Roller Coaster Trains) - { 0x00000080, { "ZLDB " }, 0 }, // Ride: Junior Roller Coaster (Ladybird Trains) - { 0x00000080, { "LFB1 " }, 0 }, // Ride: Log Flume - { 0x00000080, { "VCR " }, 0 }, // Ride: Vintage Cars - { 0x00000080, { "MGR1 " }, 0 }, // Ride: Merry-Go-Round - { 0x00000080, { "TLT1 " }, 0 }, // Ride: Restroom - { 0x00000080, { "ATM1 " }, 0 }, // Ride: Cash Machine - { 0x00000080, { "FAID1 " }, 0 }, // Ride: First Aid Room - { 0x00000080, { "INFOK " }, 0 }, // Ride: Information Kiosk - { 0x00000080, { "DRNKS " }, 0 }, // Ride: Drinks Stall - { 0x00000080, { "CNDYF " }, 0 }, // Ride: Candyfloss Stall - { 0x00000080, { "BURGB " }, 0 }, // Ride: Burger Bar - { 0x00000080, { "BALLN " }, 0 }, // Ride: Balloon Stall - { 0x00000080, { "ARRT1 " }, 0 }, // Ride: Corkscrew Roller Coaster - { 0x00000080, { "RBOAT " }, 0 }, // Ride: Rowing Boats - { 0x00000088, { "PKENT1 " }, 0 }, // Park Entrance: Traditional Park Entrance - { 0x00000089, { "WTRCYAN " }, 0 }, // Water: Natural Water - { 0x00000085, { "TARMACB " }, 0 }, // Footpath: Brown Tarmac Footpath - { 0x00000085, { "PATHSPCE" }, 0 }, // Footpath: Space Style Footpath - { 0x00000085, { "PATHDIRT" }, 0 }, // Footpath: Dirt Footpath - { 0x00000085, { "PATHCRZY" }, 0 }, // Footpath: Crazy Paving Footpath - { 0x00000085, { "PATHASH " }, 0 }, // Footpath: Ash Footpath - - // The following are for all random map generation features to work out the box - { 0x00000087, { "SCGJUNGL" }, 0 }, // Jungle Theming - { 0x00000087, { "SCGSNOW " }, 0 }, // Snow and Ice Theming - { 0x00000087, { "SCGWATER" }, 0 } // Water Feature Theming -}; - void game_command_callback_pickup_guest(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp) { switch (ecx) @@ -278,8 +230,9 @@ static bool sub_6CA2DF_get_track_element(uint8 *trackElement) { } } - if (curve <= 8) { - for (int i = 0; i < countof(gTrackDescriptors); i++) + if (curve <= 8) + { + for (uint32 i = 0; i < Util::CountOf(gTrackDescriptors); i++) { const track_descriptor * trackDescriptor = &gTrackDescriptors[i];