Use backup/restore wrappers for various _cur_dpi changes

This commit is contained in:
Jonathan G Rennison
2023-02-15 21:13:58 +00:00
parent 85889143c7
commit fef39b5797
11 changed files with 34 additions and 69 deletions

View File

@@ -33,6 +33,7 @@
#include "departures_func.h"
#include "cargotype.h"
#include "zoom_func.h"
#include "core/backup_type.hpp"
#include "table/sprites.h"
#include "table/strings.h"
@@ -1001,8 +1002,7 @@ void DeparturesWindow<Twaypoint>::DrawDeparturesListItems(const Rect &r) const
y += this->entry_height;
continue;
}
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
/* The scrolling text starts out of view at the right of the screen and finishes when it is out of view at the left of the screen. */
int pos = ltr
@@ -1011,8 +1011,6 @@ void DeparturesWindow<Twaypoint>::DrawDeparturesListItems(const Rect &r) const
ltr ? DrawString( pos, INT16_MAX, 0, buffer, TC_FROMSTRING, SA_LEFT | SA_FORCE)
: DrawString(-INT16_MAX, pos, 0, buffer, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
_cur_dpi = old_dpi;
}
y += this->entry_height;