From ea6774d468b0b33b39b8da747b677dcc400ee558 Mon Sep 17 00:00:00 2001 From: ephphatha Date: Sun, 3 Apr 2022 11:22:24 +1000 Subject: [PATCH] Remove unnecessary string copies --- Source/error.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/error.cpp b/Source/error.cpp index c7f61348b..971de189d 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -29,11 +29,9 @@ const int LineWidth = 418; void InitNextLines() { msgdelay = SDL_GetTicks(); - auto message = DiabloMessages.front(); - TextLines.clear(); - const std::string paragraphs = WordWrapString(message, LineWidth, GameFont12, 1); + const std::string paragraphs = WordWrapString(DiabloMessages.front(), LineWidth, GameFont12, 1); size_t previous = 0; while (true) { @@ -165,7 +163,6 @@ void DrawDiabloMsg(const Surface &out) DrawHalfTransparentRectTo(out, PANEL_X + 104, dialogStartY - 8, 432, ErrorWindowHeight); - auto message = DiabloMessages.front(); int lineNumber = 0; for (auto &line : TextLines) { DrawString(out, line, { { PANEL_X + 109, dialogStartY + 12 + lineNumber * LineHeight }, { LineWidth, LineHeight } }, UiFlags::AlignCenter, 1, LineHeight);