aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhitertandrek2018-03-14 08:43:06 +0200
committerEugene Sandulenko2018-04-07 11:33:13 +0200
commit00e8bc1945ee0727bb77a8e48f8a20edb0619068 (patch)
tree75c840d7055ecad6ca9768ae48f0cc46494ded75
parent6e661ab4850e282e135e97831236b1677d16c285 (diff)
downloadscummvm-rg350-00e8bc1945ee0727bb77a8e48f8a20edb0619068.tar.gz
scummvm-rg350-00e8bc1945ee0727bb77a8e48f8a20edb0619068.tar.bz2
scummvm-rg350-00e8bc1945ee0727bb77a8e48f8a20edb0619068.zip
PLUMBERS: Optimized heap allocation
No sense in deleting and then allocating an object again because loadStream method destroy previous data.
-rw-r--r--engines/plumbers/plumbers.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/engines/plumbers/plumbers.cpp b/engines/plumbers/plumbers.cpp
index 3821170651..5491f81c65 100644
--- a/engines/plumbers/plumbers.cpp
+++ b/engines/plumbers/plumbers.cpp
@@ -90,6 +90,7 @@ static const byte cursorPalette[] = {
Common::Error PlumbersGame::run() {
initGraphics(640, 480);
_console = new Console();
+ _image = new Image::BitmapDecoder();
CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
@@ -182,9 +183,6 @@ void PlumbersGame::loadImage(const Common::String &dirname, const Common::String
if (!file.open(name))
error("unable to load image %s", name.c_str());
- delete _image;
-
- _image = new Image::BitmapDecoder();
_image->loadStream(file);
}