Add a scope info logger for DoSetViewportPosition calls

pull/174/head
Jonathan G Rennison 4 years ago
parent b03889d7e6
commit 60dabc68a0

@ -16,6 +16,8 @@
#include "station_base.h"
#include "waypoint_base.h"
#include "map_func.h"
#include "window_func.h"
#include "window_gui.h"
#include "table/strings.h"
#include "safeguards.h"
@ -133,3 +135,9 @@ const char *scope_dumper::TileInfo(TileIndex tile)
DumpTileInfo(this->buffer, lastof(this->buffer), tile);
return this->buffer;
}
const char *scope_dumper::WindowInfo(const Window *w)
{
DumpWindowInfo(this->buffer, lastof(this->buffer), w);
return this->buffer;
}

@ -17,6 +17,7 @@
struct Vehicle;
struct BaseStation;
struct Window;
#ifdef USE_SCOPE_INFO
@ -71,6 +72,7 @@ struct scope_dumper {
const char *VehicleInfo(const Vehicle *v);
const char *StationInfo(const BaseStation *st);
const char *TileInfo(TileIndex tile);
const char *WindowInfo(const Window *w);
private:
char buffer[512];

@ -106,6 +106,7 @@
#include "core/container_func.hpp"
#include "tunnelbridge_map.h"
#include "video/video_driver.hpp"
#include "scope_info.h"
#include <map>
#include <vector>
@ -665,6 +666,7 @@ static void SetViewportPosition(Window *w, int x, int y, bool force_update_overl
if (i >= 0) height -= i;
if (height > 0 && (_vp_move_offs.x != 0 || _vp_move_offs.y != 0)) {
SCOPE_INFO_FMT([&], "DoSetViewportPosition: %d, %d, %d, %d, %d, %d, %s", left, top, width, height, _vp_move_offs.x, _vp_move_offs.y, scope_dumper().WindowInfo(w));
DoSetViewportPosition((Window *) w->z_front, left, top, width, height);
ClearViewPortCache(w->viewport);
}

Loading…
Cancel
Save