Codechange: use RAII to automatically restore _cur_dpi after use
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
/** @file smallmap_gui.cpp GUI that shows a small map of the world with metadata like owner or height. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "core/backup_type.hpp"
|
||||
#include "clear_map.h"
|
||||
#include "industry.h"
|
||||
#include "station_map.h"
|
||||
@@ -973,10 +974,7 @@ void SmallMapWindow::DrawMapIndicators() const
|
||||
void SmallMapWindow::DrawSmallMap(DrawPixelInfo *dpi) const
|
||||
{
|
||||
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
||||
DrawPixelInfo *old_dpi;
|
||||
|
||||
old_dpi = _cur_dpi;
|
||||
_cur_dpi = dpi;
|
||||
AutoRestoreBackup dpi_backup(_cur_dpi, dpi);
|
||||
|
||||
/* Clear it */
|
||||
GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, PC_BLACK);
|
||||
@@ -1027,8 +1025,6 @@ void SmallMapWindow::DrawSmallMap(DrawPixelInfo *dpi) const
|
||||
|
||||
/* Draw map indicators */
|
||||
this->DrawMapIndicators();
|
||||
|
||||
_cur_dpi = old_dpi;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user