PLUMBERS: Optimized heap allocation

No sense in deleting and then allocating an object again because loadStream method destroy previous data.
This commit is contained in:
whitertandrek 2018-03-14 08:43:06 +02:00 committed by Eugene Sandulenko
parent 6e661ab485
commit 00e8bc1945

View file

@ -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);
}