Avoid using malloc in scope guard logger.
Use a temporary object with its own buffer, which lives on the stack. Reformat SCOPE_INFO_FMT to not be all on one line. Other minor reformatting.
This commit is contained in:
@@ -456,7 +456,8 @@ CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
|
||||
*/
|
||||
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text)
|
||||
{
|
||||
SCOPE_INFO_FMT([=], "DoCommand: tile: %dx%d, p1: 0x%X, p2: 0x%X, flags: 0x%X, company: %s, cmd: 0x%X (%s)", TileX(tile), TileY(tile), p1, p2, flags, DumpCompanyInfo(_current_company), cmd, GetCommandName(cmd));
|
||||
SCOPE_INFO_FMT([=], "DoCommand: tile: %dx%d, p1: 0x%X, p2: 0x%X, flags: 0x%X, company: %s, cmd: 0x%X (%s)",
|
||||
TileX(tile), TileY(tile), p1, p2, flags, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd));
|
||||
|
||||
CommandCost res;
|
||||
|
||||
@@ -551,7 +552,8 @@ bool DoCommandP(const CommandContainer *container, bool my_cmd)
|
||||
*/
|
||||
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd)
|
||||
{
|
||||
SCOPE_INFO_FMT([=], "DoCommandP: tile: %dx%d, p1: 0x%X, p2: 0x%X, company: %s, cmd: 0x%X (%s), my_cmd: %d", TileX(tile), TileY(tile), p1, p2, DumpCompanyInfo(_current_company), cmd, GetCommandName(cmd), my_cmd);
|
||||
SCOPE_INFO_FMT([=], "DoCommandP: tile: %dx%d, p1: 0x%X, p2: 0x%X, company: %s, cmd: 0x%X (%s), my_cmd: %d",
|
||||
TileX(tile), TileY(tile), p1, p2, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd), my_cmd);
|
||||
|
||||
/* Cost estimation is generally only done when the
|
||||
* local user presses shift while doing somthing.
|
||||
|
Reference in New Issue
Block a user