From 853489ff2402f1944cfac545b30d3a100eb5b19e Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Fri, 7 Jun 2019 23:23:58 +0530 Subject: HDB: Change cacheTile() to getTile() getTile() caches the tile automatically if it hasn't been cached yet --- engines/hdb/draw-manager.cpp | 15 ++++++--------- engines/hdb/draw-manager.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index 85c313ab14..56d53bbdbd 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -78,17 +78,14 @@ bool DrawMan::init() { return true; } -bool DrawMan::cacheTile(int index) { +Tile *DrawMan::getTile(int index) { - if (index < 0) { - return false; - } - if (index > _numTiles) { - return false; + if (index < 0 || index > _numTiles) { + return NULL; } if (_tLookupArray[index].skyIndex) { - // We don't draw Sky Tiles, so return true - return true; + // We don't draw Sky Tiles, so return NULL + return NULL; } if (_tLookupArray[index].tData == NULL) { @@ -98,7 +95,7 @@ bool DrawMan::cacheTile(int index) { _tLookupArray[index].tData = tile; } - return true; + return _tLookupArray[index].tData; } Picture::~Picture() { diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h index 03abfb9d2b..238d36e939 100644 --- a/engines/hdb/draw-manager.h +++ b/engines/hdb/draw-manager.h @@ -48,7 +48,7 @@ public: DrawMan(); bool init(); - bool cacheTile(int index); + Tile *getTile(int index); private: int _numTiles; -- cgit v1.2.3