forked from rosebudai/OpenRCT2-Web
Merge pull request #25908 from frozensnowy/fix23859+25659-banner-text-issues
Fix #23859: Wrong banner text displayed after loading different park
This commit is contained in:
5 files changed
+17
-2
No files matched your search
@@ -13,6 +13,7 @@
|
||||
- Fix: [#18441] Replacing footpaths sometimes results in a spurious “Footpath in the way” error (original bug).
|
||||
- Fix: [#20620] In-game console caret does not update when pasting.
|
||||
- Fix: [#20652] Twister Roller Coaster design ‘u(0241)’ has no preview and cannot be built (bug in track design).
|
||||
- Fix: [#23859] Wrong banner text displayed after loading a different park.
|
||||
- Fix: [#25221] When trying to cancel game file discovery, the prompt reappears.
|
||||
- Fix: [#25703, #25889] Crash when scanning scenarios with packed objects in parallel.
|
||||
- Fix: [#25739] Game freezes when a tab in the New Ride window contains more than 384 items.
|
||||
@@ -24,7 +25,8 @@
|
||||
- Fix: [#25854] When a guest is at 0 happiness or energy, the game draws too big of a bar in the guest stats window.
|
||||
- Fix: [#25862] Diagonal and inclined brakes are not counted when calculating upkeep cost.
|
||||
- Fix: [#25873] Repainting a banner in OpenRCT2-specific colours results in an error message.
|
||||
- Fix: [#25879] Guest window viewport doesn’t follow vehicle when they board a ride.
|
||||
- Fix: [#25879] Guest window viewport doesn’t follow vehicle when they board a ride.
|
||||
- Fix: [#25908] Crash from use-after-free in banner text formatting during multithreaded rendering.
|
||||
- Fix: [objects#419] Alignment of RCT2 red, yellow and green queue previews is off.
|
||||
- Fix: [objects#424] Jet Aeroplane decor has a hole in it.
|
||||
- Fix: [objects#425] Capacity of ‘Blob from outer space ride’ is incorrectly listed.
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <openrct2/core/Path.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/ScrollingText.h>
|
||||
#include <openrct2/entity/EntityRegistry.h>
|
||||
#include <openrct2/interface/Viewport.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
@@ -439,6 +440,9 @@ namespace OpenRCT2::Title
|
||||
gameState.entities.ResetEntitySpatialIndices();
|
||||
ResetAllSpriteQuadrantPlacements();
|
||||
|
||||
// Invalidate scrolling text cache to prevent stale text from previous park
|
||||
Drawing::ScrollingText::invalidate();
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
|
||||
ContextBroadcastIntent(&intent);
|
||||
Ui::Windows::WindowScenerySetDefaultPlacementConfiguration();
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "core/Path.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "drawing/Drawing.h"
|
||||
#include "drawing/ScrollingText.h"
|
||||
#include "entity/EntityList.h"
|
||||
#include "entity/EntityRegistry.h"
|
||||
#include "entity/PatrolArea.h"
|
||||
@@ -362,6 +363,10 @@ void GameLoadInit()
|
||||
|
||||
context->SetActiveScene(context->GetGameScene());
|
||||
|
||||
// Invalidate scrolling text cache to prevent stale text from previous park
|
||||
// being displayed due to pointer value reuse in the cache matching logic
|
||||
Drawing::ScrollingText::invalidate();
|
||||
|
||||
if (!gLoadKeepWindowsOpen)
|
||||
{
|
||||
ContextResetSubsystems();
|
||||
|
||||
@@ -52,6 +52,11 @@ std::string Banner::getText() const
|
||||
|
||||
void Banner::formatTextWithColourTo(Formatter& ft) const
|
||||
{
|
||||
// Use thread_local buffer to avoid race conditions during multithreaded rendering.
|
||||
// Multiple threads can call this on the same Banner simultaneously when rendering
|
||||
// different viewport columns in parallel.
|
||||
thread_local std::string formattedTextBuffer;
|
||||
|
||||
auto formatToken = FormatTokenFromTextColour(textColour);
|
||||
formattedTextBuffer = FormatTokenToStringWithBraces(formatToken);
|
||||
ft.Add<StringId>(STR_STRING_STRINGID);
|
||||
|
||||
@@ -48,7 +48,6 @@ struct Banner
|
||||
OpenRCT2::ObjectEntryIndex type = kBannerNull;
|
||||
BannerFlags flags{};
|
||||
std::string text;
|
||||
mutable std::string formattedTextBuffer;
|
||||
OpenRCT2::Drawing::Colour colour{};
|
||||
RideId rideIndex{};
|
||||
OpenRCT2::Drawing::TextColour textColour{};
|
||||
|
||||
Reference in new issue
Block a user