From c1d172ef638174828338f0dcb9eaee78c94ea9da Mon Sep 17 00:00:00 2001 From: mix Date: Tue, 3 Feb 2026 14:48:33 +0000 Subject: [PATCH 1/2] Improve perf by remove reserves, copy to insert in SpriteFile::AddImage --- distribution/changelog.txt | 1 + src/openrct2/command_line/sprite/SpriteFile.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c8b284146a..4d6efa006a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.32 (in development) ------------------------------------------------------------------------ +- Improved: [#25941] The command line sprite build command is now faster. 0.4.31 (2026-02-01) ------------------------------------------------------------------------ diff --git a/src/openrct2/command_line/sprite/SpriteFile.cpp b/src/openrct2/command_line/sprite/SpriteFile.cpp index 144293b1dc..9aa78ac6b9 100644 --- a/src/openrct2/command_line/sprite/SpriteFile.cpp +++ b/src/openrct2/command_line/sprite/SpriteFile.cpp @@ -80,15 +80,13 @@ namespace OpenRCT2::CommandLine::Sprite // New image will have its data inserted after previous image uint8_t* newElementOffset = reinterpret_cast(static_cast(Header.totalSize)); Header.totalSize += static_cast(image.Buffer.size()); - Entries.reserve(Header.numEntries); { ScopedRelativeSpriteFile scopedRelative(*this); - Data.reserve(Header.totalSize); Entries.push_back(image.Element); Entries.back().offset = newElementOffset; const auto& buffer = image.Buffer; - std::copy(buffer.begin(), buffer.end(), std::back_inserter(Data)); + Data.insert(Data.end(), buffer.begin(), buffer.end()); } } From 1077a6490fc1a003da015c181020cea25ea9599b Mon Sep 17 00:00:00 2001 From: mix Date: Tue, 3 Feb 2026 14:54:57 +0000 Subject: [PATCH 2/2] Add silent to arguments when building sprite dats with sprite build cmd --- CMakeLists.txt | 2 +- openrct2.targets | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 252009a7cd..45b0ce09b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -406,7 +406,7 @@ if (NOT CMAKE_CROSSCOMPILING) file(GLOB_RECURSE dependent_files CONFIGURE_DEPENDS "${ROOT_DIR}/resources/${graphics_file}/*") add_custom_command( OUTPUT ${output_file} - COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}" + COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}" silent WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS ${dependent_files} ) diff --git a/openrct2.targets b/openrct2.targets index 2da26f6f8e..ec018e3ae8 100644 --- a/openrct2.targets +++ b/openrct2.targets @@ -113,7 +113,7 @@ - @@ -133,7 +133,7 @@ - @@ -153,7 +153,7 @@ - @@ -173,7 +173,7 @@ -