diff --git a/src/command.cpp b/src/command.cpp index d72b55931d..b11306578d 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -28,6 +28,7 @@ #include "object_base.h" #include "newgrf_text.h" #include "string_func.h" +#include "scope_info.h" #include "table/strings.h" @@ -455,6 +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)); + CommandCost res; /* Do not even think about executing out-of-bounds tile-commands */ @@ -548,6 +551,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); + /* Cost estimation is generally only done when the * local user presses shift while doing somthing. * However, in case of incoming network commands, diff --git a/src/vehicle.cpp b/src/vehicle.cpp index a482520f25..420761bb3d 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -52,6 +52,8 @@ #include "gamelog.h" #include "linkgraph/linkgraph.h" #include "linkgraph/refresh.h" +#include "string_func.h" +#include "scope_info.h" #include "table/strings.h" @@ -849,8 +851,10 @@ static void RunVehicleDayProc() if (_game_mode != GM_NORMAL) return; /* Run the day_proc for every DAY_TICKS vehicle starting at _date_fract. */ + Vehicle *v = NULL; + SCOPE_INFO_FMT([&v], "RunVehicleDayProc: %s", DumpVehicleInfo(v)); for (size_t i = _date_fract; i < Vehicle::GetPoolSize(); i += DAY_TICKS) { - Vehicle *v = Vehicle::Get(i); + v = Vehicle::Get(i); if (v == NULL) continue; /* Call the 32-day callback if needed */ @@ -883,7 +887,8 @@ void CallVehicleTicks() Station *st; FOR_ALL_STATIONS(st) LoadUnloadStation(st); - Vehicle *v; + Vehicle *v = NULL; + SCOPE_INFO_FMT([&v], "CallVehicleTicks: %s", DumpVehicleInfo(v)); FOR_ALL_VEHICLES(v) { /* Vehicle could be deleted in this tick */ if (!v->Tick()) { @@ -952,6 +957,7 @@ void CallVehicleTicks() } } } + v = NULL; Backup cur_company(_current_company, FILE_LINE); for (AutoreplaceMap::iterator it = _vehicles_to_autoreplace.Begin(); it != _vehicles_to_autoreplace.End(); it++) {