1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 00:42:45 +01:00

Fix #13760: Store encoded error message inside CommandCost. (#13764)

Encoded error message was previously static to avoid memmory allocation, however this causes complications.
This commit is contained in:
Peter Nelson
2025-03-15 20:09:11 +00:00
committed by GitHub
parent 0cd87bc8c1
commit a87b804386
5 changed files with 9 additions and 12 deletions

View File

@@ -235,7 +235,7 @@ std::tuple<bool, bool, bool> CommandHelperBase::InternalPostBefore(Commands cmd,
* @param err_message Message prefix to show on error.
* @param my_cmd Is the command from this client?
*/
void CommandHelperBase::InternalPostResult(const CommandCost &res, TileIndex tile, bool estimate_only, bool only_sending, StringID err_message, bool my_cmd)
void CommandHelperBase::InternalPostResult(CommandCost &res, TileIndex tile, bool estimate_only, bool only_sending, StringID err_message, bool my_cmd)
{
int x = TileX(tile) * TILE_SIZE;
int y = TileY(tile) * TILE_SIZE;
@@ -407,8 +407,6 @@ void CommandCost::AddCost(const CommandCost &ret)
}
}
/* static */ EncodedString CommandCost::encoded_message;
/**
* Return an error status, with string and parameter.
* @param str StringID of error.