Skip to content

Commit

Permalink
Fix typo/regressions:
Browse files Browse the repository at this point in the history
- `std::make_unique<T>()` != `std::unique_ptr<T>()`.
- `CFile::printf` now longer print extra nul characters.
  • Loading branch information
Jarod42 committed Nov 24, 2023
1 parent 6c3be77 commit 3ce421a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ai/script_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlayerAi>();
Players[playerIdx].Ai = std::make_unique<PlayerAi>();
PlayerAi &ai = *Players[playerIdx].Ai;
ai.Player = &Players[playerIdx];

Expand Down
1 change: 1 addition & 0 deletions src/stratagus/iolib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3ce421a

Please sign in to comment.