diff --git a/src/openrct2-ui/Ui.cpp b/src/openrct2-ui/Ui.cpp index 9a79c8084d..bf4d6da881 100644 --- a/src/openrct2-ui/Ui.cpp +++ b/src/openrct2-ui/Ui.cpp @@ -64,7 +64,7 @@ int main(int argc, const char** argv) } catch (const SDLException& e) { - log_warning("Failed to create audio context. Using dummy audio context. Error message was: %s", e.what()); + LOG_WARNING("Failed to create audio context. Using dummy audio context. Error message was: %s", e.what()); audioContext = ToShared(CreateDummyAudioContext()); } auto uiContext = ToShared(CreateUiContext(env)); diff --git a/src/openrct2-ui/UiContext.Android.cpp b/src/openrct2-ui/UiContext.Android.cpp index a292365255..6c633de740 100644 --- a/src/openrct2-ui/UiContext.Android.cpp +++ b/src/openrct2-ui/UiContext.Android.cpp @@ -53,7 +53,7 @@ namespace OpenRCT2::Ui void ShowMessageBox(SDL_Window* window, const std::string& message) override { - log_verbose(message.c_str()); + LOG_VERBOSE(message.c_str()); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "OpenRCT2", message.c_str(), window); } @@ -67,7 +67,7 @@ namespace OpenRCT2::Ui std::string ShowDirectoryDialog(SDL_Window* window, const std::string& title) override { - log_info(title.c_str()); + LOG_INFO(title.c_str()); STUB(); return "/sdcard/rct2"; diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index 1a5b5f970f..c1b3b85b58 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -90,7 +90,7 @@ namespace OpenRCT2::Ui void ShowMessageBox(SDL_Window* window, const std::string& message) override { - log_verbose(message.c_str()); + LOG_VERBOSE(message.c_str()); std::string executablePath; DIALOG_TYPE dtype = GetDialogApp(&executablePath); diff --git a/src/openrct2-ui/UiContext.Win32.cpp b/src/openrct2-ui/UiContext.Win32.cpp index 9da8a3e4ea..90156d9378 100644 --- a/src/openrct2-ui/UiContext.Win32.cpp +++ b/src/openrct2-ui/UiContext.Win32.cpp @@ -221,7 +221,7 @@ namespace OpenRCT2::Ui SDL_VERSION(&wmInfo.version); if (SDL_GetWindowWMInfo(window, &wmInfo) != SDL_TRUE) { - log_error("SDL_GetWindowWMInfo failed %s", SDL_GetError()); + LOG_ERROR("SDL_GetWindowWMInfo failed %s", SDL_GetError()); exit(-1); } diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index a61cb8c40f..33c1448e84 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -196,7 +196,7 @@ public: if (SDL_SetWindowFullscreen(_window, windowFlags)) { - log_fatal("SDL_SetWindowFullscreen %s", SDL_GetError()); + LOG_FATAL("SDL_SetWindowFullscreen %s", SDL_GetError()); exit(1); // TODO try another display mode rather than just exiting the game @@ -725,7 +725,7 @@ private: { SDL_version version{}; SDL_GetVersion(&version); - log_verbose("SDL2 version: %d.%d.%d", version.major, version.minor, version.patch); + LOG_VERBOSE("SDL2 version: %d.%d.%d", version.major, version.minor, version.patch); } void CreateWindow(const ScreenCoordsXY& windowPos) diff --git a/src/openrct2-ui/UiContext.macOS.mm b/src/openrct2-ui/UiContext.macOS.mm index 063f21daaf..5e211f2fb6 100644 --- a/src/openrct2-ui/UiContext.macOS.mm +++ b/src/openrct2-ui/UiContext.macOS.mm @@ -175,7 +175,7 @@ namespace OpenRCT2::Ui private: static int32_t Execute(const std::string& command, std::string* output = nullptr) { - log_verbose("executing \"%s\"...", command.c_str()); + LOG_VERBOSE("executing \"%s\"...", command.c_str()); FILE* fpipe = popen(command.c_str(), "r"); if (fpipe == nullptr) { diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 8e02721636..a825ca342c 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -323,7 +323,7 @@ public: tlbrWindow->Invalidate(); if (!ToolSet(*tlbrWindow, WC_TOP_TOOLBAR__WIDX_SCENERY, Tool::Arrow)) { - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); window = WindowSceneryOpen(); } } diff --git a/src/openrct2-ui/audio/AudioContext.cpp b/src/openrct2-ui/audio/AudioContext.cpp index 20bf77bad1..65bcb0709f 100644 --- a/src/openrct2-ui/audio/AudioContext.cpp +++ b/src/openrct2-ui/audio/AudioContext.cpp @@ -90,7 +90,7 @@ namespace OpenRCT2::Audio } catch (const std::exception& e) { - log_verbose("Unable to create audio source: %s", e.what()); + LOG_VERBOSE("Unable to create audio source: %s", e.what()); return nullptr; } } @@ -119,7 +119,7 @@ namespace OpenRCT2::Audio } catch (const std::exception& e) { - log_verbose("Unable to create audio source: %s", e.what()); + LOG_VERBOSE("Unable to create audio source: %s", e.what()); return nullptr; } } diff --git a/src/openrct2-ui/audio/FlacAudioSource.cpp b/src/openrct2-ui/audio/FlacAudioSource.cpp index c56af9e234..2cb430d544 100644 --- a/src/openrct2-ui/audio/FlacAudioSource.cpp +++ b/src/openrct2-ui/audio/FlacAudioSource.cpp @@ -60,7 +60,7 @@ namespace OpenRCT2::Audio _decoder = FLAC__stream_decoder_new(); if (_decoder == nullptr) { - log_verbose("Could not create FLAC stream decoder"); + LOG_VERBOSE("Could not create FLAC stream decoder"); return false; } @@ -69,13 +69,13 @@ namespace OpenRCT2::Audio FlacCallbackWrite, FlacCallbackMetadata, FlacCallbackError, this); if (status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - log_verbose("Could not initialise FLAC stream"); + LOG_VERBOSE("Could not initialise FLAC stream"); return false; } if (!FLAC__stream_decoder_process_until_end_of_metadata(_decoder)) { - log_verbose("Could not read FLAC metadata"); + LOG_VERBOSE("Could not read FLAC metadata"); return false; } diff --git a/src/openrct2-ui/audio/OggAudioSource.cpp b/src/openrct2-ui/audio/OggAudioSource.cpp index 0d1e36f534..f23a10c79e 100644 --- a/src/openrct2-ui/audio/OggAudioSource.cpp +++ b/src/openrct2-ui/audio/OggAudioSource.cpp @@ -63,14 +63,14 @@ namespace OpenRCT2::Audio _file.emplace(); if (ov_open_callbacks(_rw, &*_file, NULL, 0, callbacks) < 0) { - log_verbose("Could not open OGG/Vorbis stream"); + LOG_VERBOSE("Could not open OGG/Vorbis stream"); return false; } auto vi = ov_info(&*_file, -1); if (vi == nullptr) { - log_verbose("Failed to get OGG/Vorbis info"); + LOG_VERBOSE("Failed to get OGG/Vorbis info"); return false; } diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp index 2be1a6ceed..1441e5a095 100644 --- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp @@ -100,7 +100,7 @@ public: int32_t result = SDL_GetRendererInfo(_sdlRenderer, &rendererInfo); if (result < 0) { - log_warning("HWDisplayDrawingEngine::Resize error: %s", SDL_GetError()); + LOG_WARNING("HWDisplayDrawingEngine::Resize error: %s", SDL_GetError()); return; } uint32_t pixelFormat = SDL_PIXELFORMAT_UNKNOWN; @@ -390,12 +390,12 @@ private: _pausedBeforeOverlay = gGamePaused & GAME_PAUSED_NORMAL; if (!_pausedBeforeOverlay) { - pause_toggle(); + PauseToggle(); } } else if (_overlayActive && !newOverlayActive && !_pausedBeforeOverlay) { - pause_toggle(); + PauseToggle(); } _overlayActive = newOverlayActive; diff --git a/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp index 2e4426523a..62f6cb6207 100644 --- a/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/SoftwareDrawingEngine.cpp @@ -64,13 +64,13 @@ public: if (_surface == nullptr || _palette == nullptr || _RGBASurface == nullptr) { - log_fatal("%p || %p || %p == nullptr %s", _surface, _palette, _RGBASurface, SDL_GetError()); + LOG_FATAL("%p || %p || %p == nullptr %s", _surface, _palette, _RGBASurface, SDL_GetError()); exit(-1); } if (SDL_SetSurfacePalette(_surface, _palette)) { - log_fatal("SDL_SetSurfacePalette failed %s", SDL_GetError()); + LOG_FATAL("SDL_SetSurfacePalette failed %s", SDL_GetError()); exit(-1); } @@ -107,7 +107,7 @@ private: { if (SDL_LockSurface(_surface) < 0) { - log_error("locking failed %s", SDL_GetError()); + LOG_ERROR("locking failed %s", SDL_GetError()); return; } } @@ -127,7 +127,7 @@ private: SDL_Surface* windowSurface = SDL_GetWindowSurface(_window); if (SDL_BlitSurface(_surface, nullptr, windowSurface, nullptr)) { - log_fatal("SDL_BlitSurface %s", SDL_GetError()); + LOG_FATAL("SDL_BlitSurface %s", SDL_GetError()); exit(1); } } @@ -136,7 +136,7 @@ private: // first blit to rgba surface to change the pixel format if (SDL_BlitSurface(_surface, nullptr, _RGBASurface, nullptr)) { - log_fatal("SDL_BlitSurface %s", SDL_GetError()); + LOG_FATAL("SDL_BlitSurface %s", SDL_GetError()); exit(1); } @@ -144,13 +144,13 @@ private: // about blit configurations being incompatible. if (SDL_BlitScaled(_RGBASurface, nullptr, SDL_GetWindowSurface(_window), nullptr)) { - log_fatal("SDL_BlitScaled %s", SDL_GetError()); + LOG_FATAL("SDL_BlitScaled %s", SDL_GetError()); exit(1); } } if (SDL_UpdateWindowSurface(_window)) { - log_fatal("SDL_UpdateWindowSurface %s", SDL_GetError()); + LOG_FATAL("SDL_UpdateWindowSurface %s", SDL_GetError()); exit(1); } } diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h index eab9b0dd49..0a727ed1ba 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h @@ -118,7 +118,7 @@ inline void CheckGLError() GLenum error = glGetError(); while (error != GL_NO_ERROR) { - log_error("OpenGL Error 0x%04X", error); + LOG_ERROR("OpenGL Error 0x%04X", error); error = glGetError(); } } diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp index 665e7f6c66..78d54d5a12 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp @@ -334,7 +334,7 @@ AtlasTextureInfo TextureCache::AllocateImage(int32_t imageWidth, int32_t imageHe int32_t atlasSize = powf(2, static_cast(Atlas::CalculateImageSizeOrder(imageWidth, imageHeight))); # ifdef DEBUG - log_verbose("new texture atlas #%d (size %d) allocated", atlasIndex, atlasSize); + LOG_VERBOSE("new texture atlas #%d (size %d) allocated", atlasIndex, atlasSize); # endif _atlases.emplace_back(atlasIndex, atlasSize); diff --git a/src/openrct2-ui/input/InputManager.cpp b/src/openrct2-ui/input/InputManager.cpp index 7ec197c361..fc45816786 100644 --- a/src/openrct2-ui/input/InputManager.cpp +++ b/src/openrct2-ui/input/InputManager.cpp @@ -122,7 +122,7 @@ void InputManager::HandleViewScrolling() // Mouse edge scrolling if (gConfigGeneral.EdgeScrolling) { - if (input_get_state() != InputState::Normal) + if (InputGetState() != InputState::Normal) return; if (gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_SHIFT_Z | PLACE_OBJECT_MODIFIER_COPY_Z)) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 6c74c0ae06..fe0f4659f8 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -375,7 +375,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState break; } - if (!input_test_flag(INPUT_FLAG_4)) + if (!InputTestFlag(INPUT_FLAG_4)) break; if (w->classification != _dragWidget.window_classification || w->number != _dragWidget.window_number @@ -1044,7 +1044,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, rct_window* w, W w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number); if (w != nullptr) { - input_set_flag(INPUT_FLAG_4, true); + InputSetFlag(INPUT_FLAG_4, true); WindowEventToolDownCall(w, gCurrentToolWidget.widget_index, screenCoords); } } @@ -1190,7 +1190,7 @@ void ProcessMouseTool(const ScreenCoordsXY& screenCoords) if (w == nullptr) ToolCancel(); - else if (input_get_state() != InputState::ViewportRight) + else if (InputGetState() != InputState::ViewportRight) WindowEventToolUpdateCall(w, gCurrentToolWidget.widget_index, screenCoords); } } @@ -1488,7 +1488,7 @@ static void InputUpdateTooltip(rct_window* w, WidgetIndex widgetIndex, const Scr } else { - reset_tooltip_not_shown(); + ResetTooltipNotShown(); if (w == nullptr || gTooltipWidget.window_classification != w->classification || gTooltipWidget.window_number != w->number || gTooltipWidget.widget_index != widgetIndex diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 5534ad3385..b79707854d 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -364,7 +364,7 @@ static void ShortcutReduceGameSpeed() return; if (network_get_mode() == NETWORK_MODE_NONE) - game_reduce_game_speed(); + GameReduceGameSpeed(); } static void ShortcutIncreaseGameSpeed() @@ -373,7 +373,7 @@ static void ShortcutIncreaseGameSpeed() return; if (network_get_mode() == NETWORK_MODE_NONE) - game_increase_game_speed(); + GameIncreaseGameSpeed(); } static void ShortcutOpenCheatWindow() @@ -424,7 +424,7 @@ static void ShortcutQuickSaveGame() if (gScreenFlags == SCREEN_FLAGS_PLAYING) { ToolCancel(); - save_game(); + SaveGame(); } else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { @@ -764,7 +764,7 @@ void ShortcutManager::RegisterDefaultShortcuts() { WindowClose(*window); } - else if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + else if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { ToolCancel(); } diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index 7e02ace6a0..5d1db17228 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -404,7 +404,7 @@ bool UITheme::WriteToFile(const std::string& path) const } catch (const std::exception& ex) { - log_error("Unable to save %s: %s", path.c_str(), ex.what()); + LOG_ERROR("Unable to save %s: %s", path.c_str(), ex.what()); result = false; } @@ -475,7 +475,7 @@ UITheme* UITheme::FromFile(const std::string& path) } catch (const std::exception&) { - log_error("Unable to read theme: %s", path.c_str()); + LOG_ERROR("Unable to read theme: %s", path.c_str()); result = nullptr; } return result; diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 0957f21ce8..da32ae2d5b 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -199,7 +199,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) } case EntityType::Balloon: { - if (game_is_not_paused()) + if (GameIsNotPaused()) { auto balloonPress = BalloonPressAction(entity->sprite_index); GameActions::Execute(&balloonPress); @@ -208,7 +208,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) break; case EntityType::Duck: { - if (game_is_not_paused()) + if (GameIsNotPaused()) { auto duck = entity->As(); if (duck != nullptr) @@ -444,7 +444,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor break; } - if (!(input_test_flag(INPUT_FLAG_6)) || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_6)) || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) { if (WindowFindByClass(WindowClass::RideConstruction) == nullptr && WindowFindByClass(WindowClass::Footpath) == nullptr) { diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 975faf605c..23b2695fc8 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -51,7 +51,7 @@ void WidgetDraw(rct_drawpixelinfo* dpi, rct_window& w, WidgetIndex widgetIndex) const auto* widget = GetWidgetByIndex(w, widgetIndex); if (widget == nullptr) { - log_error("Tried drawing an out-of-bounds widget index!"); + LOG_ERROR("Tried drawing an out-of-bounds widget index!"); return; } @@ -883,9 +883,9 @@ bool WidgetIsPressed(const rct_window& w, WidgetIndex widgetIndex) } } - if (input_get_state() == InputState::WidgetPressed || input_get_state() == InputState::DropdownActive) + if (InputGetState() == InputState::WidgetPressed || InputGetState() == InputState::DropdownActive) { - if (!(input_test_flag(INPUT_FLAG_WIDGET_PRESSED))) + if (!(InputTestFlag(INPUT_FLAG_WIDGET_PRESSED))) return false; if (gPressedWidget.window_classification != w.classification) return false; @@ -911,7 +911,7 @@ bool WidgetIsHighlighted(const rct_window& w, WidgetIndex widgetIndex) bool WidgetIsActiveTool(const rct_window& w, WidgetIndex widgetIndex) { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != w.classification) return false; @@ -1051,7 +1051,7 @@ Widget* GetWidgetByIndex(const rct_window& w, WidgetIndex widgetIndex) index++; } - log_error("Widget index %i out of bounds for window class %u", widgetIndex, w.classification); + LOG_ERROR("Widget index %i out of bounds for window class %u", widgetIndex, w.classification); return nullptr; } diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index eedb72db16..a4334e2cd1 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -521,7 +521,7 @@ void WindowAllWheelInput() return; // Check window cursor is over - if (!(input_test_flag(INPUT_FLAG_5))) + if (!(InputTestFlag(INPUT_FLAG_5))) { rct_window* w = WindowFindFromPoint(cursorState->position); if (w != nullptr) diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index 37362edb41..37d485338f 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -267,7 +267,7 @@ namespace OpenRCT2::Scripting if (isScenario) scenario_begin(); else - game_load_init(); + GameLoadInit(); gLoadKeepWindowsOpen = old; } catch (const std::exception&) diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index 8287d4e0ed..99023ec327 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -151,7 +151,7 @@ namespace OpenRCT2::Scripting std::shared_ptr tool_get() const { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { return std::make_shared(_scriptEngine.GetContext()); } diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index 9dd2b84c80..7cb9b06383 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -132,7 +132,7 @@ namespace OpenRCT2::Title auto parkHandle = TitleSequenceGetParkHandle(*_sequence, saveIndex); if (parkHandle != nullptr) { - game_notify_map_change(); + GameNotifyMapChange(); loadSuccess = LoadParkFromStream(parkHandle->Stream.get(), parkHandle->HintPath); } if (!loadSuccess) @@ -146,7 +146,7 @@ namespace OpenRCT2::Title throw std::out_of_range("Failed to load park; index out of range."); } - game_notify_map_changed(); + GameNotifyMapChanged(); } else if (std::holds_alternative(currentCommand)) { @@ -155,7 +155,7 @@ namespace OpenRCT2::Title auto scenario = GetScenarioRepository()->GetByInternalName(scenarioName); if (scenario != nullptr) { - game_notify_map_change(); + GameNotifyMapChange(); loadSuccess = LoadParkFromFile(scenario->path); } @@ -165,7 +165,7 @@ namespace OpenRCT2::Title throw std::domain_error(message); } - game_notify_map_changed(); + GameNotifyMapChanged(); } IncrementPosition(); @@ -281,7 +281,7 @@ namespace OpenRCT2::Title bool LoadParkFromFile(const utf8* path) { - log_verbose("TitleSequencePlayer::LoadParkFromFile(%s)", path); + LOG_VERBOSE("TitleSequencePlayer::LoadParkFromFile(%s)", path); bool success = false; try { @@ -318,7 +318,7 @@ namespace OpenRCT2::Title */ bool LoadParkFromStream(OpenRCT2::IStream* stream, const std::string& hintPath) { - log_verbose("TitleSequencePlayer::LoadParkFromStream(%s)", hintPath.c_str()); + LOG_VERBOSE("TitleSequencePlayer::LoadParkFromStream(%s)", hintPath.c_str()); bool success = false; try { @@ -379,7 +379,7 @@ namespace OpenRCT2::Title auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->SetMainView(gSavedView, gSavedViewZoom, gSavedViewRotation); ResetEntitySpatialIndices(); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); ContextBroadcastIntent(&intent); ScenerySetDefaultPlacementConfiguration(); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 424560c0dc..ea4335e087 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -205,7 +205,7 @@ private: // Version info utf8 buffer[256]; utf8* ch = buffer; - openrct2_write_full_version_info(ch, sizeof(buffer) - (ch - buffer)); + OpenRCT2WriteFullVersionInfo(ch, sizeof(buffer) - (ch - buffer)); auto ft = Formatter(); ft.Add(buffer); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 033ef7f30c..82171cf456 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -113,7 +113,7 @@ public: return true; default: - log_error("Invalid personality for changelog window: %d", personality); + LOG_ERROR("Invalid personality for changelog window: %d", personality); return false; } } @@ -179,7 +179,7 @@ public: } else { - log_error("Cannot open URL: NewVersionInfo for ChangelogWindow is undefined!"); + LOG_ERROR("Cannot open URL: NewVersionInfo for ChangelogWindow is undefined!"); } break; } @@ -243,7 +243,7 @@ private: } else { - log_error("ChangelogWindow: Could not process NewVersionInfo, result was undefined"); + LOG_ERROR("ChangelogWindow: Could not process NewVersionInfo, result was undefined"); } } @@ -271,12 +271,12 @@ private: } catch (const std::bad_alloc&) { - log_error("Unable to allocate memory for text file"); + LOG_ERROR("Unable to allocate memory for text file"); return false; } catch (const std::exception&) { - log_error("Unable to read text file"); + LOG_ERROR("Unable to read text file"); return false; } diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 46cf3666f3..47830ea683 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -132,7 +132,7 @@ public: ResetDropdownFlags(); gDropdownIsColour = false; gDropdownDefaultIndex = -1; - input_set_state(InputState::DropdownActive); + InputSetState(InputState::DropdownActive); } void OnDraw(rct_drawpixelinfo& dpi) override @@ -376,9 +376,9 @@ void WindowDropdownShowTextCustomWidth( const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items, int32_t width) { - input_set_flag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); + InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); if (flags & Dropdown::Flag::StayOpen) - input_set_flag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); + InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); WindowDropdownClose(); @@ -408,9 +408,9 @@ void WindowDropdownShowImage( int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth, int32_t itemHeight, int32_t numColumns) { - input_set_flag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); + InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false); if (flags & Dropdown::Flag::StayOpen) - input_set_flag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); + InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true); // Close existing dropdown WindowDropdownClose(); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 4f85b6d325..f649444a97 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -205,7 +205,7 @@ private: if (!CheckObjectSelection()) return; - finish_object_selection(); + FinishObjectSelection(); if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { ContextOpenWindow(WindowClass::ConstructRide); diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 068a8307ee..ba85fa428a 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -265,7 +265,7 @@ public: InitWidgets(); sub_6AB211(); - reset_selected_object_count_and_size(); + ResetSelectedObjectCountAndSize(); widgets[WIDX_FILTER_TEXT_BOX].string = _filter_string; @@ -293,9 +293,9 @@ public: */ void OnClose() override { - unload_unselected_objects(); + UnloadUnselectedObjects(); EditorLoadSelectedObjects(); - editor_object_flags_free(); + EditorObjectFlagsFree(); if (_loadedObject != nullptr) _loadedObject->Unload(); @@ -356,12 +356,12 @@ public: WindowClose(*this); if (gScreenFlags & SCREEN_FLAGS_EDITOR) { - finish_object_selection(); + FinishObjectSelection(); } if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - game_notify_map_change(); - game_unload_scripts(); + GameNotifyMapChange(); + GameUnloadScripts(); title_load(); } break; @@ -594,7 +594,7 @@ public: if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - const auto objectSelectResult = window_editor_object_selection_select_object( + const auto objectSelectResult = WindowEditorObjectSelectionSelectObject( 0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem); if (!objectSelectResult.Successful) return; @@ -614,7 +614,7 @@ public: inputFlags |= INPUT_FLAG_EDITOR_OBJECT_SELECT; _gSceneryGroupPartialSelectError = std::nullopt; - const auto objectSelectResult = window_editor_object_selection_select_object(0, inputFlags, listItem->repositoryItem); + const auto objectSelectResult = WindowEditorObjectSelectionSelectObject(0, inputFlags, listItem->repositoryItem); if (!objectSelectResult.Successful) { StringId error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT @@ -1161,7 +1161,7 @@ private: sortFunc = VisibleListSortRideName; break; default: - log_warning("Wrong sort type %d, leaving list as-is.", _listSortType); + LOG_WARNING("Wrong sort type %d, leaving list as-is.", _listSortType); break; } if (sortFunc != nullptr) @@ -1577,7 +1577,7 @@ void EditorLoadSelectedObjects() loadedObject = objManager.LoadObject(descriptor); if (loadedObject == nullptr) { - log_error("Failed to load entry %s", std::string(descriptor.GetName()).c_str()); + LOG_ERROR("Failed to load entry %s", std::string(descriptor.GetName()).c_str()); } else if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 2f3b746f6a..61754d76e8 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -121,7 +121,7 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) buffer.append(message); } - log_verbose("show error, %s", buffer.c_str() + 1); + LOG_VERBOSE("show error, %s", buffer.c_str() + 1); // Don't do unnecessary work in headless. Also saves checking if cursor state is null. if (gOpenRCT2Headless) diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index fece0d15cb..78c2f61097 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -173,7 +173,7 @@ public: ToolCancel(); _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); } @@ -204,7 +204,7 @@ public: // Check tool if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_LAND) { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) { Close(); } @@ -219,7 +219,7 @@ public: } else if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL) { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) { Close(); } @@ -297,7 +297,7 @@ public: gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); break; @@ -314,7 +314,7 @@ public: gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL; ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::Crosshair); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); break; @@ -1381,7 +1381,7 @@ public: void KeyboardShortcutDemolishCurrent() { if (IsWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WindowWidgetType::Empty - || (!gCheatsBuildInPauseMode && game_is_paused())) + || (!gCheatsBuildInPauseMode && GameIsPaused())) { return; } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index ecdcfd92a8..fca9b03f2f 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -465,7 +465,7 @@ static void WindowGameBottomToolbarDrawParkRating( bar_width = (factor * 114) / 255; GfxFillRectInset( dpi, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, w->colours[1], INSET_RECT_F_30); - if (!(colour & BAR_BLINK) || game_is_paused() || (gCurrentRealTimeTicks & 8)) + if (!(colour & BAR_BLINK) || GameIsPaused() || (gCurrentRealTimeTicks & 8)) { if (bar_width > 2) { diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 8352f4bc4d..4a62cdb8fd 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -193,7 +193,7 @@ public: void OnClose() override { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) ToolCancel(); @@ -478,7 +478,7 @@ private: void SetPage(int32_t newPage) { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) ToolCancel(); @@ -1042,7 +1042,7 @@ private: GfxFillRectInset( &dpi, { coords + ScreenCoordsXY{ 61, 1 }, coords + ScreenCoordsXY{ 61 + 121, 9 } }, colours[1], INSET_RECT_F_30); - if (!blinkFlag || game_is_paused() || (gCurrentRealTimeTicks & 8) == 0) + if (!blinkFlag || GameIsPaused() || (gCurrentRealTimeTicks & 8) == 0) { value *= 118; value >>= 8; diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 540fe89651..3f44244db7 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -372,7 +372,7 @@ private: auto destPath = env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, OpenRCT2::DIRID::TRACK); if (!Platform::EnsureDirectoryExists(destPath.c_str())) { - log_error("Unable to create directory '%s'", destPath.c_str()); + LOG_ERROR("Unable to create directory '%s'", destPath.c_str()); ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); return; } @@ -381,7 +381,7 @@ private: if (File::Exists(destPath)) { - log_info("%s already exists, prompting user for a different track design name", destPath.c_str()); + LOG_INFO("%s already exists, prompting user for a different track design name", destPath.c_str()); ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {}); WindowTextInputRawOpen( this, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN, STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME, @@ -413,12 +413,12 @@ rct_window* WindowInstallTrackOpen(const utf8* path) object_manager_unload_all_objects(); if (trackDesign->type == RIDE_TYPE_NULL) { - log_error("Failed to load track (ride type null): %s", path); + LOG_ERROR("Failed to load track (ride type null): %s", path); return nullptr; } if (object_manager_load_object(&trackDesign->vehicle_object.Entry) == nullptr) { - log_error("Failed to load track (vehicle load fail): %s", path); + LOG_ERROR("Failed to load track (vehicle load fail): %s", path); return nullptr; } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 3ef8ed858a..827f5b15d2 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -68,7 +68,7 @@ public: ShowGridlines(); ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ShowLandRights(); @@ -391,7 +391,7 @@ private: bool LandRightsToolIsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::LandRights) return false; diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 80ba5d0d58..8d1f340060 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -482,7 +482,7 @@ static u8string OpenSystemFileBrowser(bool isSave) { // When the given save type was given, Windows still interprets a filename with a dot in its name as a custom // extension, meaning files like "My Coaster v1.2" will not get the .td6 extension by default. - if (isSave && get_file_extension_type(outPath) != fileType) + if (isSave && GetFileExtensionType(outPath) != fileType) outPath = Path::WithExtension(outPath, extension); } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index a24c699e31..aed536f635 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -171,7 +171,7 @@ public: { _mapImageData.clear(); _mapImageData.shrink_to_fit(); - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == classification + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == classification && gCurrentToolWidget.window_number == number) { ToolCancel(); @@ -243,7 +243,7 @@ public: break; gParkEntranceGhostExists = false; - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ShowGridlines(); ShowLandRights(); @@ -815,7 +815,7 @@ public: if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) { // scenario editor: build park entrance selected, show rotate button - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map && gCurrentToolWidget.widget_index == WIDX_BUILD_PARK_ENTRANCE) { widgets[WIDX_ROTATE_90].type = WindowWidgetType::FlatBtn; @@ -825,7 +825,7 @@ public: widgets[WIDX_SET_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; // If any tool is active - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map) + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map) { // if not in set land rights mode: show the default scenario editor buttons if (gCurrentToolWidget.widget_index != WIDX_SET_LAND_RIGHTS) diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index c224233b36..514a5bccfd 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -71,8 +71,8 @@ void WindowMapTooltipUpdateVisibility() // Check for cursor movement _cursorHoldDuration++; - if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (input_test_flag(INPUT_FLAG_5)) - || input_get_state() == InputState::ViewportRight) + if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (InputTestFlag(INPUT_FLAG_5)) + || InputGetState() == InputState::ViewportRight) _cursorHoldDuration = 0; _lastCursor = cursor; diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 8e85c6fecb..d11e5136d2 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -241,7 +241,7 @@ public: case RideConstructionState::Front: case RideConstructionState::Back: case RideConstructionState::Selected: - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) { ToolCancel(); @@ -311,7 +311,7 @@ private: gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? ENTRANCE_TYPE_RIDE_ENTRANCE : ENTRANCE_TYPE_RIDE_EXIT; gRideEntranceExitPlaceRideIndex = rideId; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); RideConstructionInvalidateCurrentTrack(); diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index bfdf29c411..53cd4c803c 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -203,7 +203,7 @@ private: auto& entry = _entries[_currentDownloadIndex]; auto name = String::Trim(std::string(entry.GetName())); - log_verbose("Downloading object: [%s]:", name.c_str()); + LOG_VERBOSE("Downloading object: [%s]:", name.c_str()); _currentDownloadIndex++; UpdateProgress({ name, _lastDownloadSource, _currentDownloadIndex, _entries.size() }); try diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 66e8f0781a..8ed23761a3 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1225,7 +1225,7 @@ private: ContextShowError(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {}); } // report error to console regardless - log_error("Failed to open language file."); + LOG_ERROR("Failed to open language file."); } else { diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index bdaaed201d..a278a8663f 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -207,7 +207,7 @@ public: void OnClose() override { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && classification == gCurrentToolWidget.window_classification + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) { ToolCancel(); @@ -1175,7 +1175,7 @@ private: #pragma region Common void SetPage(int32_t newPage) { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) ToolCancel(); diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index e478f87a17..7c4a8958c9 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -247,7 +247,7 @@ private: if (!ToolSet(*this, 0, Tool::WalkDown)) { ShowGridlines(); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); SetPatrolAreaToRender(_staffId); GfxInvalidateScreen(); } @@ -264,7 +264,7 @@ private: bool PatrolAreaToolIsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::PatrolArea) return false; diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index b6cdc21ad9..476ce74675 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1204,7 +1204,7 @@ rct_window* WindowRideMainOpen(const Ride& ride) w->ride.view = 0; } - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number) { @@ -1240,7 +1240,7 @@ static rct_window* WindowRideOpenStation(const Ride& ride, StationIndex stationI w->ride.var_482 = -1; } - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification && gCurrentToolWidget.window_number == w->number) { ToolCancel(); @@ -1343,7 +1343,7 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) { w->Invalidate(); - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification && gCurrentToolWidget.window_number == w->number) { ToolCancel(); @@ -1410,7 +1410,7 @@ static void WindowRideSetPage(rct_window* w, int32_t page) { int32_t listen; - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number) ToolCancel(); @@ -3770,7 +3770,7 @@ static void WindowRideMaintenanceDrawBar( if (colour & BAR_BLINK) { colour &= ~BAR_BLINK; - if (game_is_not_paused() && (gCurrentRealTimeTicks & 8)) + if (GameIsNotPaused() && (gCurrentRealTimeTicks & 8)) return; } @@ -4271,7 +4271,7 @@ static void WindowRideSetTrackColourScheme(rct_window* w, const ScreenCoordsXY& */ static void WindowRideColourClose(rct_window* w) { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return; if (gCurrentToolWidget.window_classification != w->classification) @@ -6236,7 +6236,7 @@ static void WindowRideGraphsScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i intensityThresholdNegative = -(RIDE_G_FORCES_RED_LATERAL / 8) + LateralGraphHeightOffset; break; default: - log_error("Wrong graph type %d", listType); + LOG_ERROR("Wrong graph type %d", listType); firstPoint = secondPoint = 0; break; } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 39da661e8c..1090af6324 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -909,7 +909,7 @@ public: case RideConstructionState::Front: case RideConstructionState::Back: case RideConstructionState::Selected: - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) { ToolCancel(); @@ -2422,7 +2422,7 @@ private: gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE; gRideEntranceExitPlaceRideIndex = _currentRideIndex; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); RideConstructionInvalidateCurrentTrack(); if (_rideConstructionState != RideConstructionState::EntranceExit) { @@ -2448,7 +2448,7 @@ private: gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT; gRideEntranceExitPlaceRideIndex = _currentRideIndex; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); RideConstructionInvalidateCurrentTrack(); if (_rideConstructionState != RideConstructionState::EntranceExit) { @@ -3599,7 +3599,7 @@ void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) if (w != nullptr) { ToolSet(*w, WIDX_CONSTRUCT, Tool::Crosshair); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); _trackPlaceCtrlState = false; _trackPlaceShiftState = false; } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index cfc7973655..b918b764a9 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -72,7 +72,7 @@ static void WindowSavePromptCallback(int32_t result, const utf8* path) { if (result == MODAL_RESULT_OK) { - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); } } @@ -140,7 +140,7 @@ public: switch (widgetIndex) { case WQIDX_OK: - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); break; case WQIDX_CLOSE: case WQIDX_CANCEL: @@ -164,7 +164,7 @@ public: } else { - intent = create_save_game_as_intent(); + intent = CreateSaveGameAsIntent(); } Close(); intent->putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); @@ -172,7 +172,7 @@ public: break; } case WIDX_DONT_SAVE: - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); return; case WIDX_CLOSE: case WIDX_CANCEL: @@ -198,7 +198,7 @@ rct_window* WindowSavePromptOpen() // do not show save prompt if we're in the title demo and click on load game if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) { - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); return nullptr; } @@ -212,7 +212,7 @@ rct_window* WindowSavePromptOpen() if (gScreenAge < 3840 && network_get_mode() == NETWORK_MODE_NONE) { - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); return nullptr; } } @@ -226,7 +226,7 @@ rct_window* WindowSavePromptOpen() if (EnumValue(prompt_mode) >= std::size(window_save_prompt_labels)) { - log_warning("Invalid save prompt mode %u", prompt_mode); + LOG_WARNING("Invalid save prompt mode %u", prompt_mode); return nullptr; } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 636bd322ba..3b5c504f65 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -354,7 +354,7 @@ public: _hoverCounter++; if (_hoverCounter < 8) { - if (input_get_state() != InputState::ScrollLeft) + if (InputGetState() != InputState::ScrollLeft) { min_height = WINDOW_SCENERY_MIN_HEIGHT; max_height = WINDOW_SCENERY_MIN_HEIGHT; @@ -379,7 +379,7 @@ public: else { _hoverCounter = 0; - if (input_get_state() != InputState::ScrollLeft) + if (InputGetState() != InputState::ScrollLeft) { min_height = WINDOW_SCENERY_MIN_HEIGHT; max_height = WINDOW_SCENERY_MIN_HEIGHT; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index d0876af7f3..9df2d13e29 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -592,7 +592,7 @@ static void ServerListFetchServersCheck(rct_window* w) catch (const std::exception& e) { _statusText = STR_SERVER_LIST_NO_CONNECTION; - log_warning("Unable to connect to master server: %s", e.what()); + LOG_WARNING("Unable to connect to master server: %s", e.what()); } _fetchFuture = {}; w->Invalidate(); diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 300f99fa51..56016694bc 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -281,7 +281,7 @@ private: char _password[33]; static void ScenarioSelectCallback(const utf8* path) { - game_notify_map_change(); + GameNotifyMapChange(); if (GetContext()->LoadParkFromFile(path, false, true)) { network_begin_server(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); @@ -292,7 +292,7 @@ private: { if (result == MODAL_RESULT_OK) { - game_notify_map_change(); + GameNotifyMapChange(); GetContext()->LoadParkFromFile(path); network_begin_server(gConfigNetwork.DefaultPort, gConfigNetwork.ListenAddress); } diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 694fdf0735..5a41d02848 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -1062,7 +1062,7 @@ private: void CancelTools() { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (number == gCurrentToolWidget.window_number && classification == gCurrentToolWidget.window_classification) ToolCancel(); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 94768a5542..f3115dacd4 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -577,7 +577,7 @@ private: void CancelTools() { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number) { diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 3d33c285c7..68172536ed 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -57,10 +57,10 @@ static Widget window_title_menu_widgets[] = { static void WindowTitleMenuScenarioselectCallback(const utf8* path) { - game_notify_map_change(); + GameNotifyMapChange(); OpenRCT2::GetContext()->LoadParkFromFile(path, false, true); - game_load_scripts(); - game_notify_map_changed(); + GameLoadScripts(); + GameNotifyMapChanged(); } static void InvokeCustomToolboxMenuItem(size_t index) diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 294282e651..be969e4385 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -65,12 +65,12 @@ public: void OnOpen() override { widgets = window_tooltip_widgets; - reset_tooltip_not_shown(); + ResetTooltipNotShown(); } void OnUpdate() override { - reset_tooltip_not_shown(); + ResetTooltipNotShown(); } void OnDraw(rct_drawpixelinfo& dpi) override @@ -128,8 +128,8 @@ void WindowTooltipReset(const ScreenCoordsXY& screenCoords) gTooltipCursor = screenCoords; gTooltipTimeout = 0; gTooltipWidget.window_classification = WindowClass::Null; - input_set_state(InputState::Normal); - input_set_flag(INPUT_FLAG_4, false); + InputSetState(InputState::Normal); + InputSetFlag(INPUT_FLAG_4, false); } void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 2ca63c66ad..7a77d1a809 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -384,7 +384,7 @@ static void WindowTopToolbarMouseup(rct_window* w, WidgetIndex widgetIndex) case WIDX_SCENERY: if (!ToolSet(*w, WIDX_SCENERY, Tool::Arrow)) { - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ContextOpenWindow(WindowClass::Scenery); } break; @@ -576,7 +576,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int } case DDIDX_SAVE_GAME: ToolCancel(); - save_game(); + SaveGame(); break; case DDIDX_SAVE_GAME_AS: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) @@ -589,7 +589,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int else { ToolCancel(); - save_game_as(); + SaveGameAs(); } break; case DDIDX_ABOUT: @@ -848,7 +848,7 @@ static void WindowTopToolbarInvalidate(rct_window* w) const auto* mainWindow = WindowGetMain(); if (mainWindow == nullptr || mainWindow->viewport == nullptr) { - log_error("mainWindow or mainWindow->viewport is null!"); + LOG_ERROR("mainWindow or mainWindow->viewport is null!"); return; } @@ -3801,7 +3801,7 @@ static void ToggleFootpathWindow() */ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_LAND) { ToolCancel(); @@ -3811,7 +3811,7 @@ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex) _landToolBlocked = false; ShowGridlines(); ToolSet(*topToolbar, widgetIndex, Tool::DigDown); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ContextOpenWindow(WindowClass::Land); } } @@ -3822,7 +3822,7 @@ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex) */ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) { ToolCancel(); @@ -3831,7 +3831,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetI { ShowGridlines(); ToolSet(*topToolbar, widgetIndex, Tool::Crosshair); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ContextOpenWindow(WindowClass::ClearScenery); } } @@ -3842,7 +3842,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetI */ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar + if ((InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_WATER) { ToolCancel(); @@ -3852,7 +3852,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex) _landToolBlocked = false; ShowGridlines(); ToolSet(*topToolbar, widgetIndex, Tool::WaterDown); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); ContextOpenWindow(WindowClass::Water); } } @@ -3863,7 +3863,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex) */ bool LandToolIsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; @@ -3878,7 +3878,7 @@ bool LandToolIsActive() */ bool ClearSceneryToolIsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; @@ -3893,7 +3893,7 @@ bool ClearSceneryToolIsActive() */ bool WaterToolIsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index b7e777609a..9aa294a10c 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -80,7 +80,7 @@ public: widgets = window_track_place_widgets; WindowInitScrollWidgets(*this); ToolSet(*this, WIDX_PRICE, Tool::Crosshair); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); WindowPushOthersRight(*this); ShowGridlines(); _miniPreview.resize(TRACK_MINI_PREVIEW_SIZE); @@ -136,7 +136,7 @@ public: void OnUpdate() override { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) if (gCurrentToolWidget.window_classification != WindowClass::TrackDesignPlace) Close(); } @@ -173,7 +173,7 @@ public: mapZ = GetBaseZ(mapCoords); CoordsXYZD trackLoc = { mapCoords, mapZ, _currentTrackPieceDirection }; - if (game_is_not_paused() || gCheatsBuildInPauseMode) + if (GameIsNotPaused() || gCheatsBuildInPauseMode) { ClearProvisional(); auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 526a26cb77..961ced78db 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -388,7 +388,7 @@ private: bool IsActive() { - if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + if (!(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) return false; if (gCurrentToolWidget.window_classification != WindowClass::ViewClipping) return false; diff --git a/src/openrct2/AssetPackManager.cpp b/src/openrct2/AssetPackManager.cpp index 199864f622..eb4b686d4b 100644 --- a/src/openrct2/AssetPackManager.cpp +++ b/src/openrct2/AssetPackManager.cpp @@ -127,7 +127,7 @@ void AssetPackManager::ClearAssetPacks() void AssetPackManager::AddAssetPack(const fs::path& path) { auto szPath = path.u8string(); - log_verbose("Scanning asset pack: %s", szPath.c_str()); + LOG_VERBOSE("Scanning asset pack: %s", szPath.c_str()); try { auto ap = std::make_unique(path); diff --git a/src/openrct2/CmdlineSprite.cpp b/src/openrct2/CmdlineSprite.cpp index d15ef2764d..51d0813f24 100644 --- a/src/openrct2/CmdlineSprite.cpp +++ b/src/openrct2/CmdlineSprite.cpp @@ -263,7 +263,7 @@ static std::string PopStr(std::ostringstream& oss) return str; } -int32_t cmdline_for_sprite(const char** argv, int32_t argc) +int32_t CmdLineForSprite(const char** argv, int32_t argc) { gOpenRCT2Headless = true; if (argc == 0) @@ -603,7 +603,7 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc) if (!spriteFile.Save(spriteFilePath)) { - log_error("Could not save sprite file, cancelling."); + LOG_ERROR("Could not save sprite file, cancelling."); return -1; } diff --git a/src/openrct2/CmdlineSprite.h b/src/openrct2/CmdlineSprite.h index bc14f3c212..e4e5094351 100644 --- a/src/openrct2/CmdlineSprite.h +++ b/src/openrct2/CmdlineSprite.h @@ -12,5 +12,5 @@ #include "common.h" #include "drawing/ImageImporter.h" -int32_t cmdline_for_sprite(const char** argv, int32_t argc); +int32_t CmdLineForSprite(const char** argv, int32_t argc); extern OpenRCT2::Drawing::ImageImporter::ImportMode gSpriteMode; diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 14ddb1b5c0..6082798ac2 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -353,14 +353,14 @@ namespace OpenRCT2 } catch (const std::exception& e) { - log_error("Failed to open configured language: %s", e.what()); + LOG_ERROR("Failed to open configured language: %s", e.what()); try { _localisationService->OpenLanguage(LANGUAGE_ENGLISH_UK); } catch (const std::exception& eFallback) { - log_fatal("Failed to open fallback language: %s", eFallback.what()); + LOG_FATAL("Failed to open fallback language: %s", eFallback.what()); auto uiContext = GetContext()->GetUiContext(); uiContext->ShowMessageBox("Failed to load language file!\nYour installation may be damaged."); return false; @@ -369,7 +369,7 @@ namespace OpenRCT2 // TODO add configuration option to allow multiple instances // if (!gOpenRCT2Headless && !Platform::LockSingleInstance()) { - // log_fatal("OpenRCT2 is already running."); + // LOG_FATAL("OpenRCT2 is already running."); // return false; // } //This comment was relocated so it would stay where it was in relation to the following lines of code. @@ -473,7 +473,7 @@ namespace OpenRCT2 LightFXInit(); } - input_reset_place_obj_modifier(); + InputResetPlaceObjModifier(); ViewportInitAll(); _gameState = std::make_unique(); @@ -503,12 +503,12 @@ namespace OpenRCT2 if (_drawingEngineType == DrawingEngine::Software) { _drawingEngineType = DrawingEngine::None; - log_fatal("Unable to create a drawing engine."); + LOG_FATAL("Unable to create a drawing engine."); exit(-1); } else { - log_error("Unable to create drawing engine. Falling back to software."); + LOG_ERROR("Unable to create drawing engine. Falling back to software."); // Fallback to software gConfigGeneral.DrawingEngine = DrawingEngine::Software; @@ -529,14 +529,14 @@ namespace OpenRCT2 if (_drawingEngineType == DrawingEngine::Software) { _drawingEngineType = DrawingEngine::None; - log_error(ex.what()); - log_fatal("Unable to initialise a drawing engine."); + LOG_ERROR(ex.what()); + LOG_FATAL("Unable to initialise a drawing engine."); exit(-1); } else { - log_error(ex.what()); - log_error("Unable to initialise drawing engine. Falling back to software."); + LOG_ERROR(ex.what()); + LOG_ERROR("Unable to initialise drawing engine. Falling back to software."); // Fallback to software gConfigGeneral.DrawingEngine = DrawingEngine::Software; @@ -557,7 +557,7 @@ namespace OpenRCT2 bool LoadParkFromFile( const std::string& path, bool loadTitleScreenOnFail = false, bool asScenario = false) final override { - log_verbose("Context::LoadParkFromFile(%s)", path.c_str()); + LOG_VERBOSE("Context::LoadParkFromFile(%s)", path.c_str()); struct CrashAdditionalFileRegistration { @@ -645,13 +645,13 @@ namespace OpenRCT2 // so reload the title screen if that happens. loadTitleScreenFirstOnFail = true; - game_unload_scripts(); + GameUnloadScripts(); _objectManager->LoadObjects(result.RequiredObjects); parkImporter->Import(); gScenarioSavePath = path; gCurrentLoadedPath = path; gFirstTimeSaving = true; - game_fix_save_vars(); + GameFixSaveVars(); MapAnimationAutoCreate(); EntityTweener::Get().Reset(); gScreenAge = 0; @@ -668,7 +668,7 @@ namespace OpenRCT2 _network.Close(); } #endif - game_load_init(); + GameLoadInit(); #ifndef DISABLE_NETWORK if (_network.GetMode() == NETWORK_MODE_SERVER) { @@ -703,7 +703,7 @@ namespace OpenRCT2 #ifdef USE_BREAKPAD if (_network.GetMode() == NETWORK_MODE_NONE) { - start_silent_record(); + StartSilentRecord(); } #endif if (result.SemiCompatibleVersion) @@ -826,7 +826,7 @@ namespace OpenRCT2 // Check install directory if (gConfigGeneral.RCT2Path.empty() || !Platform::OriginalGameDataExists(gConfigGeneral.RCT2Path)) { - log_verbose( + LOG_VERBOSE( "install directory does not exist or invalid directory selected, %s", gConfigGeneral.RCT2Path.c_str()); if (!ConfigFindOrBrowseInstallDirectory()) { @@ -865,7 +865,7 @@ namespace OpenRCT2 if (!_versionCheckFuture.valid()) { _versionCheckFuture = std::async(std::launch::async, [this] { - _newVersionInfo = get_latest_version(); + _newVersionInfo = GetLatestVersion(); if (!String::StartsWith(gVersionInfoTag, _newVersionInfo.tag)) { _hasNewVersionInfo = true; @@ -969,8 +969,8 @@ namespace OpenRCT2 else #endif // DISABLE_NETWORK { - game_load_scripts(); - game_notify_map_changed(); + GameLoadScripts(); + GameNotifyMapChanged(); } break; } @@ -1030,7 +1030,7 @@ namespace OpenRCT2 { PROFILED_FUNCTION(); - log_verbose("begin openrct2 loop"); + LOG_VERBOSE("begin openrct2 loop"); _finished = false; #ifndef __EMSCRIPTEN__ @@ -1047,7 +1047,7 @@ namespace OpenRCT2 }, this, 0, 1); #endif // __EMSCRIPTEN__ - log_verbose("finish openrct2 loop"); + LOG_VERBOSE("finish openrct2 loop"); } void RunFrame() @@ -1178,7 +1178,7 @@ namespace OpenRCT2 // this to be 40Hz (25 ms). Refactor this once the UI is decoupled. gCurrentDeltaTime = static_cast(GAME_UPDATE_TIME_MS * 1000.0f); - if (game_is_not_paused()) + if (GameIsNotPaused()) { gPaletteEffectFrame += gCurrentDeltaTime; } @@ -1187,7 +1187,7 @@ namespace OpenRCT2 if (gIntroState != IntroState::None) { - intro_update(); + IntroUpdate(); } else if ((gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !gOpenRCT2Headless) { @@ -1242,7 +1242,7 @@ namespace OpenRCT2 { auto path = _env->GetDirectoryPath(dirBase, dirId); if (!Platform::EnsureDirectoryExists(path.c_str())) - log_error("Unable to create directory '%s'.", path.c_str()); + LOG_ERROR("Unable to create directory '%s'.", path.c_str()); } } @@ -1264,7 +1264,7 @@ namespace OpenRCT2 void CopyOriginalUserFilesOver(const std::string& srcRoot, const std::string& dstRoot, const std::string& pattern) { - log_verbose("CopyOriginalUserFilesOver('%s', '%s', '%s')", srcRoot.c_str(), dstRoot.c_str(), pattern.c_str()); + LOG_VERBOSE("CopyOriginalUserFilesOver('%s', '%s', '%s')", srcRoot.c_str(), dstRoot.c_str(), pattern.c_str()); auto scanPattern = Path::Combine(srcRoot, pattern); auto scanner = Path::ScanDirectory(scanPattern, true); @@ -1377,12 +1377,12 @@ bool ContextLoadParkFromStream(void* stream) return GetContext()->LoadParkFromStream(static_cast(stream), ""); } -void openrct2_write_full_version_info(utf8* buffer, size_t bufferSize) +void OpenRCT2WriteFullVersionInfo(utf8* buffer, size_t bufferSize) { String::Set(buffer, bufferSize, gVersionInfoFull); } -void openrct2_finish() +void OpenRCT2Finish() { GetContext()->Finish(); } @@ -1565,7 +1565,7 @@ bool ContextOpenCommonFileDialog(utf8* outFilename, OpenRCT2::Ui::FileDialogDesc } catch (const std::exception& ex) { - log_error(ex.what()); + LOG_ERROR(ex.what()); outFilename[0] = '\0'; return false; } @@ -1579,7 +1579,7 @@ u8string ContextOpenCommonFileDialog(OpenRCT2::Ui::FileDialogDesc& desc) } catch (const std::exception& ex) { - log_error(ex.what()); + LOG_ERROR(ex.what()); return u8string{}; } } diff --git a/src/openrct2/Diagnostic.cpp b/src/openrct2/Diagnostic.cpp index 91ab672954..a772ea0306 100644 --- a/src/openrct2/Diagnostic.cpp +++ b/src/openrct2/Diagnostic.cpp @@ -42,7 +42,7 @@ int _android_log_priority[static_cast(DiagnosticLevel::Count)] = { ANDROID_LOG_FATAL, ANDROID_LOG_ERROR, ANDROID_LOG_WARN, ANDROID_LOG_VERBOSE, ANDROID_LOG_INFO, }; -void diagnostic_log(DiagnosticLevel diagnosticLevel, const char* format, ...) +void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...) { va_list args; @@ -54,7 +54,7 @@ void diagnostic_log(DiagnosticLevel diagnosticLevel, const char* format, ...) va_end(args); } -void diagnostic_log_with_location( +void DiagnosticLogWithLocation( DiagnosticLevel diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...) { va_list args; @@ -76,7 +76,7 @@ static constexpr const char* _level_strings[] = { "FATAL", "ERROR", "WARNING", "VERBOSE", "INFO", }; -static void diagnostic_print(DiagnosticLevel level, const std::string& prefix, const std::string& msg) +static void DiagnosticPrint(DiagnosticLevel level, const std::string& prefix, const std::string& msg) { auto stream = diagnostic_get_stream(level); if (stream == stdout) @@ -85,7 +85,7 @@ static void diagnostic_print(DiagnosticLevel level, const std::string& prefix, c Console::Error::WriteLine("%s%s", prefix.c_str(), msg.c_str()); } -void diagnostic_log(DiagnosticLevel diagnosticLevel, const char* format, ...) +void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...) { va_list args; if (_log_levels[static_cast(diagnosticLevel)]) @@ -98,11 +98,11 @@ void diagnostic_log(DiagnosticLevel diagnosticLevel, const char* format, ...) auto msg = String::Format_VA(format, args); va_end(args); - diagnostic_print(diagnosticLevel, prefix, msg); + DiagnosticPrint(diagnosticLevel, prefix, msg); } } -void diagnostic_log_with_location( +void DiagnosticLogWithLocation( DiagnosticLevel diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...) { va_list args; @@ -125,7 +125,7 @@ void diagnostic_log_with_location( auto msg = String::Format_VA(format, args); va_end(args); - diagnostic_print(diagnosticLevel, prefix, msg); + DiagnosticPrint(diagnosticLevel, prefix, msg); } } diff --git a/src/openrct2/Diagnostic.h b/src/openrct2/Diagnostic.h index 340726ee19..281452f25f 100644 --- a/src/openrct2/Diagnostic.h +++ b/src/openrct2/Diagnostic.h @@ -70,20 +70,20 @@ enum class DiagnosticLevel extern bool _log_levels[static_cast(DiagnosticLevel::Count)]; -void diagnostic_log(DiagnosticLevel diagnosticLevel, const char* format, ...); -void diagnostic_log_with_location( +void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...); +void DiagnosticLogWithLocation( DiagnosticLevel diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...); #ifdef _MSC_VER -# define diagnostic_log_macro(level, format, ...) \ - diagnostic_log_with_location(level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__) +# define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ + DiagnosticLogWithLocation(level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__) #else -# define diagnostic_log_macro(level, format, ...) \ - diagnostic_log_with_location(level, __FILE__, __func__, __LINE__, format, ##__VA_ARGS__) +# define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ + DiagnosticLogWithLocation(level, __FILE__, __func__, __LINE__, format, ##__VA_ARGS__) #endif // _MSC_VER -#define log_fatal(format, ...) diagnostic_log_macro(DiagnosticLevel::Fatal, format, ##__VA_ARGS__) -#define log_error(format, ...) diagnostic_log_macro(DiagnosticLevel::Error, format, ##__VA_ARGS__) -#define log_warning(format, ...) diagnostic_log_macro(DiagnosticLevel::Warning, format, ##__VA_ARGS__) -#define log_verbose(format, ...) diagnostic_log(DiagnosticLevel::Verbose, format, ##__VA_ARGS__) -#define log_info(format, ...) diagnostic_log_macro(DiagnosticLevel::Information, format, ##__VA_ARGS__) +#define LOG_FATAL(format, ...) DIAGNOSTIC_LOG_MACRO(DiagnosticLevel::Fatal, format, ##__VA_ARGS__) +#define LOG_ERROR(format, ...) DIAGNOSTIC_LOG_MACRO(DiagnosticLevel::Error, format, ##__VA_ARGS__) +#define LOG_WARNING(format, ...) DIAGNOSTIC_LOG_MACRO(DiagnosticLevel::Warning, format, ##__VA_ARGS__) +#define LOG_VERBOSE(format, ...) DiagnosticLog(DiagnosticLevel::Verbose, format, ##__VA_ARGS__) +#define LOG_INFO(format, ...) DIAGNOSTIC_LOG_MACRO(DiagnosticLevel::Information, format, ##__VA_ARGS__) diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 4fa3043c46..4450badf72 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -66,7 +66,7 @@ namespace Editor static bool ReadPark(const char* path); static void ClearMapForEditing(bool fromSave); - static void object_list_load() + static void ObjectListLoad() { auto* context = GetContext(); @@ -104,7 +104,7 @@ namespace Editor void Load() { OpenRCT2::Audio::StopAll(); - object_list_load(); + ObjectListLoad(); OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; gEditorStep = EditorStep::ObjectSelection; @@ -165,7 +165,7 @@ namespace Editor gScreenAge = 0; object_manager_unload_all_objects(); - object_list_load(); + ObjectListLoad(); OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); SetAllLandOwned(); gEditorStep = EditorStep::ObjectSelection; @@ -186,7 +186,7 @@ namespace Editor gScreenAge = 0; object_manager_unload_all_objects(); - object_list_load(); + ObjectListLoad(); OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); SetAllLandOwned(); gEditorStep = EditorStep::ObjectSelection; @@ -223,7 +223,7 @@ namespace Editor // after we have loaded a new park. WindowCloseAll(); - auto extension = get_file_extension_type(path); + auto extension = GetFileExtensionType(path); switch (extension) { case FileExtension::SC6: @@ -417,7 +417,7 @@ namespace Editor auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->SetMainView(gSavedView, gSavedViewZoom, gSavedViewRotation); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); ScenerySetDefaultPlacementConfiguration(); windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_NEW_RIDES)); @@ -438,46 +438,46 @@ namespace Editor if (!isTrackDesignerManager) { - if (!editor_check_object_group_at_least_one_surface_selected(false)) + if (!EditorCheckObjectGroupAtLeastOneSurfaceSelected(false)) { return { ObjectType::FootpathSurface, STR_AT_LEAST_ONE_FOOTPATH_NON_QUEUE_SURFACE_OBJECT_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_surface_selected(true)) + if (!EditorCheckObjectGroupAtLeastOneSurfaceSelected(true)) { return { ObjectType::FootpathSurface, STR_AT_LEAST_ONE_FOOTPATH_QUEUE_SURFACE_OBJECT_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_selected(ObjectType::FootpathRailings)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::FootpathRailings)) { return { ObjectType::FootpathRailings, STR_AT_LEAST_ONE_FOOTPATH_RAILING_OBJECT_MUST_BE_SELECTED }; } } - if (!editor_check_object_group_at_least_one_selected(ObjectType::Ride)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::Ride)) { return { ObjectType::Ride, STR_AT_LEAST_ONE_RIDE_OBJECT_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_selected(ObjectType::Station)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::Station)) { return { ObjectType::Station, STR_AT_LEAST_ONE_STATION_OBJECT_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_selected(ObjectType::TerrainSurface)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::TerrainSurface)) { return { ObjectType::TerrainSurface, STR_AT_LEAST_ONE_TERRAIN_SURFACE_OBJECT_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_selected(ObjectType::TerrainEdge)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::TerrainEdge)) { return { ObjectType::TerrainEdge, STR_AT_LEAST_ONE_TERRAIN_EDGE_OBJECT_MUST_BE_SELECTED }; } if (!isTrackDesignerManager) { - if (!editor_check_object_group_at_least_one_selected(ObjectType::ParkEntrance)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::ParkEntrance)) { return { ObjectType::ParkEntrance, STR_PARK_ENTRANCE_TYPE_MUST_BE_SELECTED }; } - if (!editor_check_object_group_at_least_one_selected(ObjectType::Water)) + if (!EditorCheckObjectGroupAtLeastOneSelected(ObjectType::Water)) { return { ObjectType::Water, STR_WATER_TYPE_MUST_BE_SELECTED }; } @@ -565,7 +565,7 @@ namespace Editor } } // namespace Editor -void editor_open_windows_for_current_step() +void EditorOpenWindowsForCurrentStep() { Editor::OpenWindowsForCurrentStep(); } diff --git a/src/openrct2/Editor.h b/src/openrct2/Editor.h index ba218e56c0..7890e73b5f 100644 --- a/src/openrct2/Editor.h +++ b/src/openrct2/Editor.h @@ -47,4 +47,4 @@ enum class EditorStep : uint8_t extern EditorStep gEditorStep; -void editor_open_windows_for_current_step(); +void EditorOpenWindowsForCurrentStep(); diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 3e0e85ee91..03d23d0877 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -38,10 +38,10 @@ std::vector _objectSelectionFlags; int32_t _numSelectedObjectsForType[EnumValue(ObjectType::Count)]; static int32_t _numAvailableObjectsForType[EnumValue(ObjectType::Count)]; -static void setup_in_use_selection_flags(); -static void setup_track_designer_objects(); -static void setup_track_manager_objects(); -static void window_editor_object_selection_select_default_objects(); +static void SetupInUseSelectionFlags(); +static void SetupTrackDesignerObjects(); +static void SetupTrackManagerObjects(); +static void WindowEditorObjectSelectionSelectDefaultObjects(); static void SelectDesignerObjects(); static void ReplaceSelectedWaterPalette(const ObjectRepositoryItem* item); @@ -53,7 +53,7 @@ static void ReplaceSelectedWaterPalette(const ObjectRepositoryItem* item); static constexpr ResultWithMessage ObjectSelectionError(bool isMasterObject, StringId message) { if (!isMasterObject) - reset_selected_object_count_and_size(); + ResetSelectedObjectCountAndSize(); return { false, message }; } @@ -62,7 +62,7 @@ static constexpr ResultWithMessage ObjectSelectionError(bool isMasterObject, Str * * rct2: 0x006ABCD1 */ -static void setup_track_manager_objects() +static void SetupTrackManagerObjects() { int32_t numObjects = static_cast(object_repository_get_items_count()); const ObjectRepositoryItem* items = object_repository_get_items(); @@ -90,7 +90,7 @@ static void setup_track_manager_objects() * * rct2: 0x006ABC1E */ -static void setup_track_designer_objects() +static void SetupTrackDesignerObjects() { int32_t numObjects = static_cast(object_repository_get_items_count()); const ObjectRepositoryItem* items = object_repository_get_items(); @@ -122,7 +122,7 @@ static void setup_track_designer_objects() * * rct2: 0x006AA82B */ -void setup_in_use_selection_flags() +void SetupInUseSelectionFlags() { auto& objectMgr = OpenRCT2::GetContext()->GetObjectManager(); @@ -298,34 +298,34 @@ void sub_6AB211() if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { - setup_track_designer_objects(); + SetupTrackDesignerObjects(); } if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - setup_track_manager_objects(); + SetupTrackManagerObjects(); } - setup_in_use_selection_flags(); - reset_selected_object_count_and_size(); + SetupInUseSelectionFlags(); + ResetSelectedObjectCountAndSize(); if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { // To prevent it breaking in scenario mode. if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - window_editor_object_selection_select_default_objects(); + WindowEditorObjectSelectionSelectDefaultObjects(); } } - reset_selected_object_count_and_size(); + ResetSelectedObjectCountAndSize(); } /** * * rct2: 0x006AB316 */ -void editor_object_flags_free() +void EditorObjectFlagsFree() { _objectSelectionFlags.clear(); _objectSelectionFlags.shrink_to_fit(); @@ -335,7 +335,7 @@ void editor_object_flags_free() * * rct2: 0x00685791 */ -static void remove_selected_objects_from_research(const ObjectEntryDescriptor& descriptor) +static void RemoveSelectedObjectsFromResearch(const ObjectEntryDescriptor& descriptor) { auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); auto obj = objManager.GetLoadedObject(descriptor); @@ -376,7 +376,7 @@ static void remove_selected_objects_from_research(const ObjectEntryDescriptor& d * * rct2: 0x006ABB66 */ -void unload_unselected_objects() +void UnloadUnselectedObjects() { auto numItems = static_cast(object_repository_get_items_count()); const auto* items = object_repository_get_items(); @@ -389,7 +389,7 @@ void unload_unselected_objects() auto descriptor = ObjectEntryDescriptor(items[i]); if (!IsIntransientObjectType(items[i].Type)) { - remove_selected_objects_from_research(descriptor); + RemoveSelectedObjectsFromResearch(descriptor); objectsToUnload.push_back(descriptor); } } @@ -401,13 +401,13 @@ void unload_unselected_objects() * * rct2: 0x006AA805 */ -static void window_editor_object_selection_select_default_objects() +static void WindowEditorObjectSelectionSelectDefaultObjects() { if (_numSelectedObjectsForType[0] == 0) { for (auto defaultSelectedObject : DefaultSelectedObjects) { - window_editor_object_selection_select_object( + WindowEditorObjectSelectionSelectObject( 0, INPUT_FLAG_EDITOR_OBJECT_SELECT | INPUT_FLAG_EDITOR_OBJECT_1 | INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP, @@ -422,7 +422,7 @@ static void SelectDesignerObjects() { for (auto designerSelectedObject : DesignerSelectedObjects) { - window_editor_object_selection_select_object( + WindowEditorObjectSelectionSelectObject( 0, INPUT_FLAG_EDITOR_OBJECT_SELECT | INPUT_FLAG_EDITOR_OBJECT_1 | INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP, @@ -452,7 +452,7 @@ static void ReplaceSelectedWaterPalette(const ObjectRepositoryItem* item) } else { - log_error("Failed to load selected palette %s", std::string(newPaletteEntry.GetName()).c_str()); + LOG_ERROR("Failed to load selected palette %s", std::string(newPaletteEntry.GetName()).c_str()); } } @@ -460,7 +460,7 @@ static void ReplaceSelectedWaterPalette(const ObjectRepositoryItem* item) * * rct2: 0x006AA770 */ -void reset_selected_object_count_and_size() +void ResetSelectedObjectCountAndSize() { for (auto& objectType : _numSelectedObjectsForType) { @@ -479,7 +479,7 @@ void reset_selected_object_count_and_size() } } -void finish_object_selection() +void FinishObjectSelection() { if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { @@ -501,7 +501,7 @@ void finish_object_selection() * * rct2: 0x006AB54F */ -ResultWithMessage window_editor_object_selection_select_object( +ResultWithMessage WindowEditorObjectSelectionSelectObject( uint8_t isMasterObject, int32_t flags, const ObjectRepositoryItem* item) { if (item == nullptr) @@ -544,7 +544,7 @@ ResultWithMessage window_editor_object_selection_select_object( { for (const auto& sgEntry : item->SceneryGroupInfo.Entries) { - window_editor_object_selection_select_object(++isMasterObject, flags, sgEntry); + WindowEditorObjectSelectionSelectObject(++isMasterObject, flags, sgEntry); } } @@ -578,7 +578,7 @@ ResultWithMessage window_editor_object_selection_select_object( { for (const auto& sgEntry : item->SceneryGroupInfo.Entries) { - const auto selectionResult = window_editor_object_selection_select_object(++isMasterObject, flags, sgEntry); + const auto selectionResult = WindowEditorObjectSelectionSelectObject(++isMasterObject, flags, sgEntry); if (!selectionResult.Successful) { _gSceneryGroupPartialSelectError = selectionResult.Message; @@ -611,15 +611,15 @@ ResultWithMessage window_editor_object_selection_select_object( return { true }; } -ResultWithMessage window_editor_object_selection_select_object( +ResultWithMessage WindowEditorObjectSelectionSelectObject( uint8_t isMasterObject, int32_t flags, const ObjectEntryDescriptor& descriptor) { auto& objectRepository = OpenRCT2::GetContext()->GetObjectRepository(); const auto* item = objectRepository.FindObject(descriptor); - return window_editor_object_selection_select_object(isMasterObject, flags, item); + return WindowEditorObjectSelectionSelectObject(isMasterObject, flags, item); } -bool editor_check_object_group_at_least_one_selected(ObjectType checkObjectType) +bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType) { auto numObjects = std::min(object_repository_get_items_count(), _objectSelectionFlags.size()); const ObjectRepositoryItem* items = object_repository_get_items(); @@ -635,7 +635,7 @@ bool editor_check_object_group_at_least_one_selected(ObjectType checkObjectType) return false; } -bool editor_check_object_group_at_least_one_surface_selected(bool queue) +bool EditorCheckObjectGroupAtLeastOneSurfaceSelected(bool queue) { auto numObjects = std::min(object_repository_get_items_count(), _objectSelectionFlags.size()); const auto* items = object_repository_get_items(); @@ -652,10 +652,10 @@ bool editor_check_object_group_at_least_one_surface_selected(bool queue) return false; } -int32_t editor_remove_unused_objects() +int32_t EditorRemoveUnusedObjects() { sub_6AB211(); - setup_in_use_selection_flags(); + SetupInUseSelectionFlags(); int32_t numObjects = static_cast(object_repository_get_items_count()); const ObjectRepositoryItem* items = object_repository_get_items(); @@ -682,8 +682,8 @@ int32_t editor_remove_unused_objects() } } } - unload_unselected_objects(); - editor_object_flags_free(); + UnloadUnselectedObjects(); + EditorObjectFlagsFree(); auto intent = Intent(INTENT_ACTION_REFRESH_SCENERY); ContextBroadcastIntent(&intent); diff --git a/src/openrct2/EditorObjectSelectionSession.h b/src/openrct2/EditorObjectSelectionSession.h index e55eb79d2a..87e537d86a 100644 --- a/src/openrct2/EditorObjectSelectionSession.h +++ b/src/openrct2/EditorObjectSelectionSession.h @@ -29,20 +29,20 @@ extern std::optional _gSceneryGroupPartialSelectError; extern std::vector _objectSelectionFlags; extern int32_t _numSelectedObjectsForType[EnumValue(ObjectType::Count)]; -bool editor_check_object_group_at_least_one_selected(ObjectType checkObjectType); -bool editor_check_object_group_at_least_one_surface_selected(bool queue); -void editor_object_flags_free(); -void unload_unselected_objects(); +bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType); +bool EditorCheckObjectGroupAtLeastOneSurfaceSelected(bool queue); +void EditorObjectFlagsFree(); +void UnloadUnselectedObjects(); void sub_6AB211(); -void reset_selected_object_count_and_size(); -void finish_object_selection(); -ResultWithMessage window_editor_object_selection_select_object( +void ResetSelectedObjectCountAndSize(); +void FinishObjectSelection(); +ResultWithMessage WindowEditorObjectSelectionSelectObject( uint8_t isMasterObject, int32_t flags, const ObjectRepositoryItem* item); -ResultWithMessage window_editor_object_selection_select_object( +ResultWithMessage WindowEditorObjectSelectionSelectObject( uint8_t isMasterObject, int32_t flags, const ObjectEntryDescriptor& entry); /** * Removes all unused objects from the object selection. * @return The number of removed objects. */ -int32_t editor_remove_unused_objects(); +int32_t EditorRemoveUnusedObjects(); diff --git a/src/openrct2/FileClassifier.cpp b/src/openrct2/FileClassifier.cpp index 02054f2c31..2ae0fc88c4 100644 --- a/src/openrct2/FileClassifier.cpp +++ b/src/openrct2/FileClassifier.cpp @@ -88,7 +88,7 @@ static bool TryClassifyAsPark(OpenRCT2::IStream* stream, ClassifiedFileInfo* res catch (const std::exception& e) { success = false; - log_verbose(e.what()); + LOG_VERBOSE(e.what()); } stream->SetPosition(originalPosition); return success; @@ -116,7 +116,7 @@ static bool TryClassifyAsS6(OpenRCT2::IStream* stream, ClassifiedFileInfo* resul catch (const std::exception& e) { // Exceptions are likely to occur if file is not S6 format - log_verbose(e.what()); + LOG_VERBOSE(e.what()); } stream->SetPosition(originalPosition); return success; @@ -194,7 +194,7 @@ static bool TryClassifyAsTD4_TD6(OpenRCT2::IStream* stream, ClassifiedFileInfo* return success; } -FileExtension get_file_extension_type(u8string_view path) +FileExtension GetFileExtensionType(u8string_view path) { auto extension = Path::GetExtension(path); if (String::Equals(extension, ".dat", true) || String::Equals(extension, ".pob", true)) diff --git a/src/openrct2/FileClassifier.h b/src/openrct2/FileClassifier.h index 59d5cbfbbd..96e06d1edf 100644 --- a/src/openrct2/FileClassifier.h +++ b/src/openrct2/FileClassifier.h @@ -52,4 +52,4 @@ struct ClassifiedFileInfo bool TryClassifyFile(const std::string& path, ClassifiedFileInfo* result); bool TryClassifyFile(OpenRCT2::IStream* stream, ClassifiedFileInfo* result); -FileExtension get_file_extension_type(u8string_view path); +FileExtension GetFileExtensionType(u8string_view path); diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index a25cf5d835..708d097619 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -94,13 +94,13 @@ static bool _mapChangedExpected; using namespace OpenRCT2; -void game_reset_speed() +void GameResetSpeed() { gGameSpeed = 1; WindowInvalidateByClass(WindowClass::TopToolbar); } -void game_increase_game_speed() +void GameIncreaseGameSpeed() { gGameSpeed = std::min(gConfigGeneral.DebuggingTools ? 5 : 4, gGameSpeed + 1); if (gGameSpeed == 5) @@ -108,7 +108,7 @@ void game_increase_game_speed() WindowInvalidateByClass(WindowClass::TopToolbar); } -void game_reduce_game_speed() +void GameReduceGameSpeed() { gGameSpeed = std::max(1, gGameSpeed - 1); if (gGameSpeed == 7) @@ -120,7 +120,7 @@ void game_reduce_game_speed() * * rct2: 0x0066B5C0 (part of 0x0066B3E8) */ -void game_create_windows() +void GameCreateWindows() { ContextOpenWindow(WindowClass::MainWindow); ContextOpenWindow(WindowClass::TopToolbar); @@ -146,7 +146,7 @@ enum * * rct2: 0x006838BD */ -void update_palette_effects() +void UpdatePaletteEffects() { auto water_type = static_cast(object_entry_get_chunk(ObjectType::Water, 0)); @@ -299,7 +299,7 @@ void update_palette_effects() } } -void pause_toggle() +void PauseToggle() { gGamePaused ^= GAME_PAUSED_NORMAL; WindowInvalidateByClass(WindowClass::TopToolbar); @@ -309,12 +309,12 @@ void pause_toggle() } } -bool game_is_paused() +bool GameIsPaused() { return gGamePaused != 0; } -bool game_is_not_paused() +bool GameIsNotPaused() { return gGamePaused == 0; } @@ -323,7 +323,7 @@ bool game_is_not_paused() * * rct2: 0x0066DC0F */ -static void load_landscape() +static void LoadLandscape() { auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); @@ -341,7 +341,7 @@ void RCT2StringToUTF8Self(char* buffer, size_t length) // OpenRCT2 workaround to recalculate some values which are saved redundantly in the save to fix corrupted files. // For example recalculate guest count by looking at all the guests instead of trusting the value in the file. -void game_fix_save_vars() +void GameFixSaveVars() { // Recalculates peep count after loading a save to fix corrupted files uint32_t guestCount = 0; @@ -374,23 +374,23 @@ void game_fix_save_vars() Ride* ride = GetRide(rideIdx); if (ride == nullptr) { - log_warning("Couldn't find ride %u, resetting ride on peep %u", rideIdx, peep->sprite_index); + LOG_WARNING("Couldn't find ride %u, resetting ride on peep %u", rideIdx, peep->sprite_index); peep->CurrentRide = RideId::GetNull(); continue; } auto curName = peep->GetName(); - log_warning( + LOG_WARNING( "Peep %u (%s) has invalid ride station = %u for ride %u.", peep->sprite_index, curName.c_str(), srcStation.ToUnderlying(), rideIdx); auto station = RideGetFirstValidStationExit(*ride); if (station.IsNull()) { - log_warning("Couldn't find station, removing peep %u", peep->sprite_index); + LOG_WARNING("Couldn't find station, removing peep %u", peep->sprite_index); peepsToRemove.push_back(peep); } else { - log_warning("Amending ride station to %u.", station); + LOG_WARNING("Amending ride station to %u.", station); peep->CurrentRideStation = station; } } @@ -417,11 +417,11 @@ void game_fix_save_vars() if (surfaceElement == nullptr) { - log_error("Null map element at x = %d and y = %d. Fixing...", x, y); + LOG_ERROR("Null map element at x = %d and y = %d. Fixing...", x, y); surfaceElement = TileElementInsert(TileCoordsXYZ{ x, y, 14 }.ToCoordsXYZ(), 0b0000); if (surfaceElement == nullptr) { - log_error("Unable to fix: Map element limit reached."); + LOG_ERROR("Unable to fix: Map element limit reached."); return; } } @@ -457,7 +457,7 @@ void game_fix_save_vars() MapCountRemainingLandRights(); } -void game_load_init() +void GameLoadInit() { IGameStateSnapshots* snapshots = GetContext()->GetGameStateSnapshots(); snapshots->Reset(); @@ -467,7 +467,7 @@ void game_load_init() if (!gLoadKeepWindowsOpen) { ViewportInitAll(); - game_create_windows(); + GameCreateWindows(); } else { @@ -483,7 +483,7 @@ void game_load_init() GameActions::ClearQueue(); } ResetEntitySpatialIndices(); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); ScenerySetDefaultPlacementConfiguration(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); @@ -504,21 +504,21 @@ void game_load_init() gGameSpeed = 1; } -void game_load_scripts() +void GameLoadScripts() { #ifdef ENABLE_SCRIPTING GetContext()->GetScriptEngine().LoadTransientPlugins(); #endif } -void game_unload_scripts() +void GameUnloadScripts() { #ifdef ENABLE_SCRIPTING GetContext()->GetScriptEngine().UnloadTransientPlugins(); #endif } -void game_notify_map_change() +void GameNotifyMapChange() { #ifdef ENABLE_SCRIPTING // Ensure we don't get a two lots of change events @@ -534,7 +534,7 @@ void game_notify_map_change() #endif } -void game_notify_map_changed() +void GameNotifyMapChanged() { #ifdef ENABLE_SCRIPTING using namespace OpenRCT2::Scripting; @@ -551,7 +551,7 @@ void game_notify_map_changed() * rct2: 0x0069E9A7 * Call after a rotation or loading of a save to reset sprite quadrants */ -void reset_all_sprite_quadrant_placements() +void ResetAllSpriteQuadrantPlacements() { for (EntityId::UnderlyingType i = 0; i < MAX_ENTITIES; i++) { @@ -563,48 +563,48 @@ void reset_all_sprite_quadrant_placements() } } -void save_game() +void SaveGame() { if (!gFirstTimeSaving && !gIsAutosaveLoaded) { const auto savePath = Path::WithExtension(gScenarioSavePath, ".park"); - save_game_with_name(savePath); + SaveGameWithName(savePath); } else { - save_game_as(); + SaveGameAs(); } } -void save_game_cmd(u8string_view name /* = {} */) +void SaveGameCmd(u8string_view name /* = {} */) { if (name.empty()) { const auto savePath = Path::WithExtension(gScenarioSavePath, ".park"); - save_game_with_name(savePath); + SaveGameWithName(savePath); } else { auto env = GetContext()->GetPlatformEnvironment(); auto savePath = Path::Combine(env->GetDirectoryPath(DIRBASE::USER, DIRID::SAVE), u8string(name) + u8".park"); - save_game_with_name(savePath); + SaveGameWithName(savePath); } } -void save_game_with_name(u8string_view name) +void SaveGameWithName(u8string_view name) { - log_verbose("Saving to %s", u8string(name).c_str()); + LOG_VERBOSE("Saving to %s", u8string(name).c_str()); if (scenario_save(name, gConfigGeneral.SavePluginData ? 1 : 0)) { - log_verbose("Saved to %s", u8string(name).c_str()); + LOG_VERBOSE("Saved to %s", u8string(name).c_str()); gCurrentLoadedPath = name; gIsAutosaveLoaded = false; gScreenAge = 0; } } -std::unique_ptr create_save_game_as_intent() +std::unique_ptr CreateSaveGameAsIntent() { auto name = Path::GetFileNameWithoutExtension(gScenarioSavePath); @@ -615,13 +615,13 @@ std::unique_ptr create_save_game_as_intent() return intent; } -void save_game_as() +void SaveGameAs() { - auto intent = create_save_game_as_intent(); + auto intent = CreateSaveGameAsIntent(); ContextOpenIntent(intent.get()); } -static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processLandscapeFolder) +static void LimitAutosaveCount(const size_t numberOfFilesToKeep, bool processLandscapeFolder) { size_t autosavesCount = 0; size_t numAutosavesToDelete = 0; @@ -675,12 +675,12 @@ static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processL { if (!File::Delete(autosaveFiles[i])) { - log_warning("Failed to delete autosave file: %s", autosaveFiles[i].data()); + LOG_WARNING("Failed to delete autosave file: %s", autosaveFiles[i].data()); } } } -void game_autosave() +void GameAutosave() { auto subDirectory = DIRID::SAVE; const char* fileExtension = ".park"; @@ -702,7 +702,7 @@ void game_autosave() currentDate.day, currentTime.hour, currentTime.minute, currentTime.second, fileExtension); int32_t autosavesToKeep = gConfigGeneral.AutosaveAmount; - limit_autosave_count(autosavesToKeep - 1, (gScreenFlags & SCREEN_FLAGS_EDITOR)); + LimitAutosaveCount(autosavesToKeep - 1, (gScreenFlags & SCREEN_FLAGS_EDITOR)); auto env = GetContext()->GetPlatformEnvironment(); auto autosaveDir = Path::Combine(env->GetDirectoryPath(DIRBASE::USER, subDirectory), u8"autosave"); @@ -721,16 +721,16 @@ void game_autosave() Console::Error::WriteLine("Could not autosave the scenario. Is the save folder writeable?"); } -static void game_load_or_quit_no_save_prompt_callback(int32_t result, const utf8* path) +static void GameLoadOrQuitNoSavePromptCallback(int32_t result, const utf8* path) { if (result == MODAL_RESULT_OK) { - game_notify_map_change(); - game_unload_scripts(); + GameNotifyMapChange(); + GameUnloadScripts(); WindowCloseByClass(WindowClass::EditorObjectSelection); GetContext()->LoadParkFromFile(path); - game_load_scripts(); - game_notify_map_changed(); + GameLoadScripts(); + GameNotifyMapChanged(); gIsAutosaveLoaded = gIsAutosave; gFirstTimeSaving = false; } @@ -739,17 +739,17 @@ static void game_load_or_quit_no_save_prompt_callback(int32_t result, const utf8 static void NewGameWindowCallback(const utf8* path) { WindowCloseByClass(WindowClass::EditorObjectSelection); - game_notify_map_change(); + GameNotifyMapChange(); GetContext()->LoadParkFromFile(path, false, true); - game_load_scripts(); - game_notify_map_changed(); + GameLoadScripts(); + GameNotifyMapChanged(); } /** * * rct2: 0x0066DB79 */ -void game_load_or_quit_no_save_prompt() +void GameLoadOrQuitNoSavePrompt() { switch (gSavePromptMode) { @@ -760,13 +760,13 @@ void game_load_or_quit_no_save_prompt() ToolCancel(); if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - load_landscape(); + LoadLandscape(); } else { auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(game_load_or_quit_no_save_prompt_callback)); + intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(GameLoadOrQuitNoSavePromptCallback)); ContextOpenIntent(&intent); } break; @@ -776,14 +776,14 @@ void game_load_or_quit_no_save_prompt() auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::CloseSavePrompt); GameActions::Execute(&loadOrQuitAction); ToolCancel(); - if (input_test_flag(INPUT_FLAG_5)) + if (InputTestFlag(INPUT_FLAG_5)) { - input_set_flag(INPUT_FLAG_5, false); + InputSetFlag(INPUT_FLAG_5, false); } gGameSpeed = 1; gFirstTimeSaving = true; - game_notify_map_change(); - game_unload_scripts(); + GameNotifyMapChange(); + GameUnloadScripts(); title_load(); break; } @@ -798,13 +798,13 @@ void game_load_or_quit_no_save_prompt() break; } default: - game_unload_scripts(); - openrct2_finish(); + GameUnloadScripts(); + OpenRCT2Finish(); break; } } -void start_silent_record() +void StartSilentRecord() { std::string name = Path::Combine( OpenRCT2::GetContext()->GetPlatformEnvironment()->GetDirectoryPath(OpenRCT2::DIRBASE::USER), u8"debug_replay.parkrep"); @@ -820,7 +820,7 @@ void start_silent_record() } } -bool stop_silent_record() +bool StopSilentRecord() { auto* replayManager = OpenRCT2::GetContext()->GetReplayManager(); if (!replayManager->IsRecording() && !replayManager->IsNormalising()) diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index 4dadcf239f..b4ea9b1563 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -149,31 +149,31 @@ extern bool gIsAutosaveLoaded; extern bool gLoadKeepWindowsOpen; -void game_reset_speed(); -void game_increase_game_speed(); -void game_reduce_game_speed(); +void GameResetSpeed(); +void GameIncreaseGameSpeed(); +void GameReduceGameSpeed(); -void game_create_windows(); -void reset_all_sprite_quadrant_placements(); -void update_palette_effects(); +void GameCreateWindows(); +void ResetAllSpriteQuadrantPlacements(); +void UpdatePaletteEffects(); -void game_load_or_quit_no_save_prompt(); -void game_load_init(); -void game_load_scripts(); -void game_unload_scripts(); -void game_notify_map_change(); -void game_notify_map_changed(); -void pause_toggle(); -bool game_is_paused(); -bool game_is_not_paused(); -void save_game(); -std::unique_ptr create_save_game_as_intent(); -void save_game_as(); -void save_game_cmd(u8string_view name = {}); -void save_game_with_name(u8string_view name); -void game_autosave(); +void GameLoadOrQuitNoSavePrompt(); +void GameLoadInit(); +void GameLoadScripts(); +void GameUnloadScripts(); +void GameNotifyMapChange(); +void GameNotifyMapChanged(); +void PauseToggle(); +bool GameIsPaused(); +bool GameIsNotPaused(); +void SaveGame(); +std::unique_ptr CreateSaveGameAsIntent(); +void SaveGameAs(); +void SaveGameCmd(u8string_view name = {}); +void SaveGameWithName(u8string_view name); +void GameAutosave(); void RCT2StringToUTF8Self(char* buffer, size_t length); -void game_fix_save_vars(); -void start_silent_record(); -bool stop_silent_record(); +void GameFixSaveVars(); +void StartSilentRecord(); +bool StopSilentRecord(); void PrepareMapForSave(); diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 4d275ec2da..a332d36ab9 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -112,9 +112,9 @@ void GameState::Tick() // 0x006E3AEC // screen_game_process_mouse_input(); ScreenshotCheck(); - game_handle_keyboard_input(); + GameHandleKeyboardInput(); - if (game_is_not_paused() && gPreviewingTitleSequenceInGame) + if (GameIsNotPaused() && gPreviewingTitleSequenceInGame) { auto player = GetContext()->GetUiContext()->GetTitleSequencePlayer(); if (player != nullptr) @@ -140,7 +140,7 @@ void GameState::Tick() } } - bool isPaused = game_is_paused(); + bool isPaused = GameIsPaused(); if (network_get_mode() == NETWORK_MODE_SERVER && gConfigNetwork.PauseServerIfNoClients) { // If we are headless we always have 1 player (host), pause if no one else is around. @@ -156,7 +156,7 @@ void GameState::Tick() if (gDoSingleUpdate && network_get_mode() == NETWORK_MODE_NONE) { didRunSingleFrame = true; - pause_toggle(); + PauseToggle(); numUpdates = 1; } else @@ -189,11 +189,11 @@ void GameState::Tick() UpdateLogic(); if (gGameSpeed == 1) { - if (input_get_state() == InputState::Reset || input_get_state() == InputState::Normal) + if (InputGetState() == InputState::Reset || InputGetState() == InputState::Normal) { - if (input_test_flag(INPUT_FLAG_VIEWPORT_SCROLLING)) + if (InputTestFlag(INPUT_FLAG_VIEWPORT_SCROLLING)) { - input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false); + InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false); break; } } @@ -208,7 +208,7 @@ void GameState::Tick() if (!gOpenRCT2Headless) { - input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false); + InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false); // the flickering frequency is reduced by 4, compared to the original // it was done due to inability to reproduce original frequency @@ -242,9 +242,9 @@ void GameState::Tick() WindowDispatchUpdateAll(); - if (didRunSingleFrame && game_is_not_paused() && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (didRunSingleFrame && GameIsNotPaused() && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - pause_toggle(); + PauseToggle(); } gDoSingleUpdate = false; @@ -360,7 +360,7 @@ void GameState::UpdateLogic(LogicTimings* timings) peep_update_crowd_noise(); ClimateUpdateSound(); report_time(LogicTimePart::Sounds); - editor_open_windows_for_current_step(); + EditorOpenWindowsForCurrentStep(); // Update windows // WindowDispatchUpdateAll(); diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 235b4da2e7..ec44c98f3e 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -97,7 +97,7 @@ struct GameStateSnapshot_t // can fail gracefully when fields added/removed if (!EntitiesSizeCheck(ds)) { - log_error("Entity index corrupted!"); + LOG_ERROR("Entity index corrupted!"); return; } ds << numSavedSprites; @@ -115,7 +115,7 @@ struct GameStateSnapshot_t EntitySnapshot* entity = getEntity(spriteIdx); if (entity == nullptr) { - log_error("Entity index corrupted!"); + LOG_ERROR("Entity index corrupted!"); return; } auto& sprite = *entity; @@ -186,7 +186,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots snapshot.SerialiseSprites( [](const EntityId index) { return reinterpret_cast(GetEntity(index)); }, MAX_ENTITIES, true); - // log_info("Snapshot size: %u bytes", static_cast(snapshot.storedSprites.GetLength())); + // LOG_INFO("Snapshot size: %u bytes", static_cast(snapshot.storedSprites.GetLength())); } virtual const GameStateSnapshot_t* GetLinkedSnapshot(uint32_t tick) const override final diff --git a/src/openrct2/Input.cpp b/src/openrct2/Input.cpp index 83979019d8..921c8294bc 100644 --- a/src/openrct2/Input.cpp +++ b/src/openrct2/Input.cpp @@ -27,7 +27,7 @@ widget_ref gCurrentToolWidget; * * rct2: 0x006E3B43 */ -void title_handle_keyboard_input() +void TitleHandleKeyboardInput() { ContextInputHandleKeyboard(true); } @@ -36,12 +36,12 @@ void title_handle_keyboard_input() * * rct2: 0x006E3B43 */ -void game_handle_keyboard_input() +void GameHandleKeyboardInput() { ContextInputHandleKeyboard(false); } -void input_set_flag(INPUT_FLAGS flag, bool on) +void InputSetFlag(INPUT_FLAGS flag, bool on) { if (on) { @@ -53,32 +53,32 @@ void input_set_flag(INPUT_FLAGS flag, bool on) } } -bool input_test_flag(INPUT_FLAGS flag) +bool InputTestFlag(INPUT_FLAGS flag) { return _inputFlags & flag; } -void input_reset_flags() +void InputResetFlags() { _inputFlags = 0; } -void input_set_state(InputState state) +void InputSetState(InputState state) { _inputState = state; } -InputState input_get_state() +InputState InputGetState() { return _inputState; } -void reset_tooltip_not_shown() +void ResetTooltipNotShown() { _tooltipNotShownTicks = 0; } -void input_reset_place_obj_modifier() +void InputResetPlaceObjModifier() { gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE; } diff --git a/src/openrct2/Input.h b/src/openrct2/Input.h index 8bdef0fb15..5ad562fc82 100644 --- a/src/openrct2/Input.h +++ b/src/openrct2/Input.h @@ -94,25 +94,25 @@ extern uint16_t _tooltipNotShownTicks; void InputWindowPositionBegin(rct_window& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void title_handle_keyboard_input(); +void TitleHandleKeyboardInput(); void GameHandleInput(); -void game_handle_keyboard_input(); +void GameHandleKeyboardInput(); void GameHandleEdgeScroll(); int32_t GetNextKey(); void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords); -void input_set_flag(INPUT_FLAGS flag, bool on); -bool input_test_flag(INPUT_FLAGS flag); -void input_reset_flags(); +void InputSetFlag(INPUT_FLAGS flag, bool on); +bool InputTestFlag(INPUT_FLAGS flag); +void InputResetFlags(); bool InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER modifier); -void input_set_state(InputState state); -InputState input_get_state(); +void InputSetState(InputState state); +InputState InputGetState(); -void reset_tooltip_not_shown(); +void ResetTooltipNotShown(); -void input_reset_place_obj_modifier(); +void InputResetPlaceObjModifier(); void InputScrollViewport(const ScreenCoordsXY& screenCoords); diff --git a/src/openrct2/Intro.cpp b/src/openrct2/Intro.cpp index 1d05f9c7c7..a25f7af94c 100644 --- a/src/openrct2/Intro.cpp +++ b/src/openrct2/Intro.cpp @@ -35,16 +35,16 @@ static int32_t _introStateCounter; static std::shared_ptr _soundChannel = nullptr; static bool _chainLiftFinished; -static void screen_intro_process_mouse_input(); -static void screen_intro_process_keyboard_input(); -static void screen_intro_skip_part(); -static void screen_intro_draw_logo(rct_drawpixelinfo* dpi); +static void ScreenIntroProcessMouseInput(); +static void ScreenIntroProcessKeyboardInput(); +static void ScreenIntroSkipPart(); +static void ScreenIntroDrawLogo(rct_drawpixelinfo* dpi); // rct2: 0x0068E966 -void intro_update() +void IntroUpdate() { - screen_intro_process_mouse_input(); - screen_intro_process_keyboard_input(); + ScreenIntroProcessMouseInput(); + ScreenIntroProcessKeyboardInput(); switch (gIntroState) { @@ -168,7 +168,7 @@ void intro_update() } } -void intro_draw(rct_drawpixelinfo* dpi) +void IntroDraw(rct_drawpixelinfo* dpi) { int32_t screenWidth = ContextGetWidth(); @@ -216,10 +216,10 @@ void intro_draw(rct_drawpixelinfo* dpi) { GfxTransposePalette(PALETTE_G1_IDX_LOGO, 255); } - screen_intro_draw_logo(dpi); + ScreenIntroDrawLogo(dpi); break; case IntroState::LogoWait: - screen_intro_draw_logo(dpi); + ScreenIntroDrawLogo(dpi); break; case IntroState::LogoFadeOut: if (_introStateCounter >= 0) @@ -230,7 +230,7 @@ void intro_draw(rct_drawpixelinfo* dpi) { GfxTransposePalette(PALETTE_G1_IDX_LOGO, 0); } - screen_intro_draw_logo(dpi); + ScreenIntroDrawLogo(dpi); break; case IntroState::Clear: GfxClear(dpi, BACKROUND_COLOUR_DARK); @@ -240,11 +240,11 @@ void intro_draw(rct_drawpixelinfo* dpi) } } -static void screen_intro_process_mouse_input() +static void ScreenIntroProcessMouseInput() { if (ContextGetCursorState()->any == CURSOR_PRESSED) { - screen_intro_skip_part(); + ScreenIntroSkipPart(); } } @@ -252,20 +252,20 @@ static void screen_intro_process_mouse_input() * * rct2: 0x006E3AEC */ -static void screen_intro_process_keyboard_input() +static void ScreenIntroProcessKeyboardInput() { const uint8_t* keys = ContextGetKeysState(); for (int i = 0; i < 256; i++) { if (keys[i] != 0) { - screen_intro_skip_part(); + ScreenIntroSkipPart(); break; } } } -static void screen_intro_skip_part() +static void ScreenIntroSkipPart() { switch (gIntroState) { @@ -280,7 +280,7 @@ static void screen_intro_skip_part() } } -static void screen_intro_draw_logo(rct_drawpixelinfo* dpi) +static void ScreenIntroDrawLogo(rct_drawpixelinfo* dpi) { int32_t screenWidth = ContextGetWidth(); int32_t imageWidth = 640; diff --git a/src/openrct2/Intro.h b/src/openrct2/Intro.h index 19be761db6..5c0be5f624 100644 --- a/src/openrct2/Intro.h +++ b/src/openrct2/Intro.h @@ -31,5 +31,5 @@ enum class IntroState : uint8_t extern IntroState gIntroState; -void intro_update(); -void intro_draw(rct_drawpixelinfo* dpi); +void IntroUpdate(); +void IntroDraw(rct_drawpixelinfo* dpi); diff --git a/src/openrct2/OpenRCT2.h b/src/openrct2/OpenRCT2.h index 1f3a8b299b..910ccdf215 100644 --- a/src/openrct2/OpenRCT2.h +++ b/src/openrct2/OpenRCT2.h @@ -62,7 +62,7 @@ extern uint8_t gScreenFlags; extern uint32_t gScreenAge; extern PromptMode gSavePromptMode; -void openrct2_write_full_version_info(utf8* buffer, size_t bufferSize); -void openrct2_finish(); +void OpenRCT2WriteFullVersionInfo(utf8* buffer, size_t bufferSize); +void OpenRCT2Finish(); int32_t CmdlineRun(const char** argv, int32_t argc); diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index d5e4e977a3..b04418da68 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -221,12 +221,12 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() } // Log base paths - log_verbose("DIRBASE::RCT1 : %s", env->GetDirectoryPath(DIRBASE::RCT1).c_str()); - log_verbose("DIRBASE::RCT2 : %s", env->GetDirectoryPath(DIRBASE::RCT2).c_str()); - log_verbose("DIRBASE::OPENRCT2: %s", env->GetDirectoryPath(DIRBASE::OPENRCT2).c_str()); - log_verbose("DIRBASE::USER : %s", env->GetDirectoryPath(DIRBASE::USER).c_str()); - log_verbose("DIRBASE::CONFIG : %s", env->GetDirectoryPath(DIRBASE::CONFIG).c_str()); - log_verbose("DIRBASE::CACHE : %s", env->GetDirectoryPath(DIRBASE::CACHE).c_str()); + LOG_VERBOSE("DIRBASE::RCT1 : %s", env->GetDirectoryPath(DIRBASE::RCT1).c_str()); + LOG_VERBOSE("DIRBASE::RCT2 : %s", env->GetDirectoryPath(DIRBASE::RCT2).c_str()); + LOG_VERBOSE("DIRBASE::OPENRCT2: %s", env->GetDirectoryPath(DIRBASE::OPENRCT2).c_str()); + LOG_VERBOSE("DIRBASE::USER : %s", env->GetDirectoryPath(DIRBASE::USER).c_str()); + LOG_VERBOSE("DIRBASE::CONFIG : %s", env->GetDirectoryPath(DIRBASE::CONFIG).c_str()); + LOG_VERBOSE("DIRBASE::CACHE : %s", env->GetDirectoryPath(DIRBASE::CACHE).c_str()); return env; } diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index e1dde80751..3c86059afc 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -331,7 +331,7 @@ namespace OpenRCT2 } else { - log_error("Unable to write to file '%s'", outFile.c_str()); + LOG_ERROR("Unable to write to file '%s'", outFile.c_str()); result = false; } @@ -410,7 +410,7 @@ namespace OpenRCT2 } catch (const std::runtime_error& err) { - log_warning("Snapshot data failed to be read. Snapshot not compared. %s", err.what()); + LOG_WARNING("Snapshot data failed to be read. Snapshot not compared. %s", err.what()); } } @@ -423,13 +423,13 @@ namespace OpenRCT2 if (!ReadReplayData(file, *replayData)) { - log_error("Unable to read replay data."); + LOG_ERROR("Unable to read replay data."); return false; } if (!LoadReplayDataMap(*replayData)) { - log_error("Unable to load map."); + LOG_ERROR("Unable to load map."); return false; } @@ -534,12 +534,12 @@ namespace OpenRCT2 DataSerialiser parkParamsDs(false, data.parkParams); SerialiseParkParameters(parkParamsDs); - game_load_init(); + GameLoadInit(); FixInvalidVehicleSpriteSizes(); } catch (const std::exception& ex) { - log_error("Exception: %s", ex.what()); + LOG_ERROR("Exception: %s", ex.what()); return false; } return true; @@ -712,13 +712,13 @@ namespace OpenRCT2 serialiser << data.magic; if (data.magic != ReplayMagic) { - log_error("Magic does not match %08X, expected: %08X", data.magic, ReplayMagic); + LOG_ERROR("Magic does not match %08X, expected: %08X", data.magic, ReplayMagic); return false; } serialiser << data.version; if (data.version != ReplayVersion && !Compatible(data)) { - log_error("Invalid version detected %04X, expected: %04X", data.version, ReplayVersion); + LOG_ERROR("Invalid version detected %04X, expected: %04X", data.version, ReplayVersion); return false; } @@ -727,7 +727,7 @@ namespace OpenRCT2 // NOTE: This does not mean the replay will not function, only a warning. if (data.networkId != network_get_version()) { - log_warning( + LOG_WARNING( "Replay network version mismatch: '%s', expected: '%s'", data.networkId.c_str(), network_get_version().c_str()); } @@ -799,7 +799,7 @@ namespace OpenRCT2 uint32_t replayTick = gCurrentTicks - _currentReplay->tickStart; // Detected different game state. - log_warning( + LOG_WARNING( "Different sprite checksum at tick %u (Replay Tick: %u) ; Saved: %s, Current: %s", gCurrentTicks, replayTick, savedChecksum.second.ToString().c_str(), checksum.ToString().c_str()); @@ -808,7 +808,7 @@ namespace OpenRCT2 else { // Good state. - log_verbose( + LOG_VERBOSE( "Good state at tick %u ; Saved: %s, Current: %s", gCurrentTicks, savedChecksum.second.ToString().c_str(), checksum.ToString().c_str()); } diff --git a/src/openrct2/Version.cpp b/src/openrct2/Version.cpp index fb6c4194fe..66a8722c02 100644 --- a/src/openrct2/Version.cpp +++ b/src/openrct2/Version.cpp @@ -53,7 +53,7 @@ const char gVersionInfoFull[] = OPENRCT2_NAME ", " #endif ; -NewVersionInfo get_latest_version() +NewVersionInfo GetLatestVersion() { // If the check doesn't succeed, provide current version so we don't bother user // with invalid data. diff --git a/src/openrct2/Version.h b/src/openrct2/Version.h index 7f68d9894a..02fa7a562f 100644 --- a/src/openrct2/Version.h +++ b/src/openrct2/Version.h @@ -84,4 +84,4 @@ struct NewVersionInfo std::string url; }; -NewVersionInfo get_latest_version(); +NewVersionInfo GetLatestVersion(); diff --git a/src/openrct2/actions/BalloonPressAction.cpp b/src/openrct2/actions/BalloonPressAction.cpp index 0fc461650b..60242258cd 100644 --- a/src/openrct2/actions/BalloonPressAction.cpp +++ b/src/openrct2/actions/BalloonPressAction.cpp @@ -39,7 +39,7 @@ GameActions::Result BalloonPressAction::Query() const auto balloon = TryGetEntity(_spriteIndex); if (balloon == nullptr) { - log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex); + LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } return GameActions::Result(); @@ -50,7 +50,7 @@ GameActions::Result BalloonPressAction::Execute() const auto balloon = TryGetEntity(_spriteIndex); if (balloon == nullptr) { - log_error("Tried getting invalid sprite for balloon: %u", _spriteIndex); + LOG_ERROR("Tried getting invalid sprite for balloon: %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index d9de4e61bc..63055bb589 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -60,7 +60,7 @@ GameActions::Result BannerPlaceAction::Query() const if (!MapCheckCapacityAndReorganise(_loc)) { - log_error("No free map elements."); + LOG_ERROR("No free map elements."); return GameActions::Result( GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); } @@ -88,7 +88,7 @@ GameActions::Result BannerPlaceAction::Query() const if (HasReachedBannerLimit()) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } @@ -96,7 +96,7 @@ GameActions::Result BannerPlaceAction::Query() const auto* bannerEntry = GetBannerEntry(_bannerType); if (bannerEntry == nullptr) { - log_error("Invalid banner object type. bannerType = ", _bannerType); + LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } res.Cost = bannerEntry->price; @@ -115,7 +115,7 @@ GameActions::Result BannerPlaceAction::Execute() const if (!MapCheckCapacityAndReorganise(_loc)) { - log_error("No free map elements."); + LOG_ERROR("No free map elements."); return GameActions::Result( GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); } @@ -123,14 +123,14 @@ GameActions::Result BannerPlaceAction::Execute() const auto* bannerEntry = GetBannerEntry(_bannerType); if (bannerEntry == nullptr) { - log_error("Invalid banner object type. bannerType = ", _bannerType); + LOG_ERROR("Invalid banner object type. bannerType = ", _bannerType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } auto banner = CreateBanner(); if (banner == nullptr) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } diff --git a/src/openrct2/actions/BannerRemoveAction.cpp b/src/openrct2/actions/BannerRemoveAction.cpp index 45387b8399..7271e9ea8b 100644 --- a/src/openrct2/actions/BannerRemoveAction.cpp +++ b/src/openrct2/actions/BannerRemoveAction.cpp @@ -57,21 +57,21 @@ GameActions::Result BannerRemoveAction::Query() const BannerElement* bannerElement = GetBannerElementAt(); if (bannerElement == nullptr) { - log_error("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction); + LOG_ERROR("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto bannerIndex = bannerElement->GetIndex(); if (bannerIndex == BannerIndex::GetNull()) { - log_error("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index. index = ", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto banner = bannerElement->GetBanner(); if (banner == nullptr) { - log_error("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index. index = ", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } @@ -96,21 +96,21 @@ GameActions::Result BannerRemoveAction::Execute() const BannerElement* bannerElement = GetBannerElementAt(); if (bannerElement == nullptr) { - log_error("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction); + LOG_ERROR("Invalid banner location, x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto bannerIndex = bannerElement->GetIndex(); if (bannerIndex == BannerIndex::GetNull()) { - log_error("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index. index = ", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto banner = bannerElement->GetBanner(); if (banner == nullptr) { - log_error("Invalid banner index. index = ", bannerIndex); + LOG_ERROR("Invalid banner index. index = ", bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index 30abc912eb..776eb9d7ed 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -60,13 +60,13 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const if (!LocationValid(_loc)) { - log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); + LOG_ERROR("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (_primaryColour > 31) { - log_error("Invalid primary colour: colour = %u", _primaryColour); + LOG_ERROR("Invalid primary colour: colour = %u", _primaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -79,7 +79,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const if (bannerElement == nullptr) { - log_error("Could not find banner at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); + LOG_ERROR("Could not find banner at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -87,7 +87,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const auto banner = GetBanner(index); if (banner == nullptr) { - log_error("Invalid banner index: index = %u", index); + LOG_ERROR("Invalid banner index: index = %u", index); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp index 7493690afb..7eabbc9b27 100644 --- a/src/openrct2/actions/BannerSetNameAction.cpp +++ b/src/openrct2/actions/BannerSetNameAction.cpp @@ -47,7 +47,7 @@ GameActions::Result BannerSetNameAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_warning("Invalid banner id, banner id = %d", _bannerIndex); + LOG_WARNING("Invalid banner id, banner id = %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_NONE); } return GameActions::Result(); @@ -58,7 +58,7 @@ GameActions::Result BannerSetNameAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_warning("Invalid banner id, banner id = %d", _bannerIndex); + LOG_WARNING("Invalid banner id, banner id = %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_BANNER, STR_NONE); } diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index 648de85701..db24db91d4 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -49,7 +49,7 @@ GameActions::Result BannerSetStyleAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_error("Invalid banner index: index = %u", _bannerIndex); + LOG_ERROR("Invalid banner index: index = %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -61,7 +61,7 @@ GameActions::Result BannerSetStyleAction::Query() const if (tileElement == nullptr) { - log_error("Could not find banner index = %u", _bannerIndex); + LOG_ERROR("Could not find banner index = %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -70,7 +70,7 @@ GameActions::Result BannerSetStyleAction::Query() const case BannerSetStyleType::PrimaryColour: if (_parameter > 31) { - log_error("Invalid primary colour: colour = %u", _parameter); + LOG_ERROR("Invalid primary colour: colour = %u", _parameter); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } break; @@ -78,19 +78,19 @@ GameActions::Result BannerSetStyleAction::Query() const case BannerSetStyleType::TextColour: if (_parameter > 13) { - log_error("Invalid text colour: colour = %u", _parameter); + LOG_ERROR("Invalid text colour: colour = %u", _parameter); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } break; case BannerSetStyleType::NoEntry: if (tileElement->AsBanner() == nullptr) { - log_error("Tile element was not a banner."); + LOG_ERROR("Tile element was not a banner."); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } break; default: - log_error("Invalid type: %u", _type); + LOG_ERROR("Invalid type: %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } return res; @@ -103,7 +103,7 @@ GameActions::Result BannerSetStyleAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_error("Invalid banner index: index = %u", _bannerIndex); + LOG_ERROR("Invalid banner index: index = %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -115,7 +115,7 @@ GameActions::Result BannerSetStyleAction::Execute() const if (tileElement == nullptr) { - log_error("Could not find banner index = %u", _bannerIndex); + LOG_ERROR("Could not find banner index = %u", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -132,7 +132,7 @@ GameActions::Result BannerSetStyleAction::Execute() const BannerElement* bannerElement = tileElement->AsBanner(); if (bannerElement == nullptr) { - log_error("Tile element was not a banner."); + LOG_ERROR("Tile element was not a banner."); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -147,7 +147,7 @@ GameActions::Result BannerSetStyleAction::Execute() const break; } default: - log_error("Invalid type: %u", _type); + LOG_ERROR("Invalid type: %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index 0f316477c5..4616442dcf 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -245,7 +245,7 @@ GameActions::Result CheatSetAction::Execute() const break; default: { - log_error("Unabled cheat: %d", _cheatType.id); + LOG_ERROR("Unabled cheat: %d", _cheatType.id); GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } break; diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index 9a3879a3df..4d19db4251 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -73,7 +73,7 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const auto tileElement = MapGetFootpathElement(_loc); if (tileElement == nullptr) { - log_error("Could not find path element."); + LOG_ERROR("Could not find path element."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } @@ -150,7 +150,7 @@ GameActions::Result FootpathAdditionPlaceAction::Execute() const if (pathElement == nullptr) { - log_error("Could not find path element."); + LOG_ERROR("Could not find path element."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index a0bd4f694c..a14bb56589 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -67,20 +67,20 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const auto tileElement = MapGetFootpathElement(_loc); if (tileElement == nullptr) { - log_warning("Could not find path element."); + LOG_WARNING("Could not find path element."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } auto pathElement = tileElement->AsPath(); if (pathElement == nullptr) { - log_warning("Could not find path element."); + LOG_WARNING("Could not find path element."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } if (!pathElement->AdditionIsGhost() && (GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - log_warning("Tried to remove non ghost during ghost removal."); + LOG_WARNING("Tried to remove non ghost during ghost removal."); return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_NONE); } auto res = GameActions::Result(); @@ -101,7 +101,7 @@ GameActions::Result FootpathAdditionRemoveAction::Execute() const if (pathElement == nullptr) { - log_error("Could not find path element."); + LOG_ERROR("Could not find path element."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index 43fc61541d..ecb62d6f6c 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -98,7 +98,7 @@ GameActions::Result FootpathPlaceAction::Query() const if (_direction != INVALID_DIRECTION && !DirectionValid(_direction)) { - log_error("Direction invalid. direction = %u", _direction); + LOG_ERROR("Direction invalid. direction = %u", _direction); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); } @@ -495,7 +495,7 @@ void FootpathPlaceAction::RemoveIntersectingWalls(PathElement* pathElement) cons auto tileElement = MapGetFootpathElement(CoordsXYZ(_loc, z)); if (tileElement == nullptr) { - log_error("Something went wrong. Could not refind footpath."); + LOG_ERROR("Something went wrong. Could not refind footpath."); return; } pathElement = tileElement->AsPath(); diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index 12220a673b..c4cd2a1091 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -280,7 +280,7 @@ namespace GameActions output.Write(temp, strlen(temp) + 1); const char* text = static_cast(output.GetData()); - log_verbose("%s", text); + LOG_VERBOSE("%s", text); network_append_server_log(text); } @@ -328,7 +328,7 @@ namespace GameActions // As a client we have to wait or send it first. if (!(actionFlags & GameActions::Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) { - log_verbose("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName()); + LOG_VERBOSE("[%s] GameAction::Execute %s (Out)", GetRealm(), action->GetName()); network_send_game_action(action); return result; @@ -340,7 +340,7 @@ namespace GameActions // at the beginning of the frame, so we have to put them into the queue. if (!(actionFlags & GameActions::Flags::ClientOnly) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) { - log_verbose("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName()); + LOG_VERBOSE("[%s] GameAction::Execute %s (Queue)", GetRealm(), action->GetName()); Enqueue(action, gCurrentTicks); return result; diff --git a/src/openrct2/actions/GuestSetFlagsAction.cpp b/src/openrct2/actions/GuestSetFlagsAction.cpp index b42140febc..d5c78aed40 100644 --- a/src/openrct2/actions/GuestSetFlagsAction.cpp +++ b/src/openrct2/actions/GuestSetFlagsAction.cpp @@ -42,7 +42,7 @@ GameActions::Result GuestSetFlagsAction::Query() const auto* peep = TryGetEntity(_peepId); if (peep == nullptr) { - log_error("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); + LOG_ERROR("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE); } return GameActions::Result(); @@ -53,7 +53,7 @@ GameActions::Result GuestSetFlagsAction::Execute() const auto* peep = TryGetEntity(_peepId); if (peep == nullptr) { - log_error("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); + LOG_ERROR("Used invalid sprite index for peep: %u", _peepId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/GuestSetNameAction.cpp b/src/openrct2/actions/GuestSetNameAction.cpp index f7bc0cd586..102c4601b5 100644 --- a/src/openrct2/actions/GuestSetNameAction.cpp +++ b/src/openrct2/actions/GuestSetNameAction.cpp @@ -64,7 +64,7 @@ GameActions::Result GuestSetNameAction::Query() const auto guest = TryGetEntity(_spriteIndex); if (guest == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE); } @@ -76,7 +76,7 @@ GameActions::Result GuestSetNameAction::Execute() const auto guest = TryGetEntity(_spriteIndex); if (guest == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE); } diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index 02e3be8fa9..34b70120a5 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -110,14 +110,14 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& { if (_setting >= LandBuyRightSetting::Count) { - log_warning("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); + LOG_WARNING("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE); } SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement == nullptr) { - log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y); + LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[EnumValue(_setting)], STR_NONE); } @@ -167,7 +167,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; default: - log_warning("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); + LOG_WARNING("Tried calling buy land rights with an incorrect setting. setting = %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE); } } diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 5155ee16a5..d6e81a7ba7 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -115,7 +115,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement == nullptr) { - log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y); + LOG_ERROR("Could not find surface. x = %d, y = %d", loc.x, loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -202,7 +202,7 @@ GameActions::Result LandSetRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; } default: - log_warning("Tried calling set land rights with an incorrect setting. setting = %u", _setting); + LOG_WARNING("Tried calling set land rights with an incorrect setting. setting = %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } } diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp index e6bbca1675..b5cab4c5ea 100644 --- a/src/openrct2/actions/LandSmoothAction.cpp +++ b/src/openrct2/actions/LandSmoothAction.cpp @@ -606,7 +606,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const break; } default: - log_error("Invalid map selection %u", _selectionType); + LOG_ERROR("Invalid map selection %u", _selectionType); return GameActions::Result(GameActions::Status::InvalidParameters, std::get(res.ErrorTitle), STR_NONE); } // switch selectionType diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 8c4130c029..4920ab5afa 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -67,7 +67,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const if (_primaryColour >= COLOUR_COUNT || _secondaryColour >= COLOUR_COUNT || _tertiaryColour >= COLOUR_COUNT) { - log_error( + LOG_ERROR( "Invalid game command for scenery placement, primaryColour = %u, secondaryColour = %u", _primaryColour, _secondaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); @@ -75,14 +75,14 @@ GameActions::Result LargeSceneryPlaceAction::Query() const if (_sceneryType >= MAX_LARGE_SCENERY_OBJECTS) { - log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); + LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } auto* sceneryEntry = GetLargeSceneryEntry(_sceneryType); if (sceneryEntry == nullptr) { - log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); + LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } @@ -100,7 +100,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const { if (HasReachedBannerLimit()) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } @@ -162,7 +162,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const if (!CheckMapCapacity(sceneryEntry->tiles, totalNumTiles)) { - log_error("No free map elements available"); + LOG_ERROR("No free map elements available"); return GameActions::Result( GameActions::Status::NoFreeElements, STR_CANT_POSITION_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); } @@ -194,13 +194,13 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const auto* sceneryEntry = GetLargeSceneryEntry(_sceneryType); if (sceneryEntry == nullptr) { - log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); + LOG_ERROR("Invalid game command for scenery placement, sceneryType = %u", _sceneryType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } if (sceneryEntry->tiles == nullptr) { - log_error("Invalid large scenery object, sceneryType = %u", _sceneryType); + LOG_ERROR("Invalid large scenery object, sceneryType = %u", _sceneryType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); } @@ -220,7 +220,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const banner = CreateBanner(); if (banner == nullptr) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index 45990841da..b7c16d5bdf 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -64,7 +64,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex); if (tileElement == nullptr) { - log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); + LOG_WARNING("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -135,7 +135,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const TileElement* tileElement = FindLargeSceneryElement(_loc, _tileIndex); if (tileElement == nullptr) { - log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); + LOG_WARNING("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } @@ -179,7 +179,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const } else { - log_error("Tile not found when trying to remove element!"); + LOG_ERROR("Tile not found when trying to remove element!"); } } diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index ad3e3a0400..26ce08d4a5 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -67,25 +67,25 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) auto mapSizeMax = GetMapSizeMaxXY(); if (_loc.x < 0 || _loc.y < 0 || _loc.x > mapSizeMax.x || _loc.y > mapSizeMax.y) { - log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); + LOG_ERROR("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (_primaryColour >= COLOUR_COUNT) { - log_error("Invalid primary colour: colour = %u", _primaryColour); + LOG_ERROR("Invalid primary colour: colour = %u", _primaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (_secondaryColour >= COLOUR_COUNT) { - log_error("Invalid secondary colour: colour = %u", _secondaryColour); + LOG_ERROR("Invalid secondary colour: colour = %u", _secondaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (_tertiaryColour >= COLOUR_COUNT) { - log_error("Invalid tertiary colour: colour = %u", _tertiaryColour); + LOG_ERROR("Invalid tertiary colour: colour = %u", _tertiaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -93,7 +93,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (largeElement == nullptr) { - log_error( + LOG_ERROR( "Could not find large scenery at: x = %d, y = %d, z = %d, direction = %d, tileIndex = %u", _loc.x, _loc.y, _loc.z, _loc.direction, _tileIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); @@ -108,7 +108,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (sceneryEntry == nullptr) { - log_error("Could not find scenery object. type = %u", largeElement->GetEntryIndex()); + LOG_ERROR("Could not find scenery object. type = %u", largeElement->GetEntryIndex()); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } // Work out the base tile coordinates (Tile with index 0) @@ -143,7 +143,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (tileElement == nullptr) { - log_error( + LOG_ERROR( "Large scenery element not found at: x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); diff --git a/src/openrct2/actions/LoadOrQuitAction.cpp b/src/openrct2/actions/LoadOrQuitAction.cpp index 3fccbefb27..168bd3c8f7 100644 --- a/src/openrct2/actions/LoadOrQuitAction.cpp +++ b/src/openrct2/actions/LoadOrQuitAction.cpp @@ -54,7 +54,7 @@ GameActions::Result LoadOrQuitAction::Execute() const WindowCloseByClass(WindowClass::SavePrompt); break; default: - game_load_or_quit_no_save_prompt(); + GameLoadOrQuitNoSavePrompt(); break; } return GameActions::Result(); diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index ca781f4b0a..c2c2f9d45f 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -250,7 +250,7 @@ GameActions::Result MazeSetTrackAction::Execute() const MapInvalidateTileFull(previousSegment.ToTileStart()); if (tileElement == nullptr) { - log_error("No surface found"); + LOG_ERROR("No surface found"); res.Error = GameActions::Status::Unknown; res.ErrorMessage = STR_NONE; return res; diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index 603d0ce170..e564d0c756 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -51,7 +51,7 @@ GameActions::Result ParkEntranceRemoveAction::Query() const auto entranceIndex = ParkEntranceGetIndex(_loc); if (!LocationValid(_loc) || entranceIndex == -1) { - log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + LOG_ERROR("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } return res; @@ -67,7 +67,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const auto entranceIndex = ParkEntranceGetIndex(_loc); if (entranceIndex == -1) { - log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + LOG_ERROR("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/PauseToggleAction.cpp b/src/openrct2/actions/PauseToggleAction.cpp index ced0bef95d..dc699c18fa 100644 --- a/src/openrct2/actions/PauseToggleAction.cpp +++ b/src/openrct2/actions/PauseToggleAction.cpp @@ -21,6 +21,6 @@ GameActions::Result PauseToggleAction::Query() const GameActions::Result PauseToggleAction::Execute() const { - pause_toggle(); + PauseToggle(); return GameActions::Result(); } diff --git a/src/openrct2/actions/PeepPickupAction.cpp b/src/openrct2/actions/PeepPickupAction.cpp index d7075977df..d3aa5b4aa5 100644 --- a/src/openrct2/actions/PeepPickupAction.cpp +++ b/src/openrct2/actions/PeepPickupAction.cpp @@ -47,7 +47,7 @@ GameActions::Result PeepPickupAction::Query() const { if (_entityId.ToUnderlying() >= MAX_ENTITIES || _entityId.IsNull()) { - log_error("Failed to pick up peep for sprite %d", _entityId); + LOG_ERROR("Failed to pick up peep for sprite %d", _entityId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } @@ -59,7 +59,7 @@ GameActions::Result PeepPickupAction::Query() const auto* const peep = TryGetEntity(_entityId); if (peep == nullptr) { - log_error("Failed to pick up peep for sprite %d", _entityId); + LOG_ERROR("Failed to pick up peep for sprite %d", _entityId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } @@ -106,7 +106,7 @@ GameActions::Result PeepPickupAction::Query() const } break; default: - log_error("Invalid pickup type: %u", _type); + LOG_ERROR("Invalid pickup type: %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } return res; @@ -117,7 +117,7 @@ GameActions::Result PeepPickupAction::Execute() const Peep* const peep = TryGetEntity(_entityId); if (peep == nullptr) { - log_error("Failed to pick up peep for sprite %d", _entityId); + LOG_ERROR("Failed to pick up peep for sprite %d", _entityId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } @@ -145,7 +145,7 @@ GameActions::Result PeepPickupAction::Execute() const if (_owner == network_get_current_player_id()) { // prevent tool_cancel() - input_set_flag(INPUT_FLAG_TOOL_ACTIVE, false); + InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, false); } } @@ -176,7 +176,7 @@ GameActions::Result PeepPickupAction::Execute() const CancelConcurrentPickups(peep); break; default: - log_error("Invalid pickup type: %u", _type); + LOG_ERROR("Invalid pickup type: %u", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, STR_NONE); } return res; diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index 263cebf06c..fda2f60e93 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -127,7 +127,7 @@ GameActions::Result RideCreateAction::Execute() const rideEntry = get_ride_entry(rideEntryIndex); if (rideEntry == nullptr) { - log_warning("Invalid request for ride %u", rideIndex); + LOG_WARNING("Invalid request for ride %u", rideIndex); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_UNKNOWN_OBJECT_TYPE); } diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index 995c3f9f45..bf03ba1d02 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -60,7 +60,7 @@ GameActions::Result RideDemolishAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE); } @@ -104,7 +104,7 @@ GameActions::Result RideDemolishAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE); } diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 8d4cdb282f..2df6f79e89 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -55,13 +55,13 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); } if (_stationNum.ToUnderlying() >= OpenRCT2::Limits::MaxStationsPerRide) { - log_warning("Invalid station number for ride. stationNum: %u", _stationNum.ToUnderlying()); + LOG_WARNING("Invalid station number for ride. stationNum: %u", _stationNum.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); } @@ -136,7 +136,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, errorTitle, STR_NONE); } diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index 44b5a0a1a0..c5cc59c3d9 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -69,7 +69,7 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -98,7 +98,7 @@ GameActions::Result RideEntranceExitRemoveAction::Query() const } else if (entranceElement == nullptr) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, ride = %u, station = %u", _loc.x, _loc.y, _rideIndex.ToUnderlying(), _stationNum.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); @@ -112,7 +112,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride id %u for entrance/exit removal", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -134,7 +134,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const } else if (entranceElement == nullptr) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, ride = %u, station = %d", _loc.x, _loc.y, _rideIndex.ToUnderlying(), _stationNum); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); diff --git a/src/openrct2/actions/RideFreezeRatingAction.cpp b/src/openrct2/actions/RideFreezeRatingAction.cpp index 2045e89d9e..11b63f73b6 100644 --- a/src/openrct2/actions/RideFreezeRatingAction.cpp +++ b/src/openrct2/actions/RideFreezeRatingAction.cpp @@ -34,13 +34,13 @@ GameActions::Result RideFreezeRatingAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } if (_value <= 0) { - log_warning("Rating value must be positive", _rideIndex.ToUnderlying()); + LOG_WARNING("Rating value must be positive", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/RideSetAppearanceAction.cpp b/src/openrct2/actions/RideSetAppearanceAction.cpp index 5b7a3c7ae2..63a4aefe28 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/RideSetAppearanceAction.cpp @@ -53,7 +53,7 @@ GameActions::Result RideSetAppearanceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -64,7 +64,7 @@ GameActions::Result RideSetAppearanceAction::Query() const case RideSetAppearanceType::TrackColourSupports: if (_index >= std::size(ride->track_colour)) { - log_warning("Invalid game command, index %d out of bounds", _index); + LOG_WARNING("Invalid game command, index %d out of bounds", _index); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } break; @@ -73,7 +73,7 @@ GameActions::Result RideSetAppearanceAction::Query() const case RideSetAppearanceType::VehicleColourTernary: if (_index >= std::size(ride->vehicle_colours)) { - log_warning("Invalid game command, index %d out of bounds", _index); + LOG_WARNING("Invalid game command, index %d out of bounds", _index); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } break; @@ -82,7 +82,7 @@ GameActions::Result RideSetAppearanceAction::Query() const case RideSetAppearanceType::SellingItemColourIsRandom: break; default: - log_warning("Invalid game command, type %d not recognised", _type); + LOG_WARNING("Invalid game command, type %d not recognised", _type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -94,7 +94,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/RideSetNameAction.cpp b/src/openrct2/actions/RideSetNameAction.cpp index d71e84a971..9f7c6d37fd 100644 --- a/src/openrct2/actions/RideSetNameAction.cpp +++ b/src/openrct2/actions/RideSetNameAction.cpp @@ -50,7 +50,7 @@ GameActions::Result RideSetNameAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE); } @@ -68,7 +68,7 @@ GameActions::Result RideSetNameAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE); } diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index c14395c88c..7cc82c3bfd 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -54,14 +54,14 @@ GameActions::Result RideSetPriceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -76,14 +76,14 @@ GameActions::Result RideSetPriceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/RideSetSettingAction.cpp b/src/openrct2/actions/RideSetSettingAction.cpp index 08e158a055..26a9b1f244 100644 --- a/src/openrct2/actions/RideSetSettingAction.cpp +++ b/src/openrct2/actions/RideSetSettingAction.cpp @@ -45,7 +45,7 @@ GameActions::Result RideSetSettingAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride: #%u.", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride: #%u.", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } @@ -66,7 +66,7 @@ GameActions::Result RideSetSettingAction::Query() const if (!RideIsModeValid(*ride) && !gCheatsShowAllOperatingModes) { - log_warning("Invalid ride mode: %u", _value); + LOG_WARNING("Invalid ride mode: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; @@ -75,21 +75,21 @@ GameActions::Result RideSetSettingAction::Query() const case RideSetSetting::MinWaitingTime: if (_value > 250) { - log_warning("Invalid minimum waiting time: %u", _value); + LOG_WARNING("Invalid minimum waiting time: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; case RideSetSetting::MaxWaitingTime: if (_value > 250) { - log_warning("Invalid maximum waiting time: %u", _value); + LOG_WARNING("Invalid maximum waiting time: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; case RideSetSetting::Operation: if (!RideIsValidOperationOption(*ride)) { - log_warning("Invalid operation option value: %u", _value); + LOG_WARNING("Invalid operation option value: %u", _value); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, GetOperationErrorMessage(*ride)); } @@ -97,7 +97,7 @@ GameActions::Result RideSetSettingAction::Query() const case RideSetSetting::InspectionInterval: if (_value > RIDE_INSPECTION_NEVER) { - log_warning("Invalid inspection interval: %u", _value); + LOG_WARNING("Invalid inspection interval: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; @@ -109,7 +109,7 @@ GameActions::Result RideSetSettingAction::Query() const auto musicObj = objManager.GetLoadedObject(ObjectType::Music, _value); if (musicObj == nullptr) { - log_warning("Invalid music style: %u", _value); + LOG_WARNING("Invalid music style: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; @@ -117,7 +117,7 @@ GameActions::Result RideSetSettingAction::Query() const case RideSetSetting::LiftHillSpeed: if (!RideIsValidLiftHillSpeed(*ride)) { - log_warning("Invalid lift hill speed: %u", _value); + LOG_WARNING("Invalid lift hill speed: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; @@ -131,19 +131,19 @@ GameActions::Result RideSetSettingAction::Query() const if (!RideIsValidNumCircuits()) { - log_warning("Invalid number of circuits: %u", _value); + LOG_WARNING("Invalid number of circuits: %u", _value); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; case RideSetSetting::RideType: if (!gCheatsAllowArbitraryRideTypeChanges) { - log_warning("Arbitrary ride type changes not allowed."); + LOG_WARNING("Arbitrary ride type changes not allowed."); return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } break; default: - log_warning("Invalid RideSetSetting: %u", static_cast(_setting)); + LOG_WARNING("Invalid RideSetSetting: %u", static_cast(_setting)); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } @@ -155,7 +155,7 @@ GameActions::Result RideSetSettingAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride: #%u.", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride: #%u.", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE); } diff --git a/src/openrct2/actions/RideSetStatusAction.cpp b/src/openrct2/actions/RideSetStatusAction.cpp index bd4d58da4a..0a3742e056 100644 --- a/src/openrct2/actions/RideSetStatusAction.cpp +++ b/src/openrct2/actions/RideSetStatusAction.cpp @@ -60,7 +60,7 @@ GameActions::Result RideSetStatusAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res.ErrorMessage = STR_NONE; @@ -69,7 +69,7 @@ GameActions::Result RideSetStatusAction::Query() const if (_status >= RideStatus::Count) { - log_warning("Invalid ride status %u for ride %u", EnumValue(_status), _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride status %u for ride %u", EnumValue(_status), _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res.ErrorMessage = STR_NONE; @@ -124,7 +124,7 @@ GameActions::Result RideSetStatusAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for ride %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying()); res.Error = GameActions::Status::InvalidParameters; res.ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res.ErrorMessage = STR_NONE; diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index 79a450cb41..8e64545681 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -62,14 +62,14 @@ GameActions::Result RideSetVehicleAction::Query() const { if (_type >= RideSetVehicleType::Count) { - log_warning("Invalid type. type = %d", _type); + LOG_WARNING("Invalid type. type = %d", _type); } auto errTitle = SetVehicleTypeErrorTitle[EnumValue(_type)]; auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -92,13 +92,13 @@ GameActions::Result RideSetVehicleAction::Query() const { if (!RideIsVehicleTypeValid(*ride)) { - log_error("Invalid vehicle type. type = %d", _value); + LOG_ERROR("Invalid vehicle type. type = %d", _value); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } auto rideEntry = get_ride_entry(_value); if (rideEntry == nullptr) { - log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -106,14 +106,14 @@ GameActions::Result RideSetVehicleAction::Query() const vehicle_colour_preset_list* presetList = rideEntry->vehicle_preset_list; if (_colour >= presetList->count && _colour != 255 && _colour != 0) { - log_error("Unknown vehicle colour preset. colour = %d", _colour); + LOG_ERROR("Unknown vehicle colour preset. colour = %d", _colour); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } break; } default: - log_error("Unknown vehicle command. type = %d", _type); + LOG_ERROR("Unknown vehicle command. type = %d", _type); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -126,7 +126,7 @@ GameActions::Result RideSetVehicleAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid game command, ride_id = %u", _rideIndex.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -149,7 +149,7 @@ GameActions::Result RideSetVehicleAction::Execute() const auto rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } uint8_t clampValue = _value; @@ -172,7 +172,7 @@ GameActions::Result RideSetVehicleAction::Execute() const auto rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid ride entry, ride->subtype = %d", ride->subtype); + LOG_WARNING("Invalid ride entry, ride->subtype = %d", ride->subtype); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } @@ -186,7 +186,7 @@ GameActions::Result RideSetVehicleAction::Execute() const } default: - log_error("Unknown vehicle command. type = %d", _type); + LOG_ERROR("Unknown vehicle command. type = %d", _type); return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE); } diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index b5b14ae9ff..2a66f0c41f 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -36,7 +36,7 @@ GameActions::Result ScenarioSetSettingAction::Query() const { if (_setting >= ScenarioSetSetting::Count) { - log_error("Invalid setting: %u", _setting); + LOG_ERROR("Invalid setting: %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -247,7 +247,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const gAllowEarlyCompletionInNetworkPlay = _value; break; default: - log_error("Invalid setting: %u", _setting); + LOG_ERROR("Invalid setting: %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } WindowInvalidateByClass(WindowClass::EditorScenarioOptions); diff --git a/src/openrct2/actions/SignSetNameAction.cpp b/src/openrct2/actions/SignSetNameAction.cpp index 979d5dab42..37f3186570 100644 --- a/src/openrct2/actions/SignSetNameAction.cpp +++ b/src/openrct2/actions/SignSetNameAction.cpp @@ -48,7 +48,7 @@ GameActions::Result SignSetNameAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_warning("Invalid game command for setting sign name, banner id = %d", _bannerIndex); + LOG_WARNING("Invalid game command for setting sign name, banner id = %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_SIGN, STR_NONE); } return GameActions::Result(); @@ -59,7 +59,7 @@ GameActions::Result SignSetNameAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_warning("Invalid game command for setting sign name, banner id = %d", _bannerIndex); + LOG_WARNING("Invalid game command for setting sign name, banner id = %d", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_RENAME_SIGN, STR_NONE); } diff --git a/src/openrct2/actions/SignSetStyleAction.cpp b/src/openrct2/actions/SignSetStyleAction.cpp index 24e7bd8efb..d5371b657c 100644 --- a/src/openrct2/actions/SignSetStyleAction.cpp +++ b/src/openrct2/actions/SignSetStyleAction.cpp @@ -50,7 +50,7 @@ GameActions::Result SignSetStyleAction::Query() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_error("Invalid banner id. id = ", _bannerIndex); + LOG_ERROR("Invalid banner id. id = ", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -59,12 +59,12 @@ GameActions::Result SignSetStyleAction::Query() const TileElement* tileElement = BannerGetTileElement(_bannerIndex); if (tileElement == nullptr) { - log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); + LOG_WARNING("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (tileElement->GetType() != TileElementType::LargeScenery) { - log_warning("Invalid game command for setting sign style, banner id '%d' is not large", _bannerIndex); + LOG_WARNING("Invalid game command for setting sign style, banner id '%d' is not large", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } } @@ -74,7 +74,7 @@ GameActions::Result SignSetStyleAction::Query() const if (wallElement == nullptr) { - log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); + LOG_WARNING("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } } @@ -87,7 +87,7 @@ GameActions::Result SignSetStyleAction::Execute() const auto banner = GetBanner(_bannerIndex); if (banner == nullptr) { - log_error("Invalid banner id. id = ", _bannerIndex); + LOG_ERROR("Invalid banner id. id = ", _bannerIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/SmallScenerySetColourAction.cpp b/src/openrct2/actions/SmallScenerySetColourAction.cpp index b2ca4cb678..6e3a12ee09 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.cpp +++ b/src/openrct2/actions/SmallScenerySetColourAction.cpp @@ -95,7 +95,7 @@ GameActions::Result SmallScenerySetColourAction::QueryExecute(bool isExecuting) if (sceneryElement == nullptr) { - log_error("Small scenery not found at: x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); + LOG_ERROR("Small scenery not found at: x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/StaffFireAction.cpp b/src/openrct2/actions/StaffFireAction.cpp index 004d6a6143..004bc36d9a 100644 --- a/src/openrct2/actions/StaffFireAction.cpp +++ b/src/openrct2/actions/StaffFireAction.cpp @@ -38,14 +38,14 @@ GameActions::Result StaffFireAction::Query() const { if (_spriteId.ToUnderlying() >= MAX_ENTITIES || _spriteId.IsNull()) { - log_error("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - log_error("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -57,7 +57,7 @@ GameActions::Result StaffFireAction::Execute() const auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - log_error("Invalid spriteId. spriteId = %u", _spriteId); + LOG_ERROR("Invalid spriteId. spriteId = %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } WindowCloseByClass(WindowClass::FirePrompt); diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index f3e0244df2..908616f725 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -81,7 +81,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const if (_staffType >= static_cast(StaffType::Count)) { // Invalid staff type. - log_error("Tried to use invalid staff type: %u", static_cast(_staffType)); + LOG_ERROR("Tried to use invalid staff type: %u", static_cast(_staffType)); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); } @@ -96,7 +96,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const if (static_cast(_entertainerType) >= static_cast(EntertainerCostume::Count)) { // Invalid entertainer costume - log_error("Tried to use invalid entertainer type: %u", static_cast(_entertainerType)); + LOG_ERROR("Tried to use invalid entertainer type: %u", static_cast(_entertainerType)); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); } @@ -105,7 +105,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const if (!(availableCostumes & (1 << static_cast(_entertainerType)))) { // Entertainer costume unavailable - log_error("Tried to use unavailable entertainer type: %u", static_cast(_entertainerType)); + LOG_ERROR("Tried to use unavailable entertainer type: %u", static_cast(_entertainerType)); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_NONE); } diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 67172f9e4e..4e9b213f40 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -70,14 +70,14 @@ GameActions::Result StaffSetCostumeAction::Query() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } auto spriteType = EntertainerCostumeToSprite(_costume); if (EnumValue(spriteType) > std::size(peep_slow_walking_types)) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } return GameActions::Result(); @@ -88,7 +88,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/StaffSetNameAction.cpp b/src/openrct2/actions/StaffSetNameAction.cpp index 1cdcc6d46e..92a520ad88 100644 --- a/src/openrct2/actions/StaffSetNameAction.cpp +++ b/src/openrct2/actions/StaffSetNameAction.cpp @@ -55,7 +55,7 @@ GameActions::Result StaffSetNameAction::Query() const auto staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE); } @@ -67,7 +67,7 @@ GameActions::Result StaffSetNameAction::Execute() const auto staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE); } diff --git a/src/openrct2/actions/StaffSetOrdersAction.cpp b/src/openrct2/actions/StaffSetOrdersAction.cpp index d56ee2db26..e6e8e794d8 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/StaffSetOrdersAction.cpp @@ -52,7 +52,7 @@ GameActions::Result StaffSetOrdersAction::Query() const if (staff == nullptr || (staff->AssignedStaffType != StaffType::Handyman && staff->AssignedStaffType != StaffType::Mechanic)) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -64,7 +64,7 @@ GameActions::Result StaffSetOrdersAction::Execute() const auto* staff = TryGetEntity(_spriteIndex); if (staff == nullptr) { - log_warning("Invalid game command for sprite %u", _spriteIndex); + LOG_WARNING("Invalid game command for sprite %u", _spriteIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } staff->StaffOrders = _ordersId; diff --git a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp index 779e830a33..0a518e9f33 100644 --- a/src/openrct2/actions/StaffSetPatrolAreaAction.cpp +++ b/src/openrct2/actions/StaffSetPatrolAreaAction.cpp @@ -60,7 +60,7 @@ GameActions::Result StaffSetPatrolAreaAction::QueryExecute(bool executing) const auto staff = TryGetEntity(_spriteId); if (staff == nullptr) { - log_error("Invalid entity ID: %u", _spriteId.ToUnderlying()); + LOG_ERROR("Invalid entity ID: %u", _spriteId.ToUnderlying()); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 24a7cfbfba..41d41f05ea 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -52,7 +52,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const { if (_surfaceStyle > 0x1F) { - log_error("Invalid surface style."); + LOG_ERROR("Invalid surface style."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE); } @@ -61,7 +61,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (surfaceObj == nullptr) { - log_error("Invalid surface style."); + LOG_ERROR("Invalid surface style."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE); } } @@ -70,7 +70,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const { if (_edgeStyle > 0xF) { - log_error("Invalid edge style."); + LOG_ERROR("Invalid edge style."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE); } @@ -78,7 +78,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (edgeObj == nullptr) { - log_error("Invalid edge style."); + LOG_ERROR("Invalid edge style."); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_LAND_TYPE, STR_NONE); } } diff --git a/src/openrct2/actions/TileModifyAction.cpp b/src/openrct2/actions/TileModifyAction.cpp index 197d2ad933..e1df9adb1d 100644 --- a/src/openrct2/actions/TileModifyAction.cpp +++ b/src/openrct2/actions/TileModifyAction.cpp @@ -219,7 +219,7 @@ GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const break; } default: - log_error("invalid instruction"); + LOG_ERROR("invalid instruction"); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/TrackDesignAction.cpp b/src/openrct2/actions/TrackDesignAction.cpp index b52d89a85d..27a4fbcd79 100644 --- a/src/openrct2/actions/TrackDesignAction.cpp +++ b/src/openrct2/actions/TrackDesignAction.cpp @@ -87,7 +87,7 @@ GameActions::Result TrackDesignAction::Query() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for track placement, ride id = %d", rideIndex); + LOG_WARNING("Invalid game command for track placement, ride id = %d", rideIndex); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } @@ -159,7 +159,7 @@ GameActions::Result TrackDesignAction::Execute() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - log_warning("Invalid game command for track placement, ride id = %d", rideIndex); + LOG_WARNING("Invalid game command for track placement, ride id = %d", rideIndex); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 920e98424a..21d490e0df 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -70,21 +70,21 @@ GameActions::Result TrackPlaceAction::Query() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } if (!DirectionValid(_origin.direction)) { - log_warning("Invalid direction for track placement, direction = %d", _origin.direction); + LOG_WARNING("Invalid direction for track placement, direction = %d", _origin.direction); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } @@ -97,7 +97,7 @@ GameActions::Result TrackPlaceAction::Query() const if (_rideType > RIDE_TYPE_COUNT) { - log_warning("Invalid ride type for track placement, rideType = %d", _rideType); + LOG_WARNING("Invalid ride type for track placement, rideType = %d", _rideType); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } @@ -120,7 +120,7 @@ GameActions::Result TrackPlaceAction::Query() const if (!(GetActionFlags() & GameActions::Flags::AllowWhilePaused)) { - if (game_is_paused() && !gCheatsBuildInPauseMode) + if (GameIsPaused() && !gCheatsBuildInPauseMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, @@ -181,7 +181,7 @@ GameActions::Result TrackPlaceAction::Query() const if (!CheckMapCapacity(numElements)) { - log_warning("Not enough free map elements to place track."); + LOG_WARNING("Not enough free map elements to place track."); return GameActions::Result( GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); @@ -412,7 +412,7 @@ GameActions::Result TrackPlaceAction::Execute() const auto ride = GetRide(_rideIndex); if (ride == nullptr) { - log_warning("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } @@ -420,7 +420,7 @@ GameActions::Result TrackPlaceAction::Execute() const rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); if (rideEntry == nullptr) { - log_warning("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); + LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); } @@ -596,7 +596,7 @@ GameActions::Result TrackPlaceAction::Execute() const auto* trackElement = TileElementInsert(mapLoc, quarterTile.GetBaseQuarterOccupied()); if (trackElement == nullptr) { - log_warning("Cannot create track element for ride = %d", _rideIndex.ToUnderlying()); + LOG_WARNING("Cannot create track element for ride = %d", _rideIndex.ToUnderlying()); return GameActions::Result( GameActions::Status::NoFreeElements, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TILE_ELEMENT_LIMIT_REACHED); diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index 9bc89dde2e..92e5e5074e 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -108,7 +108,7 @@ GameActions::Result TrackRemoveAction::Query() const if (!found) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z, _origin.direction, _sequence); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); @@ -127,13 +127,13 @@ GameActions::Result TrackRemoveAction::Query() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - log_warning("Ride not found. ride index = %d.", rideIndex); + LOG_WARNING("Ride not found. ride index = %d.", rideIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } if (ride->type >= RIDE_TYPE_COUNT) { - log_warning("Ride type not found. ride type = %d.", ride->type); + LOG_WARNING("Ride type not found. ride type = %d.", ride->type); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } const auto& ted = GetTrackElementDescriptor(trackType); @@ -141,7 +141,7 @@ GameActions::Result TrackRemoveAction::Query() const const rct_preview_track* trackBlock = ted.GetBlockForSequence(sequenceIndex); if (trackBlock == nullptr) { - log_warning("Track block %d not found for track type %d.", sequenceIndex, trackType); + LOG_WARNING("Track block %d not found for track type %d.", sequenceIndex, trackType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } @@ -202,7 +202,7 @@ GameActions::Result TrackRemoveAction::Query() const if (!found) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z, _origin.direction, trackBlock->index); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); @@ -222,7 +222,7 @@ GameActions::Result TrackRemoveAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); + LOG_WARNING("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } @@ -309,7 +309,7 @@ GameActions::Result TrackRemoveAction::Execute() const if (!found) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", _origin.x, _origin.y, _origin.z, _origin.direction, _sequence); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); @@ -322,7 +322,7 @@ GameActions::Result TrackRemoveAction::Execute() const auto ride = GetRide(rideIndex); if (ride == nullptr) { - log_warning("Ride not found. ride index = %d.", rideIndex); + LOG_WARNING("Ride not found. ride index = %d.", rideIndex); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } const auto& ted = GetTrackElementDescriptor(trackType); @@ -330,7 +330,7 @@ GameActions::Result TrackRemoveAction::Execute() const const rct_preview_track* trackBlock = ted.GetBlockForSequence(sequenceIndex); if (trackBlock == nullptr) { - log_warning("Track block %d not found for track type %d.", sequenceIndex, trackType); + LOG_WARNING("Track block %d not found for track type %d.", sequenceIndex, trackType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } @@ -386,7 +386,7 @@ GameActions::Result TrackRemoveAction::Execute() const if (!found) { - log_warning( + LOG_WARNING( "Track Element not found. x = %d, y = %d, z = %d, d = %d, seq = %d.", mapLoc.x, mapLoc.y, mapLoc.z, _origin.direction, trackBlock->index); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); @@ -406,7 +406,7 @@ GameActions::Result TrackRemoveAction::Execute() const auto* surfaceElement = MapGetSurfaceElementAt(mapLoc); if (surfaceElement == nullptr) { - log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); + LOG_WARNING("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS, STR_NONE); } diff --git a/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp b/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp index f3ff224088..0c564f7fc7 100644 --- a/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp +++ b/src/openrct2/actions/TrackSetBrakeSpeedAction.cpp @@ -63,7 +63,7 @@ GameActions::Result TrackSetBrakeSpeedAction::QueryExecute(bool isExecuting) con TileElement* tileElement = MapGetTrackElementAtOfType(_loc, _trackType); if (tileElement == nullptr) { - log_warning("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y); + LOG_WARNING("Invalid game command for setting brakes speed. x = %d, y = %d", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 29ffcc3944..36a301c2ff 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -95,7 +95,7 @@ GameActions::Result WallPlaceAction::Query() const } else if (!_trackDesignDrawingPreview && (_loc.x > mapSizeMax.x || _loc.y > mapSizeMax.y)) { - log_error("Invalid x/y coordinates. x = %d y = %d", _loc.x, _loc.y); + LOG_ERROR("Invalid x/y coordinates. x = %d y = %d", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } @@ -111,7 +111,7 @@ GameActions::Result WallPlaceAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(_loc); if (surfaceElement == nullptr) { - log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); + LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } targetHeight = surfaceElement->GetBaseZ(); @@ -128,7 +128,7 @@ GameActions::Result WallPlaceAction::Query() const auto* surfaceElement = MapGetSurfaceElementAt(_loc); if (surfaceElement == nullptr) { - log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); + LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } @@ -219,7 +219,7 @@ GameActions::Result WallPlaceAction::Query() const if (wallEntry == nullptr) { - log_error("Wall Type not found %d", _wallType); + LOG_ERROR("Wall Type not found %d", _wallType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } @@ -227,7 +227,7 @@ GameActions::Result WallPlaceAction::Query() const { if (HasReachedBannerLimit()) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } @@ -290,7 +290,7 @@ GameActions::Result WallPlaceAction::Execute() const auto* surfaceElement = MapGetSurfaceElementAt(_loc); if (surfaceElement == nullptr) { - log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); + LOG_ERROR("Surface element not found at %d, %d.", _loc.x, _loc.y); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } targetHeight = surfaceElement->GetBaseZ(); @@ -309,7 +309,7 @@ GameActions::Result WallPlaceAction::Execute() const if (wallEntry == nullptr) { - log_error("Wall Type not found %d", _wallType); + LOG_ERROR("Wall Type not found %d", _wallType); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_NONE); } @@ -336,7 +336,7 @@ GameActions::Result WallPlaceAction::Execute() const banner = CreateBanner(); if (banner == nullptr) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result( GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME); } diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index bb93d54464..68435c0219 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -72,7 +72,7 @@ GameActions::Result WallSetColourAction::Query() const auto wallElement = MapGetWallElementAt(_loc); if (wallElement == nullptr) { - log_error( + LOG_ERROR( "Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -85,19 +85,19 @@ GameActions::Result WallSetColourAction::Query() const auto* wallEntry = wallElement->GetEntry(); if (wallEntry == nullptr) { - log_error("Could not find wall object"); + LOG_ERROR("Could not find wall object"); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } if (_primaryColour > 31) { - log_error("Primary colour invalid: colour = %d", _primaryColour); + LOG_ERROR("Primary colour invalid: colour = %d", _primaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } if (_secondaryColour > 31) { - log_error("Secondary colour invalid: colour = %d", _secondaryColour); + LOG_ERROR("Secondary colour invalid: colour = %d", _secondaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -105,7 +105,7 @@ GameActions::Result WallSetColourAction::Query() const { if (_tertiaryColour > 31) { - log_error("Tertiary colour invalid: colour = %d", _tertiaryColour); + LOG_ERROR("Tertiary colour invalid: colour = %d", _tertiaryColour); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } } @@ -124,7 +124,7 @@ GameActions::Result WallSetColourAction::Execute() const auto wallElement = MapGetWallElementAt(_loc); if (wallElement == nullptr) { - log_error( + LOG_ERROR( "Could not find wall element at: x = %d, y = %d, z = %d, direction = %u", _loc.x, _loc.y, _loc.z, _loc.direction); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } @@ -137,7 +137,7 @@ GameActions::Result WallSetColourAction::Execute() const auto* wallEntry = wallElement->GetEntry(); if (wallEntry == nullptr) { - log_error("Could not find wall object"); + LOG_ERROR("Could not find wall object"); return GameActions::Result(GameActions::Status::Unknown, STR_CANT_REPAINT_THIS, STR_NONE); } diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 9355b56872..29ff1745a7 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -73,7 +73,7 @@ GameActions::Result WaterSetHeightAction::Query() const SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) { - log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); + LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); } @@ -118,7 +118,7 @@ GameActions::Result WaterSetHeightAction::Execute() const SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords); if (surfaceElement == nullptr) { - log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); + LOG_ERROR("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); } diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index 7d82a5d869..2254d94e26 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -74,13 +74,13 @@ static std::vector extract_paint_session(std::string_view gOpenRCT2Headless = true; auto context = OpenRCT2::CreateContext(); std::vector sessions; - log_info("Starting..."); + LOG_INFO("Starting..."); if (context->Initialise()) { DrawingEngineInit(); if (!context->LoadParkFromFile(std::string(parkFileName))) { - log_error("Failed to load park!"); + LOG_ERROR("Failed to load park!"); return {}; } @@ -111,7 +111,7 @@ static std::vector extract_paint_session(std::string_view gCurrentRotation = 0; // Ensure sprites appear regardless of rotation - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); rct_drawpixelinfo dpi; dpi.x = 0; @@ -121,13 +121,13 @@ static std::vector extract_paint_session(std::string_view dpi.pitch = 0; dpi.bits = static_cast(malloc(dpi.width * dpi.height)); - log_info("Obtaining sprite data..."); + LOG_INFO("Obtaining sprite data..."); ViewportRender(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } }, &sessions); free(dpi.bits); DrawingEngineDispose(); } - log_info("Got %u paint sessions.", std::size(sessions)); + LOG_INFO("Got %u paint sessions.", std::size(sessions)); return sessions; } @@ -215,7 +215,7 @@ static exitcode_t HandleBenchSpriteSort(CommandLineArgEnumerator* argEnumerator) #else static exitcode_t HandleBenchSpriteSort(CommandLineArgEnumerator* argEnumerator) { - log_error("Sorry, Google benchmark not enabled in this build"); + LOG_ERROR("Sorry, Google benchmark not enabled in this build"); return EXITCODE_FAIL; } #endif // USE_BENCHMARK diff --git a/src/openrct2/cmdline/BenchUpdate.cpp b/src/openrct2/cmdline/BenchUpdate.cpp index a8c668a858..52a6533a2f 100644 --- a/src/openrct2/cmdline/BenchUpdate.cpp +++ b/src/openrct2/cmdline/BenchUpdate.cpp @@ -140,7 +140,7 @@ static exitcode_t HandleBenchUpdate(CommandLineArgEnumerator* argEnumerator) #else static exitcode_t HandleBenchUpdate(CommandLineArgEnumerator* argEnumerator) { - log_error("Sorry, Google benchmark not enabled in this build"); + LOG_ERROR("Sorry, Google benchmark not enabled in this build"); return EXITCODE_FAIL; } #endif // USE_BENCHMARK diff --git a/src/openrct2/cmdline/ConvertCommand.cpp b/src/openrct2/cmdline/ConvertCommand.cpp index 24f70cea7b..77393e6303 100644 --- a/src/openrct2/cmdline/ConvertCommand.cpp +++ b/src/openrct2/cmdline/ConvertCommand.cpp @@ -42,7 +42,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato } const auto sourcePath = Path::GetAbsolute(rawSourcePath); - auto sourceFileType = get_file_extension_type(sourcePath.c_str()); + auto sourceFileType = GetFileExtensionType(sourcePath.c_str()); // Get the destination path const utf8* rawDestinationPath; @@ -53,7 +53,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato } const auto destinationPath = Path::GetAbsolute(rawDestinationPath); - auto destinationFileType = get_file_extension_type(destinationPath.c_str()); + auto destinationFileType = GetFileExtensionType(destinationPath.c_str()); // Validate target type if (destinationFileType != FileExtension::PARK) diff --git a/src/openrct2/cmdline/RootCommands.cpp b/src/openrct2/cmdline/RootCommands.cpp index 726633cf6d..4a02c359de 100644 --- a/src/openrct2/cmdline/RootCommands.cpp +++ b/src/openrct2/cmdline/RootCommands.cpp @@ -442,7 +442,7 @@ static void PrintAbout() static void PrintVersion() { char buffer[256]; - openrct2_write_full_version_info(buffer, sizeof(buffer)); + OpenRCT2WriteFullVersionInfo(buffer, sizeof(buffer)); Console::WriteLine(buffer); Console::WriteFormat("%s (%s)", OPENRCT2_PLATFORM, OPENRCT2_ARCHITECTURE); Console::WriteLine(); @@ -475,7 +475,7 @@ static void PrintLaunchInformation() struct tm* tmInfo; // Print name and version information - openrct2_write_full_version_info(buffer, sizeof(buffer)); + OpenRCT2WriteFullVersionInfo(buffer, sizeof(buffer)); Console::WriteFormat("%s", buffer); Console::WriteLine(); Console::WriteFormat("%s (%s)", OPENRCT2_PLATFORM, OPENRCT2_ARCHITECTURE); diff --git a/src/openrct2/cmdline/SpriteCommands.cpp b/src/openrct2/cmdline/SpriteCommands.cpp index 5344f341b7..2ec38a727a 100644 --- a/src/openrct2/cmdline/SpriteCommands.cpp +++ b/src/openrct2/cmdline/SpriteCommands.cpp @@ -56,7 +56,7 @@ static exitcode_t HandleSprite(CommandLineArgEnumerator* argEnumerator) const char** argv = const_cast(argEnumerator->GetArguments()) + argEnumerator->GetIndex() - 1; int32_t argc = argEnumerator->GetCount() - argEnumerator->GetIndex() + 1; - int32_t result = cmdline_for_sprite(argv, argc); + int32_t result = CmdLineForSprite(argv, argc); if (result < 0) { return EXITCODE_FAIL; diff --git a/src/openrct2/common.h b/src/openrct2/common.h index 31c3f7bc90..f8046d768f 100644 --- a/src/openrct2/common.h +++ b/src/openrct2/common.h @@ -37,7 +37,7 @@ using colour_t = uint8_t; #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) # include -# define STUB() log_warning("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__) +# define STUB() LOG_WARNING("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__) # define _strcmpi _stricmp # define _stricmp(x, y) strcasecmp((x), (y)) # define _strnicmp(x, y, n) strncasecmp((x), (y), (n)) diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 7767eb2dc9..c3292bdc55 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -639,7 +639,7 @@ namespace Config */ static u8string FindRCT1Path() { - log_verbose("config_find_rct1_path(...)"); + LOG_VERBOSE("config_find_rct1_path(...)"); static constexpr u8string_view searchLocations[] = { R"(C:\Program Files\Steam\steamapps\common\Rollercoaster Tycoon Deluxe)", @@ -684,7 +684,7 @@ namespace Config */ static u8string FindRCT2Path() { - log_verbose("config_find_rct2_path(...)"); + LOG_VERBOSE("config_find_rct2_path(...)"); static constexpr u8string_view searchLocations[] = { R"(C:\Program Files\Steam\steamapps\common\Rollercoaster Tycoon 2)", @@ -753,14 +753,14 @@ namespace Config if (!Platform::FindApp("innoextract", &path)) { - log_error("Please install innoextract to extract files from GOG."); + LOG_ERROR("Please install innoextract to extract files from GOG."); return false; } int32_t exit_status = Platform::Execute( String::StdFormat( "%s '%s' --exclude-temp --output-dir '%s'", path.c_str(), installerPath.c_str(), targetPath.c_str()), &output); - log_info("Exit status %d", exit_status); + LOG_INFO("Exit status %d", exit_status); return exit_status == 0; } } // namespace Config diff --git a/src/openrct2/core/File.cpp b/src/openrct2/core/File.cpp index 7d531b27c1..8bdfce3093 100644 --- a/src/openrct2/core/File.cpp +++ b/src/openrct2/core/File.cpp @@ -26,7 +26,7 @@ namespace File bool Exists(u8string_view path) { fs::path file = fs::u8path(path); - log_verbose("Checking if file exists: %s", u8string(path).c_str()); + LOG_VERBOSE("Checking if file exists: %s", u8string(path).c_str()); std::error_code ec; const auto result = fs::exists(file, ec); return result && ec.value() == 0; @@ -36,7 +36,7 @@ namespace File { if (!overwrite && Exists(dstPath)) { - log_warning("File::Copy(): Not overwriting %s, because overwrite flag == false", u8string(dstPath).c_str()); + LOG_WARNING("File::Copy(): Not overwriting %s, because overwrite flag == false", u8string(dstPath).c_str()); return false; } diff --git a/src/openrct2/core/FileIndex.hpp b/src/openrct2/core/FileIndex.hpp index f490dd4794..7fa6b9e759 100644 --- a/src/openrct2/core/FileIndex.hpp +++ b/src/openrct2/core/FileIndex.hpp @@ -143,7 +143,7 @@ private: for (const auto& directory : SearchPaths) { auto absoluteDirectory = Path::GetAbsolute(directory); - log_verbose("FileIndex:Scanning for %s in '%s'", _pattern.c_str(), absoluteDirectory.c_str()); + LOG_VERBOSE("FileIndex:Scanning for %s in '%s'", _pattern.c_str(), absoluteDirectory.c_str()); auto pattern = Path::Combine(absoluteDirectory, _pattern); auto scanner = Path::ScanDirectory(pattern, true); @@ -177,7 +177,7 @@ private: if (_log_levels[static_cast(DiagnosticLevel::Verbose)]) { std::lock_guard lock(printLock); - log_verbose("FileIndex:Indexing '%s'", filePath.c_str()); + LOG_VERBOSE("FileIndex:Indexing '%s'", filePath.c_str()); } if (auto item = Create(language, filePath); item.has_value()) @@ -254,7 +254,7 @@ private: { try { - log_verbose("FileIndex:Loading index: '%s'", _indexPath.c_str()); + LOG_VERBOSE("FileIndex:Loading index: '%s'", _indexPath.c_str()); auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FILE_MODE_OPEN); // Read header, check if we need to re-scan @@ -294,7 +294,7 @@ private: { try { - log_verbose("FileIndex:Writing index: '%s'", _indexPath.c_str()); + LOG_VERBOSE("FileIndex:Writing index: '%s'", _indexPath.c_str()); Path::CreateDirectory(Path::GetDirectory(_indexPath)); auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FILE_MODE_WRITE); diff --git a/src/openrct2/core/FileWatcher.cpp b/src/openrct2/core/FileWatcher.cpp index d2292c9ec9..439be15859 100644 --- a/src/openrct2/core/FileWatcher.cpp +++ b/src/openrct2/core/FileWatcher.cpp @@ -44,11 +44,11 @@ void FileWatcher::FileDescriptor::Initialise() fcntl(fd, F_SETFL, flags | O_NONBLOCK); Fd = fd; - log_verbose("FileWatcher: inotify_init succeeded"); + LOG_VERBOSE("FileWatcher: inotify_init succeeded"); } else { - log_verbose("FileWatcher: inotify_init failed"); + LOG_VERBOSE("FileWatcher: inotify_init failed"); throw std::runtime_error("inotify_init failed"); } } @@ -69,11 +69,11 @@ FileWatcher::WatchDescriptor::WatchDescriptor(int fd, const std::string& path) { if (Wd >= 0) { - log_verbose("FileWatcher: inotify watch added for %s", path.c_str()); + LOG_VERBOSE("FileWatcher: inotify watch added for %s", path.c_str()); } else { - log_verbose("FileWatcher: inotify_add_watch failed for %s", path.c_str()); + LOG_VERBOSE("FileWatcher: inotify_add_watch failed for %s", path.c_str()); throw std::runtime_error("inotify_add_watch failed for '" + path + "'"); } } @@ -81,7 +81,7 @@ FileWatcher::WatchDescriptor::WatchDescriptor(int fd, const std::string& path) FileWatcher::WatchDescriptor::~WatchDescriptor() { inotify_rm_watch(Fd, Wd); - log_verbose("FileWatcher: inotify watch removed"); + LOG_VERBOSE("FileWatcher: inotify watch removed"); } #endif @@ -106,9 +106,9 @@ void FileWatcher::FSEventsCallback( for (size_t i = 0; i < numEvents; i++) { if (eventFlags[i] & eventModified) - log_verbose("Modified: %s\n", paths[i]); + LOG_VERBOSE("Modified: %s\n", paths[i]); if (eventFlags[i] & eventRenamed) - log_verbose("Renamed: %s\n", paths[i]); + LOG_VERBOSE("Renamed: %s\n", paths[i]); if (eventFlags[i] & eventModified || eventFlags[i] & eventRenamed) { @@ -211,14 +211,14 @@ void FileWatcher::WatchDirectory() } } #elif defined(__linux__) - log_verbose("FileWatcher: reading event data..."); + LOG_VERBOSE("FileWatcher: reading event data..."); std::array eventData; while (!_finished) { int length = read(_fileDesc.Fd, eventData.data(), eventData.size()); if (length >= 0) { - log_verbose("FileWatcher: inotify event data received"); + LOG_VERBOSE("FileWatcher: inotify event data received"); auto onFileChanged = OnFileChanged; if (onFileChanged) { @@ -228,7 +228,7 @@ void FileWatcher::WatchDirectory() auto e = reinterpret_cast(eventData.data() + offset); if ((e->mask & IN_CLOSE_WRITE) && !(e->mask & IN_ISDIR)) { - log_verbose("FileWatcher: inotify event received for %s", e->name); + LOG_VERBOSE("FileWatcher: inotify event received for %s", e->name); // Find watch descriptor int wd = e->wd; diff --git a/src/openrct2/core/Imaging.cpp b/src/openrct2/core/Imaging.cpp index 67895e1fef..1d4e59aca3 100644 --- a/src/openrct2/core/Imaging.cpp +++ b/src/openrct2/core/Imaging.cpp @@ -51,12 +51,12 @@ namespace Imaging static void PngWarning(png_structp, const char* b) { - log_warning(b); + LOG_WARNING(b); } static void PngError(png_structp, const char* b) { - log_error(b); + LOG_ERROR(b); } static Image ReadPng(std::istream& istream, bool expandTo32) diff --git a/src/openrct2/core/Json.cpp b/src/openrct2/core/Json.cpp index f773c10881..f5fbbfd7c3 100644 --- a/src/openrct2/core/Json.cpp +++ b/src/openrct2/core/Json.cpp @@ -63,7 +63,7 @@ namespace Json } catch (const json_t::exception& e) { - log_error("Unable to parse JSON string (%.*s)\n\t%s", static_cast(raw.length()), raw.data(), e.what()); + LOG_ERROR("Unable to parse JSON string (%.*s)\n\t%s", static_cast(raw.length()), raw.data(), e.what()); } return json; @@ -79,7 +79,7 @@ namespace Json } catch (const json_t::exception& e) { - log_error("Unable to parse JSON vector (%.*s)\n\t%s", static_cast(vec.size()), vec.data(), e.what()); + LOG_ERROR("Unable to parse JSON vector (%.*s)\n\t%s", static_cast(vec.size()), vec.data(), e.what()); } return json; diff --git a/src/openrct2/core/RTL.FriBidi.cpp b/src/openrct2/core/RTL.FriBidi.cpp index 48c8a6c886..3b398a5e08 100644 --- a/src/openrct2/core/RTL.FriBidi.cpp +++ b/src/openrct2/core/RTL.FriBidi.cpp @@ -59,7 +59,7 @@ std::string FixRTL(std::string& input) { if (!hasWarned) { - log_warning("This build of OpenRCT2 cannot properly handle right-to-left text!"); + LOG_WARNING("This build of OpenRCT2 cannot properly handle right-to-left text!"); hasWarned = true; } diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index 16f642d9fe..a1d812f425 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -374,7 +374,7 @@ namespace String return u8string(buffer, buffer + len); } - log_warning("Encoding error occured"); + LOG_WARNING("Encoding error occured"); return u8string{}; } @@ -695,7 +695,7 @@ namespace String { // Check the error auto error = GetLastError(); - log_warning("LCMapStringEx failed with %d", error); + LOG_WARNING("LCMapStringEx failed with %d", error); return std::string(src); } diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 20671488aa..03d38003d1 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -196,14 +196,14 @@ bool gTinyFontAntiAliased = false; */ bool GfxLoadG1(const IPlatformEnvironment& env) { - log_verbose("GfxLoadG1(...)"); + LOG_VERBOSE("GfxLoadG1(...)"); try { auto path = env.FindFile(DIRBASE::RCT2, DIRID::DATA, u8"g1.dat"); auto fs = FileStream(path, FILE_MODE_OPEN); _g1.header = fs.ReadValue(); - log_verbose("g1.dat, number of entries: %u", _g1.header.num_entries); + LOG_VERBOSE("g1.dat, number of entries: %u", _g1.header.num_entries); if (_g1.header.num_entries < SPR_G1_END) { @@ -231,7 +231,7 @@ bool GfxLoadG1(const IPlatformEnvironment& env) _g1.elements.clear(); _g1.elements.shrink_to_fit(); - log_fatal("Unable to load g1 graphics"); + LOG_FATAL("Unable to load g1 graphics"); if (!gOpenRCT2Headless) { auto uiContext = GetContext()->GetUiContext(); @@ -264,7 +264,7 @@ void GfxUnloadCsg() bool GfxLoadG2() { - log_verbose("GfxLoadG2()"); + LOG_VERBOSE("GfxLoadG2()"); auto env = GetContext()->GetPlatformEnvironment(); @@ -287,7 +287,7 @@ bool GfxLoadG2() std::string errorMessage = "Mismatched g2.dat size.\nExpected: " + std::to_string(G2_SPRITE_COUNT) + "\nActual: " + std::to_string(_g2.header.num_entries) + "\ng2.dat may be installed improperly.\nPath to g2.dat: " + path; - log_error(errorMessage.c_str()); + LOG_ERROR(errorMessage.c_str()); if (!gOpenRCT2Headless) { @@ -310,7 +310,7 @@ bool GfxLoadG2() _g2.elements.clear(); _g2.elements.shrink_to_fit(); - log_fatal("Unable to load g2 graphics"); + LOG_FATAL("Unable to load g2 graphics"); if (!gOpenRCT2Headless) { auto uiContext = GetContext()->GetUiContext(); @@ -322,11 +322,11 @@ bool GfxLoadG2() bool GfxLoadCsg() { - log_verbose("GfxLoadCsg()"); + LOG_VERBOSE("GfxLoadCsg()"); if (gConfigGeneral.RCT1Path.empty()) { - log_verbose(" unable to load CSG, RCT1 path not set"); + LOG_VERBOSE(" unable to load CSG, RCT1 path not set"); return false; } @@ -344,7 +344,7 @@ bool GfxLoadCsg() if (!CsgIsUsable(_csg)) { - log_warning("Cannot load CSG1.DAT, it has too few entries. Only CSG1.DAT from Loopy Landscapes will work."); + LOG_WARNING("Cannot load CSG1.DAT, it has too few entries. Only CSG1.DAT from Loopy Landscapes will work."); return false; } @@ -373,7 +373,7 @@ bool GfxLoadCsg() _csg.elements.clear(); _csg.elements.shrink_to_fit(); - log_error("Unable to load csg graphics"); + LOG_ERROR("Unable to load csg graphics"); return false; } } @@ -398,7 +398,7 @@ std::optional GfxLoadGx(const std::vector& buffer) } catch (const std::exception&) { - log_verbose("Unable to load rct_gx graphics"); + LOG_VERBOSE("Unable to load rct_gx graphics"); } return std::nullopt; } @@ -727,7 +727,7 @@ const rct_g1_element* GfxGetG1Element(ImageIndex image_id) return &_g2.elements[idx]; } - log_warning("Invalid entry in g2.dat requested, idx = %u. You may have to update your g2.dat.", idx); + LOG_WARNING("Invalid entry in g2.dat requested, idx = %u. You may have to update your g2.dat.", idx); } else if (offset < SPR_CSG_END) { @@ -739,7 +739,7 @@ const rct_g1_element* GfxGetG1Element(ImageIndex image_id) return &_csg.elements[idx]; } - log_warning("Invalid entry in csg.dat requested, idx = %u.", idx); + LOG_WARNING("Invalid entry in csg.dat requested, idx = %u.", idx); } } else if (offset < SPR_SCROLLING_TEXT_END) diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 4edda7eb00..f8f769d253 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -563,17 +563,17 @@ void MaskInit() { if (avx2_available()) { - log_verbose("registering AVX2 mask function"); + LOG_VERBOSE("registering AVX2 mask function"); MaskFn = MaskAvx2; } else if (sse41_available()) { - log_verbose("registering SSE4.1 mask function"); + LOG_VERBOSE("registering SSE4.1 mask function"); MaskFn = MaskSse4_1; } else { - log_verbose("registering scalar mask function"); + LOG_VERBOSE("registering scalar mask function"); MaskFn = MaskScalar; } } diff --git a/src/openrct2/drawing/Font.cpp b/src/openrct2/drawing/Font.cpp index 35da8778da..a9619f6d9e 100644 --- a/src/openrct2/drawing/Font.cpp +++ b/src/openrct2/drawing/Font.cpp @@ -307,7 +307,7 @@ int32_t FontSpriteGetCodepointWidth(FontStyle fontStyle, int32_t codepoint) if (glyphIndex >= static_cast(std::size(_additionalSpriteFontCharacterWidth[baseFontIndex]))) { - log_warning("Invalid glyph index %u", glyphIndex); + LOG_WARNING("Invalid glyph index %u", glyphIndex); glyphIndex = 0; } return _additionalSpriteFontCharacterWidth[baseFontIndex][glyphIndex]; @@ -315,7 +315,7 @@ int32_t FontSpriteGetCodepointWidth(FontStyle fontStyle, int32_t codepoint) if (glyphIndex < 0 || glyphIndex >= static_cast(FONT_SPRITE_GLYPH_COUNT)) { - log_warning("Invalid glyph index %u", glyphIndex); + LOG_WARNING("Invalid glyph index %u", glyphIndex); glyphIndex = 0; } return _spriteFontCharacterWidths[baseFontIndex][glyphIndex]; diff --git a/src/openrct2/drawing/Image.cpp b/src/openrct2/drawing/Image.cpp index c8345b3edf..97c25b6250 100644 --- a/src/openrct2/drawing/Image.cpp +++ b/src/openrct2/drawing/Image.cpp @@ -162,7 +162,7 @@ static void FreeImageList(uint32_t baseImageId, uint32_t count) #ifdef DEBUG_LEVEL_1 if (!AllocatedListRemove(baseImageId, count)) { - log_error("Cannot unload %u items from offset %u", count, baseImageId); + LOG_ERROR("Cannot unload %u items from offset %u", count, baseImageId); } #endif _allocatedImageCount -= count; @@ -196,7 +196,7 @@ uint32_t GfxObjectAllocateImages(const rct_g1_element* images, uint32_t count) uint32_t baseImageId = AllocateImageList(count); if (baseImageId == INVALID_IMAGE_ID) { - log_error("Reached maximum image limit."); + LOG_ERROR("Reached maximum image limit."); return INVALID_IMAGE_ID; } diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 41f50620da..ca6152793d 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -311,7 +311,7 @@ void LightFXPrepareLightList() auto info = SetInteractionInfoFromPaintSession(session, w->viewport->flags, ViewportInteractionItemAll); PaintSessionFree(session); - // log_warning("[%i, %i]", dpi->x, dpi->y); + // LOG_WARNING("[%i, %i]", dpi->x, dpi->y); mapCoord = info.Loc; mapCoord.x += tileOffsetX; @@ -346,7 +346,7 @@ void LightFXPrepareLightList() lightIntensityOccluded += std::max(0, 200 - (projDot * 20)); } - // log_warning("light %i [%i, %i, %i], [%i, %i] minDist to %i: %i; projdot: %i", light, coord_3d.x, coord_3d.y, + // LOG_WARNING("light %i [%i, %i, %i], [%i, %i] minDist to %i: %i; projdot: %i", light, coord_3d.x, coord_3d.y, // coord_3d.z, mapCoord.x, mapCoord.y, baseHeight, minDist, projDot); if (pat == 0) @@ -453,7 +453,7 @@ void LightFXRenderLightsToFrontBuffer() _lightPolution_back = 0; - // log_warning("%i lights", LightListCurrentCountFront); + // LOG_WARNING("%i lights", LightListCurrentCountFront); for (uint32_t light = 0; light < LightListCurrentCountFront; light++) { @@ -633,7 +633,7 @@ static void LightFXAdd3DLight( return; } - // log_warning("%i lights in back", LightListCurrentCountBack); + // LOG_WARNING("%i lights in back", LightListCurrentCountBack); for (uint32_t i = 0; i < LightListCurrentCountBack; i++) { @@ -668,7 +668,7 @@ static void LightFXAdd3DLight( entry->LightID = id; entry->LightLinger = 1; - // log_warning("new 3d light"); + // LOG_WARNING("new 3d light"); } static void LightFXAdd3DLight(const CoordsXYZ& loc, const LightType lightType) diff --git a/src/openrct2/drawing/TTF.cpp b/src/openrct2/drawing/TTF.cpp index b961e2eb98..b551f6a3b8 100644 --- a/src/openrct2/drawing/TTF.cpp +++ b/src/openrct2/drawing/TTF.cpp @@ -117,7 +117,7 @@ bool TTFInitialise() if (TTF_Init() != 0) { - log_error("Couldn't initialise FreeType engine"); + LOG_ERROR("Couldn't initialise FreeType engine"); return false; } @@ -128,14 +128,14 @@ bool TTFInitialise() auto fontPath = Platform::GetFontPath(*fontDesc); if (fontPath.empty()) { - log_verbose("Unable to load font '%s'", fontDesc->font_name); + LOG_VERBOSE("Unable to load font '%s'", fontDesc->font_name); return false; } fontDesc->font = TTFOpenFont(fontPath.c_str(), fontDesc->ptSize); if (fontDesc->font == nullptr) { - log_verbose("Unable to load '%s'", fontPath.c_str()); + LOG_VERBOSE("Unable to load '%s'", fontPath.c_str()); return false; } } diff --git a/src/openrct2/drawing/TTFSDLPort.cpp b/src/openrct2/drawing/TTFSDLPort.cpp index 8a822b8e99..e27207919f 100644 --- a/src/openrct2/drawing/TTFSDLPort.cpp +++ b/src/openrct2/drawing/TTFSDLPort.cpp @@ -159,7 +159,7 @@ struct InternalTTFFont static FT_Library library; static int TTF_initialized = 0; -# define TTF_SetError log_error +# define TTF_SetError LOG_ERROR # define TTF_CHECKPOINTER(p, errval) \ if (!TTF_initialized) \ diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index d92af2f146..c1ebaa5b64 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -429,7 +429,7 @@ static void EntitySpatialRemove(EntityBase* entity) } else { - log_warning("Bad sprite spatial index. Rebuilding the spatial index..."); + LOG_WARNING("Bad sprite spatial index. Rebuilding the spatial index..."); ResetEntitySpatialIndices(); } } diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index ec0fe158b6..cf9a55f36e 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -4228,7 +4228,7 @@ void Guest::UpdateRideLeaveVehicle() } else { - log_verbose( + LOG_VERBOSE( "CurrentSeat %d is too large! (Vehicle entry has room for %d.)", CurrentSeat, carEntry->peep_loading_positions.size()); } @@ -7382,7 +7382,7 @@ void Guest::RemoveFromQueue() auto* otherGuest = GetEntity(station.LastPeepInQueue); if (otherGuest == nullptr) { - log_error("Invalid Guest Queue list!"); + LOG_ERROR("Invalid Guest Queue list!"); return; } for (; otherGuest != nullptr; otherGuest = GetEntity(otherGuest->GuestNextInQueue)) diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 311bc9ff4d..5bb0c718d2 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -79,7 +79,7 @@ void MoneyEffect::Create(money64 value, const CoordsXYZ& loc) // coordinates as every client will have different ones. if (network_get_mode() != NETWORK_MODE_NONE) { - log_warning("Attempted to create money effect without a valid location in multiplayer"); + LOG_WARNING("Attempted to create money effect without a valid location in multiplayer"); return; } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 1586d5b496..1d51689695 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -2665,7 +2665,7 @@ void decrement_guests_in_park() } else { - log_error("Attempt to decrement guests in park below zero."); + LOG_ERROR("Attempt to decrement guests in park below zero."); } } @@ -2677,7 +2677,7 @@ void decrement_guests_heading_for_park() } else { - log_error("Attempt to decrement guests heading for park below zero."); + LOG_ERROR("Attempt to decrement guests heading for park below zero."); } } diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 121939f1b6..838884823e 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -2005,7 +2005,7 @@ void Staff::UpdateFixing(int32_t steps) break; default: - log_error("Invalid substate"); + LOG_ERROR("Invalid substate"); progressToNextSubstate = false; } @@ -2213,7 +2213,7 @@ bool Staff::UpdateFixingMoveToStationEnd(bool firstRun, const Ride& ride) auto tileElement = MapGetTrackElementAt(stationPos); if (tileElement == nullptr) { - log_error("Couldn't find tile_element"); + LOG_ERROR("Couldn't find tile_element"); return false; } diff --git a/src/openrct2/interface/Fonts.cpp b/src/openrct2/interface/Fonts.cpp index 3a1add3207..7997494ccf 100644 --- a/src/openrct2/interface/Fonts.cpp +++ b/src/openrct2/interface/Fonts.cpp @@ -159,7 +159,7 @@ void TryLoadFonts(LocalisationService& localisationService) { return; } - log_verbose("Unable to initialise configured TrueType font -- falling back to the language's default."); + LOG_VERBOSE("Unable to initialise configured TrueType font -- falling back to the language's default."); } for (auto& font : *fontFamily) @@ -170,12 +170,12 @@ void TryLoadFonts(LocalisationService& localisationService) } TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; - log_verbose("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); + LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } if (fontFamily != &TTFFamilySansSerif) { - log_verbose("Unable to initialise any of the preferred TrueType fonts -- falling back to sans serif fonts."); + LOG_VERBOSE("Unable to initialise any of the preferred TrueType fonts -- falling back to sans serif fonts."); for (auto& font : TTFFamilySansSerif) { @@ -185,10 +185,10 @@ void TryLoadFonts(LocalisationService& localisationService) } TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; - log_verbose("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); + LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } - log_verbose("Unable to initialise any of the preferred TrueType fonts -- falling back to sprite font."); + LOG_VERBOSE("Unable to initialise any of the preferred TrueType fonts -- falling back to sprite font."); } } #endif // NO_TTF diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 8a9daf6a4e..52b4a097b3 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1380,7 +1380,7 @@ static int32_t ConsoleCommandOpen(InteractiveConsole& console, const arguments_t static int32_t ConsoleCommandRemoveUnusedObjects(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv) { - int32_t result = editor_remove_unused_objects(); + int32_t result = EditorRemoveUnusedObjects(); console.WriteFormatLine("%d unused object entries have been removed.", result); return 0; } @@ -1530,11 +1530,11 @@ static int32_t ConsoleCommandSavePark([[maybe_unused]] InteractiveConsole& conso { if (argv.size() < 1) { - save_game_cmd(); + SaveGameCmd(); } else { - save_game_cmd(argv[0].c_str()); + SaveGameCmd(argv[0].c_str()); } return 1; } diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 495086f39b..26b5911edf 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -69,7 +69,7 @@ static bool WriteDpiToFile(std::string_view path, const rct_drawpixelinfo* dpi, } catch (const std::exception& e) { - log_error("Unable to write png: %s", e.what()); + LOG_ERROR("Unable to write png: %s", e.what()); return false; } } @@ -136,7 +136,7 @@ static std::optional ScreenshotGetNextPath() auto screenshotDirectory = ScreenshotGetDirectory(); if (!Platform::EnsureDirectoryExists(screenshotDirectory.c_str())) { - log_error("Unable to save screenshots in OpenRCT2 screenshot directory."); + LOG_ERROR("Unable to save screenshots in OpenRCT2 screenshot directory."); return std::nullopt; } @@ -160,7 +160,7 @@ static std::optional ScreenshotGetNextPath() } } - log_error("You have too many saved screenshots saved at exactly the same date and time."); + LOG_ERROR("You have too many saved screenshots saved at exactly the same date and time."); return std::nullopt; }; @@ -207,7 +207,7 @@ std::string ScreenshotDumpPNG32bpp(int32_t width, int32_t height, const void* pi } catch (const std::exception& e) { - log_error("Unable to save screenshot: %s", e.what()); + LOG_ERROR("Unable to save screenshot: %s", e.what()); return ""; } } @@ -327,7 +327,7 @@ static rct_viewport GetGiantViewport(int32_t rotation, ZoomLevel zoom) static void RenderViewport(IDrawingEngine* drawingEngine, const rct_viewport& viewport, rct_drawpixelinfo& dpi) { // Ensure sprites appear regardless of rotation - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); std::unique_ptr tempDrawingEngine; if (drawingEngine == nullptr) @@ -383,7 +383,7 @@ void ScreenshotGiant() } catch (const std::exception& e) { - log_error("%s", e.what()); + LOG_ERROR("%s", e.what()); ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {}); } diff --git a/src/openrct2/interface/StdInOutConsole.cpp b/src/openrct2/interface/StdInOutConsole.cpp index 3e456db89a..23b84349eb 100644 --- a/src/openrct2/interface/StdInOutConsole.cpp +++ b/src/openrct2/interface/StdInOutConsole.cpp @@ -47,7 +47,7 @@ void StdInOutConsole::Start() { if (lastPromptQuit) { - openrct2_finish(); + OpenRCT2Finish(); break; } @@ -105,7 +105,7 @@ void StdInOutConsole::Clear() void StdInOutConsole::Close() { - openrct2_finish(); + OpenRCT2Finish(); } void StdInOutConsole::WriteLine(const std::string& s, FormatToken colourFormat) diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index ee1788d990..97cc922ab8 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -94,11 +94,11 @@ void ViewportInitAll() WindowInitAll(); // ? - input_reset_flags(); - input_set_state(InputState::Reset); + InputResetFlags(); + InputSetState(InputState::Reset); gPressedWidget.window_classification = WindowClass::Null; gPickupPeepImage = ImageId(); - reset_tooltip_not_shown(); + ResetTooltipNotShown(); gMapSelectFlags = 0; ClearPatrolAreaToRender(); TextinputCancel(); @@ -146,7 +146,7 @@ CoordsXYZ Focus::GetPos() const } else { - log_error("Invalid entity for focus."); + LOG_ERROR("Invalid entity for focus."); return CoordsXYZ{}; } } @@ -176,7 +176,7 @@ void ViewportCreate(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t w rct_viewport* viewport = nullptr; if (_viewports.size() >= MAX_VIEWPORT_COUNT) { - log_error("No more viewport slots left to allocate."); + LOG_ERROR("No more viewport slots left to allocate."); return; } @@ -211,7 +211,7 @@ void ViewportCreate(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t w auto centreLoc = centre_2d_coordinates(centrePos, viewport); if (!centreLoc.has_value()) { - log_error("Invalid location for viewport."); + LOG_ERROR("Invalid location for viewport."); return; } w->savedViewPos = *centreLoc; @@ -223,7 +223,7 @@ void ViewportRemove(rct_viewport* viewport) auto it = std::find_if(_viewports.begin(), _viewports.end(), [viewport](const auto& vp) { return &vp == viewport; }); if (it == _viewports.end()) { - log_error("Unable to remove viewport: %p", viewport); + LOG_ERROR("Unable to remove viewport: %p", viewport); return; } _viewports.erase(it); @@ -2131,7 +2131,7 @@ uint8_t GetCurrentRotation() #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (rotation != rotation_masked) { - log_error( + LOG_ERROR( "Found wrong rotation %d! Will return %d instead.", static_cast(rotation), static_cast(rotation_masked)); } diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index ce99465438..585471f871 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -962,7 +962,7 @@ void WindowRotateCamera(rct_window& w, int32_t direction) w.Invalidate(); call_event_viewport_rotate_on_all_windows(); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); } void WindowViewportGetMapCoordsByCursor( @@ -984,7 +984,7 @@ void WindowViewportGetMapCoordsByCursor( auto centreLoc = centre_2d_coordinates({ mapCoords.x, mapCoords.y, z }, w.viewport); if (!centreLoc) { - log_error("Invalid location."); + LOG_ERROR("Invalid location."); return; } @@ -1005,7 +1005,7 @@ void WindowViewportCentreTileAroundCursor(rct_window& w, int32_t map_x, int32_t if (!centreLoc.has_value()) { - log_error("Invalid location."); + LOG_ERROR("Invalid location."); return; } @@ -1362,7 +1362,7 @@ void WindowSetResize(rct_window& w, int32_t minWidth, int32_t minHeight, int32_t */ bool ToolSet(const rct_window& w, WidgetIndex widgetIndex, Tool tool) { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { if (w.classification == gCurrentToolWidget.window_classification && w.number == gCurrentToolWidget.window_number && widgetIndex == gCurrentToolWidget.widget_index) @@ -1374,9 +1374,9 @@ bool ToolSet(const rct_window& w, WidgetIndex widgetIndex, Tool tool) ToolCancel(); } - input_set_flag(INPUT_FLAG_TOOL_ACTIVE, true); - input_set_flag(INPUT_FLAG_4, false); - input_set_flag(INPUT_FLAG_6, false); + InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, true); + InputSetFlag(INPUT_FLAG_4, false); + InputSetFlag(INPUT_FLAG_6, false); gCurrentToolId = tool; gCurrentToolWidget.window_classification = w.classification; gCurrentToolWidget.window_number = w.number; @@ -1390,9 +1390,9 @@ bool ToolSet(const rct_window& w, WidgetIndex widgetIndex, Tool tool) */ void ToolCancel() { - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) { - input_set_flag(INPUT_FLAG_TOOL_ACTIVE, false); + InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, false); MapInvalidateSelectionRect(); MapInvalidateMapSelectionTiles(); diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index 731c0be28b..7f46cb93da 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -87,7 +87,7 @@ public: } catch (const std::exception& ex) { - log_error("Unable to open %s: %s", path, ex.what()); + LOG_ERROR("Unable to open %s: %s", path, ex.what()); return nullptr; } @@ -392,7 +392,7 @@ private: { if (_objectOverrides.size() == MAX_OBJECT_OVERRIDES) { - log_warning("Maximum number of localised object strings exceeded."); + LOG_WARNING("Maximum number of localised object strings exceeded."); } _objectOverrides.emplace_back(); @@ -436,7 +436,7 @@ private: { if (_scenarioOverrides.size() == MAX_SCENARIO_OVERRIDES) { - log_warning("Maximum number of scenario strings exceeded."); + LOG_WARNING("Maximum number of scenario strings exceeded."); } _scenarioOverrides.emplace_back(); diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index 3e58f07f23..e5f976852f 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -383,7 +383,7 @@ void FormatStringToUpper(utf8* dest, size_t size, StringId format, const void* a { upperString.resize(size - 1); dest[size - 1] = '\0'; - log_warning("Truncating formatted string \"%s\" to %d bytes.", dest, size); + LOG_WARNING("Truncating formatted string \"%s\" to %d bytes.", dest, size); } upperString.copy(dest, upperString.size()); diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index eddcd9b7ec..8db9450338 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -44,7 +44,7 @@ bool News::IsValidIndex(int32_t index) { if (index >= News::MaxItems) { - log_error("Tried to get news item past MAX_NEWS."); + LOG_ERROR("Tried to get news item past MAX_NEWS."); return false; } return true; diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index e648384f25..4d5e5ab020 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -207,7 +207,7 @@ void research_finish_item(ResearchItem* researchItem) { if (!RideTypeIsValid(base_ride_type)) { - log_warning("Invalid ride type: %d", base_ride_type); + LOG_WARNING("Invalid ride type: %d", base_ride_type); base_ride_type = rideEntry->GetFirstNonNullRideType(); } @@ -568,7 +568,7 @@ void ride_type_set_invented(uint32_t rideType) void ride_entry_set_invented(ObjectEntryIndex rideEntryIndex) { if (rideEntryIndex >= std::size(_researchedRideEntries)) - log_error("Tried setting ride entry %u as invented", rideEntryIndex); + LOG_ERROR("Tried setting ride entry %u as invented", rideEntryIndex); else _researchedRideEntries[rideEntryIndex] = true; } @@ -580,7 +580,7 @@ bool scenery_is_invented(const ScenerySelection& sceneryItem) return _researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex]; } - log_warning("Invalid Scenery Type"); + LOG_WARNING("Invalid Scenery Type"); return false; } @@ -592,7 +592,7 @@ void scenery_set_invented(const ScenerySelection& sceneryItem) } else { - log_warning("Invalid Scenery Type"); + LOG_WARNING("Invalid Scenery Type"); } } @@ -604,7 +604,7 @@ void scenery_set_not_invented(const ScenerySelection& sceneryItem) } else { - log_warning("Invalid Scenery Type"); + LOG_WARNING("Invalid Scenery Type"); } } @@ -960,7 +960,7 @@ static void research_update_first_of_type(ResearchItem* researchItem) auto rideType = researchItem->baseRideType; if (rideType >= RIDE_TYPE_COUNT) { - log_error("Research item has non-existent ride type index %d", rideType); + LOG_ERROR("Research item has non-existent ride type index %d", rideType); return; } diff --git a/src/openrct2/network/DiscordService.cpp b/src/openrct2/network/DiscordService.cpp index af6f353b10..572c051f94 100644 --- a/src/openrct2/network/DiscordService.cpp +++ b/src/openrct2/network/DiscordService.cpp @@ -34,7 +34,7 @@ namespace static void OnReady([[maybe_unused]] const DiscordUser* request) { - log_verbose("DiscordService::OnReady()"); + LOG_VERBOSE("DiscordService::OnReady()"); } static void OnDisconnected(int errorCode, const char* message) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 912ab2847a..923856067f 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -260,7 +260,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port) mode = NETWORK_MODE_CLIENT; - log_info("Connecting to %s:%u", host.c_str(), port); + LOG_INFO("Connecting to %s:%u", host.c_str(), port); _host = host; _port = port; @@ -293,7 +293,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port) const auto keysDirectory = network_get_keys_directory(); if (!Platform::EnsureDirectoryExists(keysDirectory.c_str())) { - log_error("Unable to create directory %s.", keysDirectory.c_str()); + LOG_ERROR("Unable to create directory %s.", keysDirectory.c_str()); return false; } @@ -304,7 +304,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port) } catch (const std::exception&) { - log_error("Unable to save private key at %s.", keyPath.c_str()); + LOG_ERROR("Unable to save private key at %s.", keyPath.c_str()); return false; } @@ -320,7 +320,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port) } catch (const std::exception&) { - log_error("Unable to save public key at %s.", keyPath.c_str()); + LOG_ERROR("Unable to save public key at %s.", keyPath.c_str()); return false; } } @@ -330,13 +330,13 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port) bool ok = false; try { - log_verbose("Loading key from %s", keyPath.c_str()); + LOG_VERBOSE("Loading key from %s", keyPath.c_str()); auto fs = FileStream(keyPath, FILE_MODE_OPEN); ok = _key.LoadPrivate(&fs); } catch (const std::exception&) { - log_error("Unable to read private key from %s.", keyPath.c_str()); + LOG_ERROR("Unable to read private key from %s.", keyPath.c_str()); return false; } @@ -358,7 +358,7 @@ bool NetworkBase::BeginServer(uint16_t port, const std::string& address) _userManager.Load(); - log_verbose("Begin listening for clients"); + LOG_VERBOSE("Begin listening for clients"); _listenSocket = CreateTcpSocket(); try @@ -410,8 +410,8 @@ bool NetworkBase::BeginServer(uint16_t port, const std::string& address) _serverState.gamestateSnapshotsEnabled = gConfigNetwork.DesyncDebugging; _advertiser = CreateServerAdvertiser(listening_port); - game_load_scripts(); - game_notify_map_changed(); + GameLoadScripts(); + GameNotifyMapChanged(); return true; } @@ -757,7 +757,7 @@ bool NetworkBase::CheckSRAND(uint32_t tick, uint32_t srand0) if (storedTick.srand0 != srand0) { - log_info("Srand0 mismatch, client = %08X, server = %08X", srand0, storedTick.srand0); + LOG_INFO("Srand0 mismatch, client = %08X, server = %08X", srand0, storedTick.srand0); return false; } @@ -767,7 +767,7 @@ bool NetworkBase::CheckSRAND(uint32_t tick, uint32_t srand0) std::string clientSpriteHash = checksum.ToString(); if (clientSpriteHash != storedTick.spriteHash) { - log_info("Sprite hash mismatch, client = %s, server = %s", clientSpriteHash.c_str(), storedTick.spriteHash.c_str()); + LOG_INFO("Sprite hash mismatch, client = %s, server = %s", clientSpriteHash.c_str(), storedTick.spriteHash.c_str()); return false; } } @@ -809,7 +809,7 @@ bool NetworkBase::CheckDesynchronizaton() void NetworkBase::RequestStateSnapshot() { - log_info("Requesting game state for tick %u", _serverState.desyncTick); + LOG_INFO("Requesting game state for tick %u", _serverState.desyncTick); Client_Send_RequestGameState(_serverState.desyncTick); } @@ -932,7 +932,7 @@ uint8_t NetworkBase::GetGroupIDByHash(const std::string& keyhash) } else { - log_warning( + LOG_WARNING( "User %s is assigned to non-existent group %u. Assigning to default group (%u)", keyhash.c_str(), assignedGroup, groupId); } @@ -975,7 +975,7 @@ void NetworkBase::SaveGroups() } catch (const std::exception& ex) { - log_error("Unable to save %s: %s", path.c_str(), ex.what()); + LOG_ERROR("Unable to save %s: %s", path.c_str(), ex.what()); } } } @@ -1029,7 +1029,7 @@ void NetworkBase::LoadGroups() } catch (const std::exception& e) { - log_error("Failed to read %s as JSON. Setting default groups. %s", path.c_str(), e.what()); + LOG_ERROR("Failed to read %s as JSON. Setting default groups. %s", path.c_str(), e.what()); } } @@ -1078,7 +1078,7 @@ void NetworkBase::AppendLog(std::ostream& fs, std::string_view s) { if (fs.fail()) { - log_error("bad ostream failed to append log"); + LOG_ERROR("bad ostream failed to append log"); return; } try @@ -1097,7 +1097,7 @@ void NetworkBase::AppendLog(std::ostream& fs, std::string_view s) } catch (const std::exception& ex) { - log_error("%s", ex.what()); + LOG_ERROR("%s", ex.what()); } } @@ -1180,11 +1180,11 @@ void NetworkBase::Client_Send_RequestGameState(uint32_t tick) { if (_serverState.gamestateSnapshotsEnabled == false) { - log_verbose("Server does not store a gamestate history"); + LOG_VERBOSE("Server does not store a gamestate history"); return; } - log_verbose("Requesting gamestate from server for tick %u", tick); + LOG_VERBOSE("Requesting gamestate from server for tick %u", tick); NetworkPacket packet(NetworkCommand::RequestGameState); packet << tick; @@ -1193,7 +1193,7 @@ void NetworkBase::Client_Send_RequestGameState(uint32_t tick) void NetworkBase::Client_Send_TOKEN() { - log_verbose("requesting token"); + LOG_VERBOSE("requesting token"); NetworkPacket packet(NetworkCommand::Token); _serverConnection->AuthStatus = NetworkAuth::Requested; _serverConnection->QueuePacket(std::move(packet)); @@ -1216,13 +1216,13 @@ void NetworkBase::Client_Send_AUTH( void NetworkBase::Client_Send_MAPREQUEST(const std::vector& objects) { - log_verbose("client requests %u objects", uint32_t(objects.size())); + LOG_VERBOSE("client requests %u objects", uint32_t(objects.size())); NetworkPacket packet(NetworkCommand::MapRequest); packet << static_cast(objects.size()); for (const auto& object : objects) { std::string name(object.GetName()); - log_verbose("client requests object %s", name.c_str()); + LOG_VERBOSE("client requests object %s", name.c_str()); if (object.Generation == ObjectGeneration::DAT) { packet << static_cast(0); @@ -1248,7 +1248,7 @@ void NetworkBase::Server_Send_TOKEN(NetworkConnection& connection) void NetworkBase::Server_Send_OBJECTS_LIST( NetworkConnection& connection, const std::vector& objects) const { - log_verbose("Server sends objects list with %u items", objects.size()); + LOG_VERBOSE("Server sends objects list with %u items", objects.size()); if (objects.empty()) { @@ -1269,14 +1269,14 @@ void NetworkBase::Server_Send_OBJECTS_LIST( if (object->Identifier.empty()) { // DAT - log_verbose("Object %.8s (checksum %x)", object->ObjectEntry.name, object->ObjectEntry.checksum); + LOG_VERBOSE("Object %.8s (checksum %x)", object->ObjectEntry.name, object->ObjectEntry.checksum); packet << static_cast(0); packet.Write(&object->ObjectEntry, sizeof(rct_object_entry)); } else { // JSON - log_verbose("Object %s", object->Identifier.c_str()); + LOG_VERBOSE("Object %s", object->Identifier.c_str()); packet << static_cast(1); packet.WriteString(object->Identifier); } @@ -1305,12 +1305,12 @@ void NetworkBase::Server_Send_SCRIPTS(NetworkConnection& connection) } } - log_verbose("Server sends %u scripts", pluginsToSend.size()); + LOG_VERBOSE("Server sends %u scripts", pluginsToSend.size()); packet << static_cast(pluginsToSend.size()); for (const auto& plugin : pluginsToSend) { const auto& metadata = plugin->GetMetadata(); - log_verbose("Script %s", metadata.Name.c_str()); + LOG_VERBOSE("Script %s", metadata.Name.c_str()); const auto& code = plugin->GetCode(); packet << static_cast(code.size()); @@ -1324,7 +1324,7 @@ void NetworkBase::Server_Send_SCRIPTS(NetworkConnection& connection) void NetworkBase::Client_Send_HEARTBEAT(NetworkConnection& connection) const { - log_verbose("Sending heartbeat"); + LOG_VERBOSE("Sending heartbeat"); NetworkPacket packet(NetworkCommand::Heartbeat); connection.QueuePacket(std::move(packet)); @@ -1426,7 +1426,7 @@ std::vector NetworkBase::save_for_network(const std::vectorGetHostName()); + LOG_VERBOSE("Client %s heartbeat", connection.Socket->GetHostName()); connection.ResetLastPacketTime(); } @@ -2340,13 +2340,13 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw if (object == nullptr) { auto objectName = std::string(entry->GetName()); - log_verbose("Requesting object %s with checksum %x from server", objectName.c_str(), entry->checksum); + LOG_VERBOSE("Requesting object %s with checksum %x from server", objectName.c_str(), entry->checksum); _missingObjects.push_back(ObjectEntryDescriptor(*entry)); } else if (object->ObjectEntry.checksum != entry->checksum || object->ObjectEntry.flags != entry->flags) { auto objectName = std::string(entry->GetName()); - log_warning( + LOG_WARNING( "Object %s has different checksum/flags (%x/%x) than server (%x/%x).", objectName.c_str(), object->ObjectEntry.checksum, object->ObjectEntry.flags, entry->checksum, entry->flags); } @@ -2362,7 +2362,7 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw if (object == nullptr) { auto objectName = std::string(identifier); - log_verbose("Requesting object %s from server", objectName.c_str()); + LOG_VERBOSE("Requesting object %s from server", objectName.c_str()); _missingObjects.push_back(ObjectEntryDescriptor(objectName)); } } @@ -2371,7 +2371,7 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw if (index + 1 >= totalObjects) { - log_verbose("client received object list, it has %u entries", totalObjects); + LOG_VERBOSE("client received object list, it has %u entries", totalObjects); Client_Send_MAPREQUEST(_missingObjects); _missingObjects.clear(); } @@ -2420,7 +2420,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network const uint8_t* data = packet.Read(dataSize); _serverGameState.Write(data, dataSize); - log_verbose( + LOG_VERBOSE( "Received Game State %.02f%%", (static_cast(_serverGameState.GetLength()) / static_cast(totalSize)) * 100.0f); @@ -2452,7 +2452,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network if (snapshots->LogCompareDataToFile(outputFile, cmpData)) { - log_info("Wrote desync report to '%s'", outputFile.c_str()); + LOG_INFO("Wrote desync report to '%s'", outputFile.c_str()); auto ft = Formatter(); ft.Add(uniqueFileName); @@ -2472,7 +2472,7 @@ void NetworkBase::Server_Handle_MAPREQUEST(NetworkConnection& connection, Networ { uint32_t size; packet >> size; - log_verbose("Client requested %u objects", size); + LOG_VERBOSE("Client requested %u objects", size); auto& repo = GetContext().GetObjectRepository(); for (uint32_t i = 0; i < size; i++) { @@ -2485,19 +2485,19 @@ void NetworkBase::Server_Handle_MAPREQUEST(NetworkConnection& connection, Networ { const auto* entry = reinterpret_cast(packet.Read(sizeof(rct_object_entry))); objectName = std::string(entry->GetName()); - log_verbose("Client requested object %s", objectName.c_str()); + LOG_VERBOSE("Client requested object %s", objectName.c_str()); item = repo.FindObject(entry); } else { objectName = std::string(packet.ReadString()); - log_verbose("Client requested object %s", objectName.c_str()); + LOG_VERBOSE("Client requested object %s", objectName.c_str()); item = repo.FindObject(objectName); } if (item == nullptr) { - log_warning("Client tried getting non-existent object %s from us.", objectName.c_str()); + LOG_WARNING("Client tried getting non-existent object %s from us.", objectName.c_str()); } else { @@ -2560,10 +2560,10 @@ void NetworkBase::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacke const std::string hash = connection.Key.PublicKeyHash(); if (verified) { - log_verbose("Connection %s: Signature verification ok. Hash %s", hostName, hash.c_str()); + LOG_VERBOSE("Connection %s: Signature verification ok. Hash %s", hostName, hash.c_str()); if (gConfigNetwork.KnownKeysOnly && _userManager.GetUserByHash(hash) == nullptr) { - log_verbose("Connection %s: Hash %s, not known", hostName, hash.c_str()); + LOG_VERBOSE("Connection %s: Hash %s, not known", hostName, hash.c_str()); connection.AuthStatus = NetworkAuth::UnknownKeyDisallowed; } else @@ -2574,13 +2574,13 @@ void NetworkBase::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacke else { connection.AuthStatus = NetworkAuth::VerificationFailure; - log_verbose("Connection %s: Signature verification failed!", hostName); + LOG_VERBOSE("Connection %s: Signature verification failed!", hostName); } } catch (const std::exception&) { connection.AuthStatus = NetworkAuth::VerificationFailure; - log_verbose("Connection %s: Signature verification failed, invalid data!", hostName); + LOG_VERBOSE("Connection %s: Signature verification failed, invalid data!", hostName); } } @@ -2593,31 +2593,31 @@ void NetworkBase::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacke if (gameversion != network_get_version()) { connection.AuthStatus = NetworkAuth::BadVersion; - log_info("Connection %s: Bad version.", hostName); + LOG_INFO("Connection %s: Bad version.", hostName); } else if (name.empty()) { connection.AuthStatus = NetworkAuth::BadName; - log_info("Connection %s: Bad name.", connection.Socket->GetHostName()); + LOG_INFO("Connection %s: Bad name.", connection.Socket->GetHostName()); } else if (!passwordless) { if (password.empty() && !_password.empty()) { connection.AuthStatus = NetworkAuth::RequirePassword; - log_info("Connection %s: Requires password.", hostName); + LOG_INFO("Connection %s: Requires password.", hostName); } else if (!password.empty() && _password != password) { connection.AuthStatus = NetworkAuth::BadPassword; - log_info("Connection %s: Bad password.", hostName); + LOG_INFO("Connection %s: Bad password.", hostName); } } if (GetNumVisiblePlayers() >= gConfigNetwork.Maxplayers) { connection.AuthStatus = NetworkAuth::Full; - log_info("Connection %s: Server is full.", hostName); + LOG_INFO("Connection %s: Server is full.", hostName); } else if (connection.AuthStatus == NetworkAuth::Verified) { @@ -2630,7 +2630,7 @@ void NetworkBase::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacke else { connection.AuthStatus = NetworkAuth::VerificationFailure; - log_info("Connection %s: Denied by plugin.", hostName); + LOG_INFO("Connection %s: Denied by plugin.", hostName); } } @@ -2680,8 +2680,8 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti GameActions::ResumeQueue(); ContextForceCloseWindowByClass(WindowClass::NetworkStatus); - game_unload_scripts(); - game_notify_map_change(); + GameUnloadScripts(); + GameNotifyMapChange(); bool has_to_free = false; uint8_t* data = &chunk_buffer[0]; @@ -2689,9 +2689,9 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti auto ms = MemoryStream(data, data_size); if (LoadMap(&ms)) { - game_load_init(); - game_load_scripts(); - game_notify_map_changed(); + GameLoadInit(); + GameLoadScripts(); + GameNotifyMapChanged(); _serverState.tick = gCurrentTicks; // window_network_status_open("Loaded new map from network"); _serverState.state = NetworkServerState::Ok; @@ -2856,7 +2856,7 @@ void NetworkBase::Client_Handle_GAME_ACTION([[maybe_unused]] NetworkConnection& GameAction::Ptr action = GameActions::Create(actionType); if (action == nullptr) { - log_error("Received unregistered game action type: 0x%08X", actionType); + LOG_ERROR("Received unregistered game action type: 0x%08X", actionType); return; } action->Serialise(ds); @@ -2910,7 +2910,7 @@ void NetworkBase::Server_Handle_GAME_ACTION(NetworkConnection& connection, Netwo GameAction::Ptr ga = GameActions::Create(actionType); if (ga == nullptr) { - log_error( + LOG_ERROR( "Received unregistered game action type: 0x%08X from player: (%d) %s", actionType, connection.Player->Id, connection.Player->Name.c_str()); return; @@ -3114,7 +3114,7 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec void NetworkBase::Client_Send_GAMEINFO() { - log_verbose("requesting gameinfo"); + LOG_VERBOSE("requesting gameinfo"); NetworkPacket packet(NetworkCommand::GameInfo); _serverConnection->QueuePacket(std::move(packet)); } @@ -3621,7 +3621,7 @@ GameActions::Result network_modify_groups( } break; default: - log_error("Invalid Modify Group Type: %u", static_cast(type)); + LOG_ERROR("Invalid Modify Group Type: %u", static_cast(type)); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } @@ -3828,7 +3828,7 @@ void network_send_password(const std::string& password) const auto keyPath = network_get_private_key_path(gConfigNetwork.PlayerName); if (!File::Exists(keyPath)) { - log_error("Private key %s missing! Restart the game to generate it.", keyPath.c_str()); + LOG_ERROR("Private key %s missing! Restart the game to generate it.", keyPath.c_str()); return; } try @@ -3838,7 +3838,7 @@ void network_send_password(const std::string& password) } catch (const std::exception&) { - log_error("Error reading private key from %s.", keyPath.c_str()); + LOG_ERROR("Error reading private key from %s.", keyPath.c_str()); return; } const std::string pubkey = network._key.PublicKeyString(); diff --git a/src/openrct2/network/NetworkKey.cpp b/src/openrct2/network/NetworkKey.cpp index 8de91f1e28..5714eb21da 100644 --- a/src/openrct2/network/NetworkKey.cpp +++ b/src/openrct2/network/NetworkKey.cpp @@ -35,7 +35,7 @@ bool NetworkKey::Generate() } catch (const std::exception& e) { - log_error("NetworkKey::Generate failed: %s", e.what()); + LOG_ERROR("NetworkKey::Generate failed: %s", e.what()); return false; } } @@ -47,12 +47,12 @@ bool NetworkKey::LoadPrivate(OpenRCT2::IStream* stream) size_t size = static_cast(stream->GetLength()); if (size == static_cast(-1)) { - log_error("unknown size, refusing to load key"); + LOG_ERROR("unknown size, refusing to load key"); return false; } if (size > 4 * 1024 * 1024) { - log_error("Key file suspiciously large, refusing to load it"); + LOG_ERROR("Key file suspiciously large, refusing to load it"); return false; } @@ -67,7 +67,7 @@ bool NetworkKey::LoadPrivate(OpenRCT2::IStream* stream) } catch (const std::exception& e) { - log_error("NetworkKey::LoadPrivate failed: %s", e.what()); + LOG_ERROR("NetworkKey::LoadPrivate failed: %s", e.what()); return false; } } @@ -79,12 +79,12 @@ bool NetworkKey::LoadPublic(OpenRCT2::IStream* stream) size_t size = static_cast(stream->GetLength()); if (size == static_cast(-1)) { - log_error("unknown size, refusing to load key"); + LOG_ERROR("unknown size, refusing to load key"); return false; } if (size > 4 * 1024 * 1024) { - log_error("Key file suspiciously large, refusing to load it"); + LOG_ERROR("Key file suspiciously large, refusing to load it"); return false; } @@ -99,7 +99,7 @@ bool NetworkKey::LoadPublic(OpenRCT2::IStream* stream) } catch (const std::exception& e) { - log_error("NetworkKey::LoadPublic failed: %s", e.what()); + LOG_ERROR("NetworkKey::LoadPublic failed: %s", e.what()); return false; } } @@ -118,7 +118,7 @@ bool NetworkKey::SavePrivate(OpenRCT2::IStream* stream) } catch (const std::exception& e) { - log_error("NetworkKey::SavePrivate failed: %s", e.what()); + LOG_ERROR("NetworkKey::SavePrivate failed: %s", e.what()); return false; } } @@ -137,7 +137,7 @@ bool NetworkKey::SavePublic(OpenRCT2::IStream* stream) } catch (const std::exception& e) { - log_error("NetworkKey::SavePublic failed: %s", e.what()); + LOG_ERROR("NetworkKey::SavePublic failed: %s", e.what()); return false; } } @@ -185,7 +185,7 @@ std::string NetworkKey::PublicKeyHash() } catch (const std::exception& e) { - log_error("Failed to create hash of public key: %s", e.what()); + LOG_ERROR("Failed to create hash of public key: %s", e.what()); } return nullptr; } @@ -200,7 +200,7 @@ bool NetworkKey::Sign(const uint8_t* md, const size_t len, std::vector& } catch (const std::exception& e) { - log_error("NetworkKey::Sign failed: %s", e.what()); + LOG_ERROR("NetworkKey::Sign failed: %s", e.what()); return false; } } @@ -214,7 +214,7 @@ bool NetworkKey::Verify(const uint8_t* md, const size_t len, const std::vectorGetHostname(); - log_verbose("Received %zu bytes from %s on LAN broadcast port", recievedBytes, sender.c_str()); + LOG_VERBOSE("Received %zu bytes from %s on LAN broadcast port", recievedBytes, sender.c_str()); if (String::Equals(buffer, NETWORK_LAN_BROADCAST_MSG)) { auto body = GetBroadcastJson(); auto bodyDump = body.dump(); size_t sendLen = bodyDump.size() + 1; - log_verbose("Sending %zu bytes back to %s", sendLen, sender.c_str()); + LOG_VERBOSE("Sending %zu bytes back to %s", sendLen, sender.c_str()); _lanListener->SendData(*endpoint, bodyDump.c_str(), sendLen); } } @@ -263,7 +263,7 @@ private: { _forceIPv4 = true; _lastAdvertiseTime = 0; - log_info("Forcing HTTP(S) over IPv4"); + LOG_INFO("Forcing HTTP(S) over IPv4"); } } } diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index f94ce4b036..284a465596 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -92,7 +92,7 @@ std::optional ServerListEntry::FromJson(json_t& server) if (name.empty() || version.empty()) { - log_verbose("Cowardly refusing to add server without name or version specified."); + LOG_VERBOSE("Cowardly refusing to add server without name or version specified."); return std::nullopt; } @@ -184,7 +184,7 @@ void ServerList::Clear() noexcept std::vector ServerList::ReadFavourites() const { - log_verbose("server_list_read(...)"); + LOG_VERBOSE("server_list_read(...)"); std::vector entries; try { @@ -211,7 +211,7 @@ std::vector ServerList::ReadFavourites() const } catch (const std::exception& e) { - log_error("Unable to read server list: %s", e.what()); + LOG_ERROR("Unable to read server list: %s", e.what()); entries = std::vector(); } return entries; @@ -239,7 +239,7 @@ void ServerList::WriteFavourites() const bool ServerList::WriteFavourites(const std::vector& entries) const { - log_verbose("server_list_write(%d, 0x%p)", entries.size(), entries.data()); + LOG_VERBOSE("server_list_write(%d, 0x%p)", entries.size(), entries.data()); auto env = GetContext()->GetPlatformEnvironment(); auto path = Path::Combine(env->GetDirectoryPath(DIRBASE::USER), u8"servers.cfg"); @@ -258,7 +258,7 @@ bool ServerList::WriteFavourites(const std::vector& entries) co } catch (const std::exception& e) { - log_error("Unable to write server list: %s", e.what()); + LOG_ERROR("Unable to write server list: %s", e.what()); return false; } } @@ -273,7 +273,7 @@ std::future> ServerList::FetchLocalServerListAsync( std::string_view msg = NETWORK_LAN_BROADCAST_MSG; auto udpSocket = CreateUdpSocket(); - log_verbose("Broadcasting %zu bytes to the LAN (%s)", msg.size(), broadcastAddress.c_str()); + LOG_VERBOSE("Broadcasting %zu bytes to the LAN (%s)", msg.size(), broadcastAddress.c_str()); auto len = udpSocket->SendData(broadcastAddress, NETWORK_LAN_BROADCAST_PORT, msg.data(), msg.size()); if (len != msg.size()) { @@ -293,7 +293,7 @@ std::future> ServerList::FetchLocalServerListAsync( if (p == NetworkReadPacket::Success) { auto sender = endpoint->GetHostname(); - log_verbose("Received %zu bytes back from %s", recievedLen, sender.c_str()); + LOG_VERBOSE("Received %zu bytes back from %s", recievedLen, sender.c_str()); auto jinfo = Json::FromString(std::string_view(buffer)); if (jinfo.is_object()) @@ -311,7 +311,7 @@ std::future> ServerList::FetchLocalServerListAsync( } catch (const std::exception& e) { - log_warning("Error receiving data: %s", e.what()); + LOG_WARNING("Error receiving data: %s", e.what()); } Platform::Sleep(RECV_DELAY_MS); } diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 3f19cc19e6..0446594d25 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -87,11 +87,11 @@ public: { if (!_isInitialised) { - log_verbose("WSAStartup()"); + LOG_VERBOSE("WSAStartup()"); WSADATA wsa_data; if (WSAStartup(MAKEWORD(2, 2), &wsa_data) != 0) { - log_error("Unable to initialise winsock."); + LOG_ERROR("Unable to initialise winsock."); return false; } _isInitialised = true; @@ -103,7 +103,7 @@ public: { if (_isInitialised) { - log_verbose("WSACleanup()"); + LOG_VERBOSE("WSACleanup()"); WSACleanup(); _isInitialised = false; } @@ -225,8 +225,8 @@ private: int errorcode = getaddrinfo(address.empty() ? nullptr : address.c_str(), serviceName.c_str(), &hints, &result); if (errorcode != 0) { - log_error("Resolving address failed: Code %d.", errorcode); - log_error("Resolution error message: %s.", gai_strerror(errorcode)); + LOG_ERROR("Resolving address failed: Code %d.", errorcode); + LOG_ERROR("Resolution error message: %s.", gai_strerror(errorcode)); return false; } @@ -321,12 +321,12 @@ public: // Turn off IPV6_V6ONLY so we can accept both v4 and v6 connections if (!SetOption(_socket, IPPROTO_IPV6, IPV6_V6ONLY, false)) { - log_verbose("setsockopt(socket, IPV6_V6ONLY) failed: %d", LAST_SOCKET_ERROR()); + LOG_VERBOSE("setsockopt(socket, IPV6_V6ONLY) failed: %d", LAST_SOCKET_ERROR()); } if (!SetOption(_socket, SOL_SOCKET, SO_REUSEADDR, true)) { - log_verbose("setsockopt(socket, SO_REUSEADDR) failed: %d", LAST_SOCKET_ERROR()); + LOG_VERBOSE("setsockopt(socket, SO_REUSEADDR) failed: %d", LAST_SOCKET_ERROR()); } try @@ -374,7 +374,7 @@ public: { if (LAST_SOCKET_ERROR() != EWOULDBLOCK) { - log_error("Failed to accept client."); + LOG_ERROR("Failed to accept client."); } } else @@ -382,7 +382,7 @@ public: if (!SetNonBlocking(socket, true)) { closesocket(socket); - log_error("Failed to set non-blocking mode."); + LOG_ERROR("Failed to set non-blocking mode."); } else { @@ -826,18 +826,18 @@ private: // Enable send and receiving of broadcast messages if (!SetOption(sock, SOL_SOCKET, SO_BROADCAST, true)) { - log_verbose("setsockopt(socket, SO_BROADCAST) failed: %d", LAST_SOCKET_ERROR()); + LOG_VERBOSE("setsockopt(socket, SO_BROADCAST) failed: %d", LAST_SOCKET_ERROR()); } // Turn off IPV6_V6ONLY so we can accept both v4 and v6 connections if (!SetOption(sock, IPPROTO_IPV6, IPV6_V6ONLY, false)) { - log_verbose("setsockopt(socket, IPV6_V6ONLY) failed: %d", LAST_SOCKET_ERROR()); + LOG_VERBOSE("setsockopt(socket, IPV6_V6ONLY) failed: %d", LAST_SOCKET_ERROR()); } if (!SetOption(sock, SOL_SOCKET, SO_REUSEADDR, true)) { - log_verbose("setsockopt(socket, SO_REUSEADDR) failed: %d", LAST_SOCKET_ERROR()); + LOG_VERBOSE("setsockopt(socket, SO_REUSEADDR) failed: %d", LAST_SOCKET_ERROR()); } if (!SetNonBlocking(sock, true)) diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index ee75a45131..0daf4c878e 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -106,7 +106,7 @@ std::vector> ImageTable::ParseImages( else { std::string id(context->GetObjectIdentifier()); - log_warning("CSG not loaded inserting placeholder images for %s", id.c_str()); + LOG_WARNING("CSG not loaded inserting placeholder images for %s", id.c_str()); result.resize(range.size()); for (auto& res : result) { diff --git a/src/openrct2/object/Object.cpp b/src/openrct2/object/Object.cpp index 723b48fdcf..44ce3fe023 100644 --- a/src/openrct2/object/Object.cpp +++ b/src/openrct2/object/Object.cpp @@ -346,11 +346,11 @@ ObjectVersion VersionTuple(std::string_view version) uint16_t versions[VersionNumFields] = {}; if (nums.size() > VersionNumFields) { - log_warning("%i fields found in version string '%s', expected X.Y.Z", nums.size(), version); + LOG_WARNING("%i fields found in version string '%s', expected X.Y.Z", nums.size(), version); } if (nums.size() == 0) { - log_warning("No fields found in version string '%s', expected X.Y.Z", version); + LOG_WARNING("No fields found in version string '%s', expected X.Y.Z", version); return std::make_tuple(0, 0, 0); } try @@ -362,7 +362,7 @@ ObjectVersion VersionTuple(std::string_view version) constexpr auto maxValue = std::numeric_limits().max(); if (value > maxValue) { - log_warning( + LOG_WARNING( "Version value too high in version string '%s', version value will be capped to %i.", version, maxValue); value = maxValue; } @@ -371,7 +371,7 @@ ObjectVersion VersionTuple(std::string_view version) } catch (const std::exception&) { - log_warning("Malformed version string '%s', expected X.Y.Z", version); + LOG_WARNING("Malformed version string '%s', expected X.Y.Z", version); } return std::make_tuple(versions[0], versions[1], versions[2]); diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index b150a0ec6a..0968feddbc 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -184,7 +184,7 @@ public: if (!String::IsNullOrEmpty(text)) { - log_verbose("[%s] Info (%d): %s", _identifier.c_str(), code, text); + LOG_VERBOSE("[%s] Info (%d): %s", _identifier.c_str(), code, text); } } @@ -253,7 +253,7 @@ namespace ObjectFactory std::unique_ptr CreateObjectFromLegacyFile(IObjectRepository& objectRepository, const utf8* path, bool loadImages) { - log_verbose("CreateObjectFromLegacyFile(..., \"%s\")", path); + LOG_VERBOSE("CreateObjectFromLegacyFile(..., \"%s\")", path); std::unique_ptr result; try @@ -270,10 +270,10 @@ namespace ObjectFactory utf8 objectName[DAT_NAME_LENGTH + 1] = { 0 }; object_entry_get_name_fixed(objectName, sizeof(objectName), &entry); - log_verbose(" entry: { 0x%08X, \"%s\", 0x%08X }", entry.flags, objectName, entry.checksum); + LOG_VERBOSE(" entry: { 0x%08X, \"%s\", 0x%08X }", entry.flags, objectName, entry.checksum); auto chunk = chunkReader.ReadChunk(); - log_verbose(" size: %zu", chunk->GetLength()); + LOG_VERBOSE(" size: %zu", chunk->GetLength()); auto chunkStream = OpenRCT2::MemoryStream(chunk->GetData(), chunk->GetLength()); auto readContext = ReadObjectContext(objectRepository, objectName, loadImages, nullptr); @@ -287,7 +287,7 @@ namespace ObjectFactory } catch (const std::exception& e) { - log_error("Error: %s when processing object %s", e.what(), path); + LOG_ERROR("Error: %s when processing object %s", e.what(), path); } return result; } @@ -312,7 +312,7 @@ namespace ObjectFactory if (readContext.WasError()) { - log_error("Error when processing object."); + LOG_ERROR("Error when processing object."); } else { @@ -452,7 +452,7 @@ namespace ObjectFactory std::unique_ptr CreateObjectFromJsonFile( IObjectRepository& objectRepository, const std::string& path, bool loadImages) { - log_verbose("CreateObjectFromJsonFile(\"%s\")", path.c_str()); + LOG_VERBOSE("CreateObjectFromJsonFile(\"%s\")", path.c_str()); try { @@ -484,7 +484,7 @@ namespace ObjectFactory } else { - log_error("Object %s has an incorrect sourceGame parameter.", id.c_str()); + LOG_ERROR("Object %s has an incorrect sourceGame parameter.", id.c_str()); result.SetSourceGames({ ObjectSourceGame::Custom }); } } @@ -495,7 +495,7 @@ namespace ObjectFactory } else { - log_error("Object %s has an incorrect sourceGame parameter.", id.c_str()); + LOG_ERROR("Object %s has an incorrect sourceGame parameter.", id.c_str()); result.SetSourceGames({ ObjectSourceGame::Custom }); } } @@ -508,7 +508,7 @@ namespace ObjectFactory throw std::runtime_error("Object JSON root was not an object"); } - log_verbose("CreateObjectFromJson(...)"); + LOG_VERBOSE("CreateObjectFromJson(...)"); std::unique_ptr result; diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index ec6b5fc4e5..e6160936ef 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -83,7 +83,7 @@ public: #ifdef DEBUG if (index != OBJECT_ENTRY_INDEX_NULL) { - log_warning("Object index %u exceeds maximum for type %d.", index, objectType); + LOG_WARNING("Object index %u exceeds maximum for type %d.", index, objectType); } #endif return nullptr; @@ -456,7 +456,7 @@ private: } } - log_verbose("%u / %u objects unloaded", numObjectsUnloaded, totalObjectsLoaded); + LOG_VERBOSE("%u / %u objects unloaded", numObjectsUnloaded, totalObjectsLoaded); } template void UpdateSceneryGroupIndexes(ObjectType type) @@ -661,7 +661,7 @@ private: list[otl.Index] = otl.LoadedObject; } - log_verbose("%u / %u new objects loaded", newLoadedObjects.size(), requiredObjects.size()); + LOG_VERBOSE("%u / %u new objects loaded", newLoadedObjects.size(), requiredObjects.size()); } Object* GetOrLoadObject(const ObjectRepositoryItem* ori) diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index b4640c8b60..c23c1ff08e 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -306,7 +306,7 @@ public: } else { - log_verbose("Adding object: [%s]", objectName); + LOG_VERBOSE("Adding object: [%s]", objectName); auto path = GetPathForNewObject(ObjectGeneration::DAT, objectName); try { @@ -322,7 +322,7 @@ public: void AddObjectFromFile(ObjectGeneration generation, std::string_view objectName, const void* data, size_t dataSize) override { - log_verbose("Adding object: [%s]", std::string(objectName).c_str()); + LOG_VERBOSE("Adding object: [%s]", std::string(objectName).c_str()); auto path = GetPathForNewObject(generation, objectName); try { @@ -477,7 +477,7 @@ private: { char objectName[9]; object_entry_get_name_fixed(objectName, sizeof(objectName), entry); - log_verbose("[%s] Incorrect checksum, adding salt bytes...", objectName); + LOG_VERBOSE("[%s] Incorrect checksum, adding salt bytes...", objectName); // Calculate the value of extra bytes that can be appended to the data so that the // data is then valid for the object's checksum diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index f455a56a7a..6efebb46fe 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -43,13 +43,13 @@ void Painter::Paint(IDrawingEngine& de) auto dpi = de.GetDrawingPixelInfo(); if (gIntroState != IntroState::None) { - intro_draw(dpi); + IntroDraw(dpi); } else { de.PaintWindows(); - update_palette_effects(); + UpdatePaletteEffects(); _uiContext->Draw(dpi); if ((gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !title_should_hide_version_info()) diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 07a9058af2..8a989c8e51 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -137,7 +137,7 @@ void VirtualFloorInvalidate() if (_virtualFloorLastMinPos != min_position || _virtualFloorLastMaxPos != max_position || (_virtualFloorFlags & VIRTUAL_FLOOR_FORCE_INVALIDATION) != 0) { - log_verbose( + LOG_VERBOSE( "Invalidating previous region, Min: %d %d, Max: %d %d", _virtualFloorLastMinPos.x, _virtualFloorLastMinPos.y, _virtualFloorLastMaxPos.x, _virtualFloorLastMaxPos.y); MapInvalidateRegion(_virtualFloorLastMinPos, _virtualFloorLastMaxPos); @@ -155,7 +155,7 @@ void VirtualFloorInvalidate() return; } - log_verbose("Min: %d %d, Max: %d %d", min_position.x, min_position.y, max_position.x, max_position.y); + LOG_VERBOSE("Min: %d %d, Max: %d %d", min_position.x, min_position.y, max_position.x, max_position.y); // Invalidate new region if coordinates are set. if (min_position.x != std::numeric_limits::max() && min_position.y != std::numeric_limits::max() diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 27fdcf9324..6a9dded34c 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1302,7 +1302,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con const auto edgeStyle = tileElement.GetEdgeStyle(); if (static_cast(edgeStyle) >= object_entry_group_counts[EnumValue(ObjectType::TerrainEdge)]) { - log_verbose("edgeStyle: %d", edgeStyle); + LOG_VERBOSE("edgeStyle: %d", edgeStyle); } ViewportSurfaceDrawLandSideTop(session, EDGE_TOPLEFT, height, edgeStyle, tileDescriptors[0], tileDescriptors[3]); diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 36fe5aea74..698ec85cb5 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -2301,11 +2301,11 @@ int32_t scenario_save(u8string_view path, int32_t flags) { if (flags & S6_SAVE_FLAG_SCENARIO) { - log_verbose("saving scenario"); + LOG_VERBOSE("saving scenario"); } else { - log_verbose("saving game"); + LOG_VERBOSE("saving game"); } gIsAutosave = flags & S6_SAVE_FLAG_AUTOMATIC; @@ -2339,7 +2339,7 @@ int32_t scenario_save(u8string_view path, int32_t flags) } catch (const std::exception& e) { - log_error(e.what()); + LOG_ERROR(e.what()); Formatter ft; ft.Add(e.what()); @@ -2426,7 +2426,7 @@ public: { _parkFile->Import(); research_determine_first_of_type(); - game_fix_save_vars(); + GameFixSaveVars(); } bool GetDetails(scenario_index_entry* dst) override diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 84011a32b4..b73b2b46f4 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -714,7 +714,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Return from %d,%d,%d; At start", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Return from %d,%d,%d; At start", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 return; @@ -733,7 +733,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Return from %d,%d,%d; Left patrol area", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Return from %d,%d,%d; Left patrol area", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 return; @@ -879,7 +879,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Checking map element at %d,%d,%d; Type: %s", counter, loc.x >> 5, loc.y >> 5, loc.z, pathSearchToString(searchResult)); } @@ -921,7 +921,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Search path ends at %d,%d,%d; At goal; Score: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, new_score); } @@ -939,7 +939,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Search path ends at %d,%d,%d; Not a path", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Search path ends at %d,%d,%d; Not a path", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 continue; @@ -981,7 +981,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Search path ends at %d,%d,%d; Wide path; Score: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, new_score); } @@ -998,7 +998,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Path element at %d,%d,%d; Edges (0123):%d%d%d%d; Reverse: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, edges & 1, (edges & 2) >> 1, (edges & 4) >> 2, (edges & 8) >> 3, test_edge ^ 2); } @@ -1016,7 +1016,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Search path ends at %d,%d,%d; No more edges/dead end", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Search path ends at %d,%d,%d; No more edges/dead end", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 continue; @@ -1051,7 +1051,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Search path ends at %d,%d,%d; Search limit reached; Score: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, new_score); } @@ -1125,7 +1125,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Search path ends at %d,%d,%d; Loop", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Search path ends at %d,%d,%d; Loop", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 continue; @@ -1157,7 +1157,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Search path ends at %d,%d,%d; NumJunctions < 0; Score: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, new_score); } @@ -1192,17 +1192,17 @@ static void peep_pathfind_heuristic_search( if (searchResult == PATH_SEARCH_JUNCTION) { if (thin_junction) - log_info( + LOG_INFO( "[%03d] Recurse from %d,%d,%d edge: %d; Thin-Junction", counter, loc.x >> 5, loc.y >> 5, loc.z, next_test_edge); else - log_info( + LOG_INFO( "[%03d] Recurse from %d,%d,%d edge: %d; Wide-Junction", counter, loc.x >> 5, loc.y >> 5, loc.z, next_test_edge); } else { - log_info( + LOG_INFO( "[%03d] Recurse from %d,%d,%d edge: %d; Segment", counter, loc.x >> 5, loc.y >> 5, loc.z, next_test_edge); } @@ -1223,7 +1223,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info( + LOG_INFO( "[%03d] Returned to %d,%d,%d edge: %d; Score: %d", counter, loc.x >> 5, loc.y >> 5, loc.z, next_test_edge, *endScore); } @@ -1239,7 +1239,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Returning from %d,%d,%d; No relevant map element found", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Returning from %d,%d,%d; No relevant map element found", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 } @@ -1248,7 +1248,7 @@ static void peep_pathfind_heuristic_search( #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_info("[%03d] Returning from %d,%d,%d; All map elements checked", counter, loc.x >> 5, loc.y >> 5, loc.z); + LOG_INFO("[%03d] Returning from %d,%d,%d; All map elements checked", counter, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 } @@ -1279,7 +1279,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose( + LOG_VERBOSE( "Choose direction for %s for goal %d,%d,%d from %d,%d,%d", _pathFindDebugPeepName, goal.x, goal.y, goal.z, loc.x, loc.y, loc.z); } @@ -1372,7 +1372,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose( + LOG_VERBOSE( "Getting untried edges from pf_history for %d,%d,%d: %s,%s,%s,%s", loc.x, loc.y, loc.z, (edges & 1) ? "0" : "-", (edges & 2) ? "1" : "-", (edges & 4) ? "2" : "-", (edges & 8) ? "3" : "-"); } @@ -1394,7 +1394,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose("All edges tried for %d,%d,%d - resetting to all untried", loc.x, loc.y, loc.z); + LOG_VERBOSE("All edges tried for %d,%d,%d - resetting to all untried", loc.x, loc.y, loc.z); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 } @@ -1417,7 +1417,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose("New goal; clearing pf_history."); + LOG_VERBOSE("New goal; clearing pf_history."); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 } @@ -1442,7 +1442,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p if (_pathFindDebug) { - log_verbose("Pathfind start for goal %d,%d,%d from %d,%d,%d", goal.x, goal.y, goal.z, loc.x, loc.y, loc.z); + LOG_VERBOSE("Pathfind start for goal %d,%d,%d from %d,%d,%d", goal.x, goal.y, goal.z, loc.x, loc.y, loc.z); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -1516,7 +1516,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 if (gPathFindDebug) { - log_verbose("Pathfind searching in direction: %d from %d,%d,%d", test_edge, loc.x >> 5, loc.y >> 5, loc.z); + LOG_VERBOSE("Pathfind searching in direction: %d from %d,%d,%d", test_edge, loc.x >> 5, loc.y >> 5, loc.z); } #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 @@ -1527,12 +1527,12 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose( + LOG_VERBOSE( "Pathfind test edge: %d score: %d steps: %d end: %d,%d,%d junctions: %d", test_edge, score, endSteps, endXYZ.x, endXYZ.y, endXYZ.z, endJunctions); for (uint8_t listIdx = 0; listIdx < endJunctions; listIdx++) { - log_info( + LOG_INFO( "Junction#%d %d,%d,%d Direction %d", listIdx + 1, endJunctionList[listIdx].x, endJunctionList[listIdx].y, endJunctionList[listIdx].z, endDirectionList[listIdx]); } @@ -1568,7 +1568,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose("Pathfind heuristic search failed."); + LOG_VERBOSE("Pathfind heuristic search failed."); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 return INVALID_DIRECTION; @@ -1576,14 +1576,14 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose("Pathfind best edge %d with score %d steps %d", chosen_edge, best_score, best_sub); + LOG_VERBOSE("Pathfind best edge %d with score %d steps %d", chosen_edge, best_score, best_sub); for (uint8_t listIdx = 0; listIdx < bestJunctions; listIdx++) { - log_verbose( + LOG_VERBOSE( "Junction#%d %d,%d,%d Direction %d", listIdx + 1, bestJunctionList[listIdx].x, bestJunctionList[listIdx].y, bestJunctionList[listIdx].z, bestDirectionList[listIdx]); } - log_verbose("End at %d,%d,%d", bestXYZ.x, bestXYZ.y, bestXYZ.z); + LOG_VERBOSE("End at %d,%d,%d", bestXYZ.x, bestXYZ.y, bestXYZ.z); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 } @@ -1603,7 +1603,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose( + LOG_VERBOSE( "Updating existing pf_history (in index: %u) for %d,%d,%d without entry edge %d & exit edge %d.", i, loc.x, loc.y, loc.z, DirectionReverse(peep.PeepDirection), chosen_edge); } @@ -1625,7 +1625,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_verbose( + LOG_VERBOSE( "Storing new pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i, loc.x, loc.y, loc.z, DirectionReverse(peep.PeepDirection), chosen_edge); } @@ -1977,7 +1977,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) PathfindLoggingEnable(peep); if (_pathFindDebug) { - log_info("Starting CalculateNextDestination for %s", _pathFindDebugPeepName); + LOG_INFO("Starting CalculateNextDestination for %s", _pathFindDebugPeepName); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -2047,7 +2047,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info( + LOG_INFO( "Completed CalculateNextDestination for %s - taking only direction available: %d.", _pathFindDebugPeepName, direction); } @@ -2065,7 +2065,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info("Completed CalculateNextDestination for %s - peep is outside the park.", _pathFindDebugPeepName); + LOG_INFO("Completed CalculateNextDestination for %s - peep is outside the park.", _pathFindDebugPeepName); } PathfindLoggingDisable(); #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -2135,7 +2135,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info("Completed CalculateNextDestination for %s - peep is leaving the park.", _pathFindDebugPeepName); + LOG_INFO("Completed CalculateNextDestination for %s - peep is leaving the park.", _pathFindDebugPeepName); } PathfindLoggingDisable(); #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -2147,7 +2147,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info("Completed CalculateNextDestination for %s - peep is aimless.", _pathFindDebugPeepName); + LOG_INFO("Completed CalculateNextDestination for %s - peep is aimless.", _pathFindDebugPeepName); } PathfindLoggingDisable(); #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -2162,7 +2162,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info( + LOG_INFO( "Completed CalculateNextDestination for %s - peep is heading to closed ride == aimless.", _pathFindDebugPeepName); } @@ -2250,7 +2250,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info( + LOG_INFO( "Completed CalculateNextDestination for %s - failed to choose a direction == aimless.", _pathFindDebugPeepName); } PathfindLoggingDisable(); @@ -2261,7 +2261,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info("Completed CalculateNextDestination for %s - direction chosen: %d.", _pathFindDebugPeepName, direction); + LOG_INFO("Completed CalculateNextDestination for %s - direction chosen: %d.", _pathFindDebugPeepName, direction); } PathfindLoggingDisable(); #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 @@ -2304,7 +2304,7 @@ void Peep::ResetPathfindGoal() #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (_pathFindDebug) { - log_info("Resetting PathfindGoal for %s", _pathFindDebugPeepName); + LOG_INFO("Resetting PathfindGoal for %s", _pathFindDebugPeepName); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index edd9980a2a..8cf995fe8a 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -153,7 +153,7 @@ static bool OnCrash( fclose(dest); } - bool with_record = stop_silent_record(); + bool with_record = StopSilentRecord(); // Try to rename the files if (_wrename(dumpFilePath, dumpFilePathNew) == 0) diff --git a/src/openrct2/platform/Platform.Android.cpp b/src/openrct2/platform/Platform.Android.cpp index d80e4e25f6..8dea40aca5 100644 --- a/src/openrct2/platform/Platform.Android.cpp +++ b/src/openrct2/platform/Platform.Android.cpp @@ -131,7 +131,7 @@ namespace Platform AndroidClassLoader::AndroidClassLoader() { - log_info("Obtaining JNI class loader"); + LOG_INFO("Obtaining JNI class loader"); // This is a workaround to be able to call JNI's ClassLoader from non-main // thread, based on https://stackoverflow.com/a/16302771 diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp index 3deb71757f..c3366fe11c 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp @@ -67,7 +67,7 @@ namespace Platform }; for (auto searchLocation : searchLocations) { - log_verbose("Looking for OpenRCT2 doc path at %s", searchLocation); + LOG_VERBOSE("Looking for OpenRCT2 doc path at %s", searchLocation); if (Path::DirectoryExists(searchLocation)) { return searchLocation; @@ -116,7 +116,7 @@ namespace Platform for (auto searchLocation : SearchLocations) { auto prefixedPath = Path::Combine(prefix, searchLocation); - log_verbose("Looking for OpenRCT2 data in %s", prefixedPath.c_str()); + LOG_VERBOSE("Looking for OpenRCT2 data in %s", prefixedPath.c_str()); if (Path::DirectoryExists(prefixedPath)) { return prefixedPath; @@ -133,7 +133,7 @@ namespace Platform auto bytesRead = readlink("/proc/self/exe", exePath, sizeof(exePath)); if (bytesRead == -1) { - log_fatal("failed to read /proc/self/exe"); + LOG_FATAL("failed to read /proc/self/exe"); } # elif defined(__FreeBSD__) || defined(__NetBSD__) # if defined(__FreeBSD__) @@ -154,7 +154,7 @@ namespace Platform auto exeLen = sizeof(exePath); if (sysctl(mib, 4, exePath, &exeLen, nullptr, 0) == -1) { - log_fatal("failed to get process path"); + LOG_FATAL("failed to get process path"); } # elif defined(__OpenBSD__) // There is no way to get the path name of a running executable. @@ -317,11 +317,11 @@ namespace Platform # ifndef NO_TTF std::string GetFontPath(const TTFFontDescriptor& font) { - log_verbose("Looking for font %s with FontConfig.", font.font_name); + LOG_VERBOSE("Looking for font %s with FontConfig.", font.font_name); FcConfig* config = FcInitLoadConfigAndFonts(); if (!config) { - log_error("Failed to initialize FontConfig library"); + LOG_ERROR("Failed to initialize FontConfig library"); FcFini(); return {}; } @@ -348,7 +348,7 @@ namespace Platform if (FcPatternGetString(match, FC_FULLNAME, 0, &matched_font_face) == FcResultMatch && strcmp(font.font_name, reinterpret_cast(matched_font_face)) != 0) { - log_verbose("FontConfig provided substitute font %s -- disregarding.", matched_font_face); + LOG_VERBOSE("FontConfig provided substitute font %s -- disregarding.", matched_font_face); is_substitute = true; } @@ -356,14 +356,14 @@ namespace Platform if (!is_substitute && FcPatternGetString(match, FC_FILE, 0, &filename) == FcResultMatch) { path = reinterpret_cast(filename); - log_verbose("FontConfig provided font %s", filename); + LOG_VERBOSE("FontConfig provided font %s", filename); } FcPatternDestroy(match); } else { - log_warning("Failed to find required font."); + LOG_WARNING("Failed to find required font."); } FcPatternDestroy(pat); diff --git a/src/openrct2/platform/Platform.Posix.cpp b/src/openrct2/platform/Platform.Posix.cpp index 17fadeffed..bc85d3b1b3 100644 --- a/src/openrct2/platform/Platform.Posix.cpp +++ b/src/openrct2/platform/Platform.Posix.cpp @@ -120,7 +120,7 @@ namespace Platform int32_t Execute(std::string_view command, std::string* output) { # ifndef __EMSCRIPTEN__ - log_verbose("executing \"%s\"...", std::string(command).c_str()); + LOG_VERBOSE("executing \"%s\"...", std::string(command).c_str()); FILE* fpipe = popen(std::string(command).c_str(), "r"); if (fpipe == nullptr) { @@ -162,7 +162,7 @@ namespace Platform // Return exit code return pclose(fpipe); # else - log_warning("Emscripten cannot execute processes. The commandline was '%s'.", command.c_str()); + LOG_WARNING("Emscripten cannot execute processes. The commandline was '%s'.", command.c_str()); return -1; # endif // __EMSCRIPTEN__ } @@ -322,7 +322,7 @@ namespace Platform char buffer[MAX_PATH]; safe_strcpy(buffer, u8string(path).c_str(), sizeof(buffer)); - log_verbose("Create directory: %s", buffer); + LOG_VERBOSE("Create directory: %s", buffer); for (char* p = buffer + 1; *p != '\0'; p++) { if (*p == '/') @@ -330,7 +330,7 @@ namespace Platform // Temporarily truncate *p = '\0'; - log_verbose("mkdir(%s)", buffer); + LOG_VERBOSE("mkdir(%s)", buffer); if (mkdir(buffer, mask) != 0) { if (errno != EEXIST) @@ -344,7 +344,7 @@ namespace Platform } } - log_verbose("mkdir(%s)", buffer); + LOG_VERBOSE("mkdir(%s)", buffer); if (mkdir(buffer, mask) != 0) { if (errno != EEXIST) @@ -368,7 +368,7 @@ namespace Platform if (pidFile == -1) { - log_warning("Cannot open lock file for writing."); + LOG_WARNING("Cannot open lock file for writing."); return false; } @@ -383,10 +383,10 @@ namespace Platform { if (errno == EWOULDBLOCK) { - log_warning("Another OpenRCT2 session has been found running."); + LOG_WARNING("Another OpenRCT2 session has been found running."); return false; } - log_error("flock returned an uncatched errno: %d", errno); + LOG_ERROR("flock returned an uncatched errno: %d", errno); return false; } return true; @@ -446,7 +446,7 @@ namespace Platform struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { - log_fatal("clock_gettime failed"); + LOG_FATAL("clock_gettime failed"); exit(-1); } return static_cast(ts.tv_sec * 1000 + ts.tv_nsec / 1000000); diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index 0c2d189710..bbe1b45e24 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -504,13 +504,13 @@ namespace Platform bool FindApp(std::string_view app, std::string* output) { - log_warning("FindApp() not implemented for Windows!"); + LOG_WARNING("FindApp() not implemented for Windows!"); return false; } int32_t Execute(std::string_view command, std::string* output) { - log_warning("Execute() not implemented for Windows!"); + LOG_WARNING("Execute() not implemented for Windows!"); return -1; } @@ -798,7 +798,7 @@ namespace Platform HANDLE mutex = CreateMutexW(nullptr, FALSE, SINGLE_INSTANCE_MUTEX_NAME); if (mutex == nullptr) { - log_error("unable to create mutex"); + LOG_ERROR("unable to create mutex"); return true; } else if (GetLastError() == ERROR_ALREADY_EXISTS) @@ -861,7 +861,7 @@ namespace Platform bool SetupUriProtocol() { - log_verbose("Setting up URI protocol..."); + LOG_VERBOSE("Setting up URI protocol..."); // [HKEY_CURRENT_USER\Software\Classes] HKEY hRootKey; @@ -895,7 +895,7 @@ namespace Platform RegSetKeyValueW(hMuiCacheKey, nullptr, buffer, REG_SZ, L"OpenRCT2", sizeof(L"OpenRCT2")); } - log_verbose("URI protocol setup successful"); + LOG_VERBOSE("URI protocol setup successful"); return true; } } @@ -903,7 +903,7 @@ namespace Platform } } - log_verbose("URI protocol setup failed"); + LOG_VERBOSE("URI protocol setup failed"); return false; } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 86b414e3eb..2942636d88 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -581,7 +581,7 @@ namespace RCT1 } else { - log_error("Cannot find object %s", objectName); + LOG_ERROR("Cannot find object %s", objectName); } } } @@ -810,7 +810,7 @@ namespace RCT1 // This can happen with hacked parks if (rideEntry == nullptr) { - log_warning("Discarding ride with invalid ride entry"); + LOG_WARNING("Discarding ride with invalid ride entry"); dst->type = RIDE_TYPE_NULL; return; } diff --git a/src/openrct2/rct1/Tables.cpp b/src/openrct2/rct1/Tables.cpp index aeff5593bb..4f572d3642 100644 --- a/src/openrct2/rct1/Tables.cpp +++ b/src/openrct2/rct1/Tables.cpp @@ -62,7 +62,7 @@ namespace RCT1 }; if (colour >= std::size(map)) { - log_warning("Unsupported RCT1 colour."); + LOG_WARNING("Unsupported RCT1 colour."); return COLOUR_BLACK; } return map[colour]; @@ -110,7 +110,7 @@ namespace RCT1 }; if (EnumValue(rct1SpriteType) >= std::size(map)) { - log_warning("Unsupported RCT1 peep sprite type: %d.", EnumValue(rct1SpriteType)); + LOG_WARNING("Unsupported RCT1 peep sprite type: %d.", EnumValue(rct1SpriteType)); return ::PeepSpriteType::Normal; } return map[EnumValue(rct1SpriteType)]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 649049e25a..2cfa7e4dbf 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -143,7 +143,7 @@ namespace RCT2 auto chunkReader = SawyerChunkReader(stream); chunkReader.ReadChunk(&_s6.header, sizeof(_s6.header)); - log_verbose("saved game classic_flag = 0x%02x", _s6.header.classic_flag); + LOG_VERBOSE("saved game classic_flag = 0x%02x", _s6.header.classic_flag); if (isScenario) { if (_s6.header.type != S6_TYPE_SCENARIO) @@ -485,7 +485,7 @@ namespace RCT2 else { // In case where news item type is broken, consider all remaining news items invalid. - log_error("Invalid news type 0x%x for news item %d, ignoring remaining news items", src->Type, i); + LOG_ERROR("Invalid news type 0x%x for news item %d, ignoring remaining news items", src->Type, i); // Still need to set the correct type to properly terminate the queue dst->Type = News::ItemType::Null; break; @@ -775,7 +775,7 @@ namespace RCT2 if (rideType >= RIDE_TYPE_COUNT) { - log_error("Invalid ride type for a ride in this save."); + LOG_ERROR("Invalid ride type for a ride in this save."); throw UnsupportedRideTypeException(rideType); } dst->type = rideType; diff --git a/src/openrct2/rct2/T6Exporter.cpp b/src/openrct2/rct2/T6Exporter.cpp index e672449b32..1c56428855 100644 --- a/src/openrct2/rct2/T6Exporter.cpp +++ b/src/openrct2/rct2/T6Exporter.cpp @@ -43,7 +43,7 @@ namespace RCT2 } catch (const std::exception& e) { - log_error("Unable to save track design: %s", e.what()); + LOG_ERROR("Unable to save track design: %s", e.what()); return false; } } diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index bf22be1cb5..09fa703919 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -131,7 +131,7 @@ namespace RCT2 auto version = static_cast((td6.version_and_colour_scheme >> 2) & 3); if (version != RCT12TrackDesignVersion::TD6) { - log_error("Unsupported track design."); + LOG_ERROR("Unsupported track design."); return nullptr; } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index c3b56d1586..75133030e0 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -214,7 +214,7 @@ std::string_view GetRideEntryName(ObjectEntryIndex index) { if (index >= object_entry_group_counts[EnumValue(ObjectType::Ride)]) { - log_error("invalid index %d for ride type", index); + LOG_ERROR("invalid index %d for ride type", index); return {}; } @@ -3880,7 +3880,7 @@ ResultWithMessage Ride::Test(bool isApplying) { if (type == RIDE_TYPE_NULL) { - log_warning("Invalid ride type for ride %u", id.ToUnderlying()); + LOG_WARNING("Invalid ride type for ride %u", id.ToUnderlying()); return { false }; } @@ -3927,7 +3927,7 @@ ResultWithMessage Ride::Simulate(bool isApplying) CoordsXYE trackElement, problematicTrackElement = {}; if (type == RIDE_TYPE_NULL) { - log_warning("Invalid ride type for ride %u", id.ToUnderlying()); + LOG_WARNING("Invalid ride type for ride %u", id.ToUnderlying()); return { false }; } @@ -3970,7 +3970,7 @@ ResultWithMessage Ride::Open(bool isApplying) // We can't just call close as it would cause a stack overflow during shop creation // with auto open on. if (WindowClass::RideConstruction == gCurrentToolWidget.window_classification - && id.ToUnderlying() == gCurrentToolWidget.window_number && (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) + && id.ToUnderlying() == gCurrentToolWidget.window_number && (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))) { WindowCloseByNumber(WindowClass::RideConstruction, id.ToUnderlying()); } @@ -5388,7 +5388,7 @@ const MusicObject* Ride::GetMusicObject() const // If none exists at that height, newer and higher placed ones take precedence. void DetermineRideEntranceAndExitLocations() { - log_verbose("Inspecting ride entrance / exit locations"); + LOG_VERBOSE("Inspecting ride entrance / exit locations"); for (auto& ride : GetRideManager()) { @@ -5482,7 +5482,7 @@ void DetermineRideEntranceAndExitLocations() static_cast(entranceElement->GetDirection()) }; alreadyFoundEntrance = true; - log_verbose( + LOG_VERBOSE( "Fixed disconnected entrance of ride %d, station %d to x = %d, y = %d and z = %d.", ride.id, stationIndex, x, y, entranceElement->base_height); } @@ -5501,7 +5501,7 @@ void DetermineRideEntranceAndExitLocations() static_cast(entranceElement->GetDirection()) }; alreadyFoundExit = true; - log_verbose( + LOG_VERBOSE( "Fixed disconnected exit of ride %d, station %d to x = %d, y = %d and z = %d.", ride.id, stationIndex, x, y, entranceElement->base_height); } @@ -5513,12 +5513,12 @@ void DetermineRideEntranceAndExitLocations() if (fixEntrance && !alreadyFoundEntrance) { station.Entrance.SetNull(); - log_verbose("Cleared disconnected entrance of ride %d, station %d.", ride.id, stationIndex); + LOG_VERBOSE("Cleared disconnected entrance of ride %d, station %d.", ride.id, stationIndex); } if (fixExit && !alreadyFoundExit) { station.Exit.SetNull(); - log_verbose("Cleared disconnected exit of ride %d, station %d.", ride.id, stationIndex); + LOG_VERBOSE("Cleared disconnected exit of ride %d, station %d.", ride.id, stationIndex); } } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 7c117f190d..84edf46b69 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -912,7 +912,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) } RideConstructionInvalidateCurrentTrack(); - if (_rideConstructionState != RideConstructionState::EntranceExit || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (_rideConstructionState != RideConstructionState::EntranceExit || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) || gCurrentToolWidget.window_classification != WindowClass::RideConstruction) { // Replace entrance / exit @@ -923,7 +923,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) gRideEntranceExitPlaceType = entranceType; gRideEntranceExitPlaceRideIndex = rideIndex; gRideEntranceExitPlaceStationIndex = stationIndex; - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); if (_rideConstructionState != RideConstructionState::EntranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; @@ -1109,7 +1109,7 @@ int32_t RideInitialiseConstructionWindow(Ride& ride) w = ride_create_or_find_construction_window(ride.id); ToolSet(*w, WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT, Tool::Crosshair); - input_set_flag(INPUT_FLAG_6, true); + InputSetFlag(INPUT_FLAG_6, true); _currentTrackCurve = ride.GetRideTypeDescriptor().StartTrackPiece | RideConstructionSpecialPieceSelected; _currentTrackSlopeEnd = 0; diff --git a/src/openrct2/ride/RideData.cpp b/src/openrct2/ride/RideData.cpp index a1ee508069..266ec56172 100644 --- a/src/openrct2/ride/RideData.cpp +++ b/src/openrct2/ride/RideData.cpp @@ -374,7 +374,7 @@ ResearchCategory RideTypeDescriptor::GetResearchCategory() const case RIDE_CATEGORY_NONE: break; } - log_error("Cannot get Research Category of invalid RideCategory"); + LOG_ERROR("Cannot get Research Category of invalid RideCategory"); return ResearchCategory::Transport; } diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 7f78ec9167..01aaea8a61 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -220,7 +220,7 @@ ResultWithMessage TrackAddStationElement(CoordsXYZD loc, RideId rideIndex, int32 auto stationIndex = RideGetFirstEmptyStationStart(*ride); if (stationIndex.IsNull()) { - log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides."); + LOG_VERBOSE("No empty station starts, not updating metadata! This can happen with hacked rides."); } else { @@ -355,7 +355,7 @@ ResultWithMessage TrackRemoveStationElement(const CoordsXYZD& loc, RideId rideIn auto stationIndex = RideGetFirstEmptyStationStart(*ride); if (stationIndex.IsNull()) { - log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides."); + LOG_VERBOSE("No empty station starts, not updating metadata! This can happen with hacked rides."); } else { diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 616c46ab83..cdc3404b20 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -629,9 +629,9 @@ std::unique_ptr TrackDesignImport(const utf8* path) } catch (const std::exception& e) { - log_error("Unable to load track design: %s", e.what()); + LOG_ERROR("Unable to load track design: %s", e.what()); } - log_verbose("track_design_open(\"%s\")", path); + LOG_VERBOSE("track_design_open(\"%s\")", path); return nullptr; } diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 3580a392b4..28ac0acb33 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -477,7 +477,7 @@ static void track_design_save_remove_large_scenery(const CoordsXY& loc, LargeSce { if (tileElement == nullptr) { - log_warning("Null tile element"); + LOG_WARNING("Null tile element"); return; } diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index abb4e1e6a2..2e0734f3f9 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -2177,7 +2177,7 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons auto ride = GetRide(rideIndex); if (ride == nullptr) { - log_error("Attempted to paint invalid ride: %d", rideIndex); + LOG_ERROR("Attempted to paint invalid ride: %d", rideIndex); return; } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 23168acce1..936cbb1113 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3512,7 +3512,7 @@ void Vehicle::UpdateCollisionSetup() auto nextTrain = GetEntity(lastVehicle->next_vehicle_on_ride); if (prevTrain == nullptr || nextTrain == nullptr) { - log_error("Corrupted vehicle list for ride!"); + LOG_ERROR("Corrupted vehicle list for ride!"); } else { @@ -3593,7 +3593,7 @@ void Vehicle::UpdateCrashSetup() auto nextTrain = GetEntity(lastVehicle->next_vehicle_on_ride); if (prevTrain == nullptr || nextTrain == nullptr) { - log_error("Corrupted vehicle list for ride!"); + LOG_ERROR("Corrupted vehicle list for ride!"); } else { @@ -7760,7 +7760,7 @@ loc_6DAEB9: if (otherVeh == nullptr) { // This can never happen as prev_vehicle_on_ride will always be set to a vehicle - log_error("Failed to get next vehicle during update!"); + LOG_ERROR("Failed to get next vehicle during update!"); return true; } auto head = otherVeh->TrainHead(); @@ -8334,7 +8334,7 @@ loc_6DC743: track_progress++; break; case MiniGolfState::Unk1: // loc_6DC7ED - log_error("Unused move info..."); + LOG_ERROR("Unused move info..."); assert(false); var_D3 = static_cast(moveInfo->z); track_progress++; @@ -8386,7 +8386,7 @@ loc_6DC743: track_progress++; break; default: - log_error("Invalid move info..."); + LOG_ERROR("Invalid move info..."); assert(false); break; } @@ -9321,7 +9321,7 @@ Vehicle* Vehicle::GetCar(size_t carIndex) const car = GetEntity(car->next_vehicle_on_train); if (car == nullptr) { - log_error("Tried to get non-existent car from index!"); + LOG_ERROR("Tried to get non-existent car from index!"); return nullptr; } } diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 3e5c49c422..5afe239981 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -89,7 +89,7 @@ using namespace OpenRCT2; void scenario_begin() { - game_load_init(); + GameLoadInit(); scenario_reset(); if (gScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen) @@ -187,7 +187,7 @@ void scenario_reset() static void scenario_end() { - game_reset_speed(); + GameResetSpeed(); WindowCloseByClass(WindowClass::Dropdown); WindowCloseAllExceptFlags(WF_STICK_TO_BACK | WF_STICK_TO_FRONT); ContextOpenWindowView(WV_PARK_OBJECTIVE); @@ -292,7 +292,7 @@ void scenario_autosave_check() if (shouldSave) { gLastAutoSaveUpdate = AUTOSAVE_PAUSE; - game_autosave(); + GameAutosave(); } } diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 83523a0900..7e1b31ea49 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -194,7 +194,7 @@ private: */ static bool GetScenarioInfo(const std::string& path, uint64_t timestamp, scenario_index_entry* entry) { - log_verbose("GetScenarioInfo(%s, %d, ...)", path.c_str(), timestamp); + LOG_VERBOSE("GetScenarioInfo(%s, %d, ...)", path.c_str(), timestamp); try { std::string extension = Path::GetExtension(path); @@ -261,7 +261,7 @@ private: return true; } - log_verbose("%s is not a scenario", path.c_str()); + LOG_VERBOSE("%s is not a scenario", path.c_str()); } catch (const std::exception&) { @@ -572,7 +572,7 @@ private: } else { - log_error("Tried to add scenario with an empty filename!"); + LOG_ERROR("Tried to add scenario with an empty filename!"); } } diff --git a/src/openrct2/scenario/ScenarioSources.cpp b/src/openrct2/scenario/ScenarioSources.cpp index 9be71ecc26..74ed5113c5 100644 --- a/src/openrct2/scenario/ScenarioSources.cpp +++ b/src/openrct2/scenario/ScenarioSources.cpp @@ -429,7 +429,7 @@ namespace ScenarioSources { if (nameLength >= 4 && (name[3] == '1' || name[3] == '2')) { - log_verbose("Stripping RCT/1/2 from name: %s", name); + LOG_VERBOSE("Stripping RCT/1/2 from name: %s", name); String::Set(buffer, bufferSize, name + 4); } else @@ -447,7 +447,7 @@ namespace ScenarioSources { if (String::Equals(alias.Alternative, name)) { - log_verbose("Found alias: %s; will treat as: %s", name, alias.Original); + LOG_VERBOSE("Found alias: %s; will treat as: %s", name, alias.Original); String::Set(buffer, bufferSize, alias.Original); } } diff --git a/src/openrct2/scripting/Plugin.cpp b/src/openrct2/scripting/Plugin.cpp index 6214749f3e..6ff1fd6f70 100644 --- a/src/openrct2/scripting/Plugin.cpp +++ b/src/openrct2/scripting/Plugin.cpp @@ -163,7 +163,7 @@ PluginMetadata Plugin::GetMetadata(const DukValue& dukMetadata) } else { - log_error( + LOG_ERROR( u8"Plug-in ā€œ%sā€ does not specify a target API version or specifies it incorrectly. Emulating deprecated APIs.", metadata.Name.c_str()); } @@ -200,7 +200,7 @@ PluginType Plugin::ParsePluginType(std::string_view type) void Plugin::CheckForLicence(const DukValue& dukLicence, std::string_view pluginName) { if (dukLicence.type() != DukValue::Type::STRING || dukLicence.as_string().empty()) - log_error("Plugin %s does not specify a licence", std::string(pluginName).c_str()); + LOG_ERROR("Plugin %s does not specify a licence", std::string(pluginName).c_str()); } int32_t Plugin::GetTargetAPIVersion() const diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 8d1433ff80..83bb18ca12 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -114,11 +114,11 @@ void TitleScreen::SetHideVersionInfo(bool value) void TitleScreen::Load() { - log_verbose("TitleScreen::Load()"); + LOG_VERBOSE("TitleScreen::Load()"); - if (game_is_paused()) + if (GameIsPaused()) { - pause_toggle(); + PauseToggle(); } gScreenFlags = SCREEN_FLAGS_TITLE_DEMO; @@ -152,7 +152,7 @@ void TitleScreen::Load() _sequencePlayer->Update(); } - log_verbose("TitleScreen::Load() finished"); + LOG_VERBOSE("TitleScreen::Load() finished"); } void TitleScreen::Tick() @@ -160,9 +160,9 @@ void TitleScreen::Tick() gInUpdateCode = true; ScreenshotCheck(); - title_handle_keyboard_input(); + TitleHandleKeyboardInput(); - if (game_is_not_paused()) + if (GameIsNotPaused()) { TryLoadSequence(); _sequencePlayer->Update(); @@ -176,11 +176,11 @@ void TitleScreen::Tick() { _gameState.UpdateLogic(); } - update_palette_effects(); + UpdatePaletteEffects(); // update_weather_animation(); } - input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false); + InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false); ContextUpdateMapTooltip(); WindowDispatchUpdateAll(); @@ -334,7 +334,7 @@ bool TitleScreen::TryLoadSequence(bool loadPreview) if (!loadPreview) { GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); - game_notify_map_changed(); + GameNotifyMapChanged(); } return false; } diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index e7770d3149..3a44b24389 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -55,7 +55,7 @@ namespace OpenRCT2::Title std::vector saves; bool isZip; - log_verbose("Loading title sequence: %s", path.c_str()); + LOG_VERBOSE("Loading title sequence: %s", path.c_str()); auto ext = Path::GetExtension(path); if (String::Equals(ext, TITLE_SEQUENCE_EXTENSION)) diff --git a/src/openrct2/util/Util.cpp b/src/openrct2/util/Util.cpp index 02bd200de2..827d7c9e70 100644 --- a/src/openrct2/util/Util.cpp +++ b/src/openrct2/util/Util.cpp @@ -284,7 +284,7 @@ char* safe_strcpy(char* destination, const char* source, size_t size) if (truncated) { - log_warning("Truncating string \"%s\" to %d bytes.", result, size); + LOG_WARNING("Truncating string \"%s\" to %d bytes.", result, size); } return result; } @@ -330,7 +330,7 @@ char* safe_strcat(char* destination, const char* source, size_t size) if (!terminated) { result[size - 1] = '\0'; - log_warning("Truncating string \"%s\" to %d bytes.", result, size); + LOG_WARNING("Truncating string \"%s\" to %d bytes.", result, size); } return result; @@ -374,7 +374,7 @@ bool util_gzip_compress(FILE* source, FILE* dest) ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, windowBits | GZIP_ENCODING, 8, Z_DEFAULT_STRATEGY); if (ret != Z_OK) { - log_error("Failed to initialise stream"); + LOG_ERROR("Failed to initialise stream"); return false; } do @@ -383,7 +383,7 @@ bool util_gzip_compress(FILE* source, FILE* dest) if (ferror(source)) { deflateEnd(&strm); - log_error("Failed to read data from source"); + LOG_ERROR("Failed to read data from source"); return false; } flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; @@ -395,14 +395,14 @@ bool util_gzip_compress(FILE* source, FILE* dest) ret = deflate(&strm, flush); if (ret == Z_STREAM_ERROR) { - log_error("Failed to compress data"); + LOG_ERROR("Failed to compress data"); return false; } have = CHUNK - strm.avail_out; if (fwrite(out, 1, have, dest) != have || ferror(dest)) { deflateEnd(&strm); - log_error("Failed to write data to destination"); + LOG_ERROR("Failed to write data to destination"); return false; } } while (strm.avail_out == 0); diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index d56c2397bf..f294187a7c 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -409,7 +409,7 @@ bool SceneryToolIsActive() { auto toolWindowClassification = gCurrentToolWidget.window_classification; WidgetIndex toolWidgetIndex = gCurrentToolWidget.widget_index; - if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) + if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)) if (toolWindowClassification == WindowClass::TopToolbar && toolWidgetIndex == WC_TOP_TOOLBAR__WIDX_SCENERY) return true; diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 0b01b0608a..cae037a186 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -274,7 +274,7 @@ void BannerFixDuplicates() const auto index = bannerIndex.ToUnderlying(); if (activeBanners[index]) { - log_info( + LOG_INFO( "Duplicated banner with index %d found at x = %d, y = %d and z = %d.", index, x, y, bannerElement->base_height); @@ -282,7 +282,7 @@ void BannerFixDuplicates() auto newBanner = CreateBanner(); if (newBanner == nullptr) { - log_error("Failed to create new banner."); + LOG_ERROR("Failed to create new banner."); continue; } Guard::Assert(!activeBanners[newBanner->id.ToUnderlying()]); diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 9b89ac0f5a..74cd92c4ca 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1764,7 +1764,7 @@ bool PathElement::ShouldDrawPathOverSupports() const void PathElement::SetShouldDrawPathOverSupports(bool on) { - log_verbose("Setting 'draw path over supports' to %d", static_cast(on)); + LOG_VERBOSE("Setting 'draw path over supports' to %d", static_cast(on)); } /** diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 8dda9bc8d5..33d2af1ed2 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -333,7 +333,7 @@ TileElement* MapGetFirstElementAt(const TileCoordsXY& tilePos) { if (!IsTileLocationValid(tilePos)) { - log_verbose("Trying to access element outside of range"); + LOG_VERBOSE("Trying to access element outside of range"); return nullptr; } return _tileIndex.GetFirstElementAt(tilePos); @@ -391,7 +391,7 @@ void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements) { if (!MapIsLocationValid(tilePos.ToCoordsXY())) { - log_error("Trying to access element outside of range"); + LOG_ERROR("Trying to access element outside of range"); return; } _tileIndex.SetTile(tilePos, elements); @@ -1211,7 +1211,7 @@ static TileElement* AllocateTileElements(size_t numElementsOnTile, size_t numNew { if (!MapCheckFreeElementsAndReorganise(numElementsOnTile, numNewElements)) { - log_error("Cannot insert new element"); + LOG_ERROR("Cannot insert new element"); return nullptr; } diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index a229085784..fe03d195dc 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -59,7 +59,7 @@ void MapAnimationCreate(int32_t type, const CoordsXYZ& loc) } else { - log_error("Exceeded the maximum number of animations"); + LOG_ERROR("Exceeded the maximum number of animations"); } } } @@ -191,7 +191,7 @@ static bool MapAnimationInvalidateSmallScenery(const CoordsXYZ& loc) if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_CLOCK)) { // Peep, looking at scenery - if (!(gCurrentTicks & 0x3FF) && game_is_not_paused()) + if (!(gCurrentTicks & 0x3FF) && GameIsNotPaused()) { int32_t direction = tileElement->GetDirection(); auto quad = EntityTileList(CoordsXY{ loc } - CoordsDirectionDelta[direction]); @@ -330,7 +330,7 @@ static bool MapAnimationInvalidateTrackOnRidePhoto(const CoordsXYZ& loc) if (tileElement->AsTrack()->GetTrackType() == TrackElemType::OnRidePhoto) { MapInvalidateTileZoom1({ loc, loc.z, tileElement->GetClearanceZ() }); - if (game_is_paused()) + if (GameIsPaused()) { return false; } @@ -497,7 +497,7 @@ static bool MapAnimationInvalidateWallDoor(const CoordsXYZ& loc) if (wallEntry == nullptr || !(wallEntry->flags & WALL_SCENERY_IS_DOOR)) continue; - if (game_is_paused()) + if (GameIsPaused()) { return false; } diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index d1f0790a8e..ea63ef1c7e 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -728,7 +728,7 @@ bool MapGenLoadHeightmap(const utf8* path) ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_PNG, {}); break; default: - log_error("Unable to load height map image: %s", e.what()); + LOG_ERROR("Unable to load height map image: %s", e.what()); break; } return false; diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index 4891ae6465..4a7b8600e9 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -70,7 +70,7 @@ void TileElement::SetBannerIndex(BannerIndex bannerIndex) AsBanner()->SetIndex(bannerIndex); break; default: - log_error("Tried to set banner index on unsuitable tile element!"); + LOG_ERROR("Tried to set banner index on unsuitable tile element!"); Guard::Assert(false); } } @@ -151,7 +151,7 @@ const QuarterTile QuarterTile::Rotate(uint8_t amount) const return QuarterTile{ static_cast(rotVal1 | rotVal2) }; } default: - log_error("Tried to rotate QuarterTile invalid amount."); + LOG_ERROR("Tried to rotate QuarterTile invalid amount."); return QuarterTile{ 0 }; } } diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index a8e6659e76..12cf843148 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -48,17 +48,17 @@ namespace OpenRCT2::TileInspector if (firstElement == nullptr) { - log_error("First element is out of range for the tile"); + LOG_ERROR("First element is out of range for the tile"); return false; } if (secondElement == nullptr) { - log_error("Second element is out of range for the tile"); + LOG_ERROR("Second element is out of range for the tile"); return false; } if (firstElement == secondElement) { - log_error("Can't swap the element with itself"); + LOG_ERROR("Can't swap the element with itself"); return false; } @@ -339,7 +339,7 @@ namespace OpenRCT2::TileInspector auto newBanner = CreateBanner(); if (newBanner == nullptr) { - log_error("No free banners available"); + LOG_ERROR("No free banners available"); return GameActions::Result(GameActions::Status::Unknown, STR_TOO_MANY_BANNERS_IN_GAME, STR_NONE); } // Copy the banners style @@ -804,7 +804,7 @@ namespace OpenRCT2::TileInspector TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); if (tileElement == nullptr) { - log_error("Track map element part not found!"); + LOG_ERROR("Track map element part not found!"); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); } @@ -888,7 +888,7 @@ namespace OpenRCT2::TileInspector TrackElement* tileElement = MapGetTrackElementAtOfTypeSeq(elem, type, trackBlock->index); if (tileElement == nullptr) { - log_error("Track map element part not found!"); + LOG_ERROR("Track map element part not found!"); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); } diff --git a/test/tests/CLITests.cpp b/test/tests/CLITests.cpp index fe075b9431..ef84f3bd4f 100644 --- a/test/tests/CLITests.cpp +++ b/test/tests/CLITests.cpp @@ -59,7 +59,7 @@ TEST_F(CommandLineTests, cmdline_cmdline_for_sprite_details) std::string exampleFilePath = ExampleSpriteFilePath(); const char* detailsCmd[3] = { "details", exampleFilePath.c_str() }; - int32_t result = cmdline_for_sprite(detailsCmd, 2); + int32_t result = CmdLineForSprite(detailsCmd, 2); // need to come up with some way to extract stdout/stderr stream if we want to // fully test this module ASSERT_EQ(result, 1); @@ -71,7 +71,7 @@ TEST_F(CommandLineTests, cmdline_cmdline_for_sprite_build) std::string outputfilePath = BuildOutputfilePath(); const char* detailsCmd[3] = { "build", outputfilePath.c_str(), manifestFilePath.c_str() }; - int32_t result = cmdline_for_sprite(detailsCmd, 3); + int32_t result = CmdLineForSprite(detailsCmd, 3); ASSERT_EQ(result, 1); // compare the resulting output file and assert its identical to expected ASSERT_TRUE(CompareSpriteFiles(ExampleSpriteFilePath(), outputfilePath)); @@ -83,14 +83,14 @@ TEST_F(CommandLineTests, cmdline_cmdline_for_sprite_failed_build) std::string manifestFilePath = ManifestFilePath(); std::string outputfilePath = BuildOutputfilePath(); const char* detailsCmd[3] = { "build", outputfilePath.c_str(), manifestFilePath.c_str() }; - int32_t result = cmdline_for_sprite(detailsCmd, 3); + int32_t result = CmdLineForSprite(detailsCmd, 3); ASSERT_EQ(result, 1); ASSERT_TRUE(CompareSpriteFiles(ExampleSpriteFilePath(), outputfilePath)); // now use bad manifest and make sure output file is not edited std::string badManifestFilePath = BadManifestFilePath(); detailsCmd[2] = badManifestFilePath.c_str(); - result = cmdline_for_sprite(detailsCmd, 3); + result = CmdLineForSprite(detailsCmd, 3); // check the command failed ASSERT_EQ(result, -1); // validate the target file was unchanged diff --git a/test/tests/MultiLaunch.cpp b/test/tests/MultiLaunch.cpp index 759ab4bc8c..70bbab819b 100644 --- a/test/tests/MultiLaunch.cpp +++ b/test/tests/MultiLaunch.cpp @@ -42,7 +42,7 @@ TEST(MultiLaunchTest, all) ASSERT_TRUE(initialised); GetContext()->LoadParkFromFile(path); - game_load_init(); + GameLoadInit(); // Check ride count to check load was successful ASSERT_EQ(RideGetCount(), 134); diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 814589626f..5cc9bddfc6 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -39,7 +39,7 @@ public: std::string parkPath = TestData::GetParkPath("pathfinding-tests.sv6"); GetContext()->LoadParkFromFile(parkPath); - game_load_init(); + GameLoadInit(); } void SetUp() override diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index 315bfe32a8..43c147d540 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -54,7 +54,7 @@ static std::unique_ptr localStartGame(const std::string& parkPath) ResetEntitySpatialIndices(); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); ScenerySetDefaultPlacementConfiguration(); LoadPalette(); EntityTweener::Get().Reset(); diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index a0c4823665..4ed8be988d 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -63,7 +63,7 @@ static void GameInit(bool retainSpatialIndices) if (!retainSpatialIndices) ResetEntitySpatialIndices(); - reset_all_sprite_quadrant_placements(); + ResetAllSpriteQuadrantPlacements(); ScenerySetDefaultPlacementConfiguration(); LoadPalette(); EntityTweener::Get().Reset(); @@ -140,7 +140,7 @@ static void CompareStates(MemoryStream& importBuffer, MemoryStream& exportBuffer { if (importBuffer.GetLength() != exportBuffer.GetLength()) { - log_warning( + LOG_WARNING( "Inconsistent export size! Import Size: %llu bytes, Export Size: %llu bytes", static_cast(importBuffer.GetLength()), static_cast(exportBuffer.GetLength())); @@ -171,13 +171,13 @@ static void CompareStates(MemoryStream& importBuffer, MemoryStream& exportBuffer if (res != cmpData.spriteChanges.end()) { - log_warning("Snapshot data differences. %s", snapshots->GetCompareDataText(cmpData).c_str()); + LOG_WARNING("Snapshot data differences. %s", snapshots->GetCompareDataText(cmpData).c_str()); FAIL(); } } catch (const std::runtime_error& err) { - log_warning("Snapshot data failed to be read. Snapshot not compared. %s", err.what()); + LOG_WARNING("Snapshot data failed to be read. Snapshot not compared. %s", err.what()); FAIL(); } } diff --git a/test/tests/TileElements.cpp b/test/tests/TileElements.cpp index f664c384eb..a88f2e0062 100644 --- a/test/tests/TileElements.cpp +++ b/test/tests/TileElements.cpp @@ -33,7 +33,7 @@ protected: ASSERT_TRUE(initialised); GetContext()->LoadParkFromFile(parkPath); - game_load_init(); + GameLoadInit(); // Changed in some tests. Store to restore its value _gScreenFlags = gScreenFlags; diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index 9e1041949a..726771bd12 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -34,7 +34,7 @@ protected: ASSERT_TRUE(initialised); GetContext()->LoadParkFromFile(parkPath); - game_load_init(); + GameLoadInit(); // Changed in some tests. Store to restore its value _gScreenFlags = gScreenFlags;