From 3ce421ad2335cd809b0432ca5f93ef8fe795a272 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Fri, 24 Nov 2023 10:23:56 +0100 Subject: [PATCH] Fix typo/regressions: - `std::make_unique()` != `std::unique_ptr()`. - `CFile::printf` now longer print extra nul characters. --- src/ai/script_ai.cpp | 2 +- src/stratagus/iolib.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ai/script_ai.cpp b/src/ai/script_ai.cpp index 6fcbfa6948..4ac06ce244 100644 --- a/src/ai/script_ai.cpp +++ b/src/ai/script_ai.cpp @@ -1612,7 +1612,7 @@ static int CclDefineAiPlayer(lua_State *l) // FIXME: lose this: // Assert(!Players[playerIdx].Ai && Players[playerIdx].AiEnabled); - Players[playerIdx].Ai = std::unique_ptr(); + Players[playerIdx].Ai = std::make_unique(); PlayerAi &ai = *Players[playerIdx].Ai; ai.Player = &Players[playerIdx]; diff --git a/src/stratagus/iolib.cpp b/src/stratagus/iolib.cpp index 5d8bee8480..8b16dae013 100644 --- a/src/stratagus/iolib.cpp +++ b/src/stratagus/iolib.cpp @@ -173,6 +173,7 @@ int CFile::printf(const char *format, ...) va_end(ap); // If that worked, string was processed. if (n > -1 && n < p.size()) { + p.resize(n); break; } // Else try again with more space.