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:
parent
6e661ab485
commit
00e8bc1945
1 changed files with 1 additions and 3 deletions
|
@ -90,6 +90,7 @@ static const byte cursorPalette[] = {
|
||||||
Common::Error PlumbersGame::run() {
|
Common::Error PlumbersGame::run() {
|
||||||
initGraphics(640, 480);
|
initGraphics(640, 480);
|
||||||
_console = new Console();
|
_console = new Console();
|
||||||
|
_image = new Image::BitmapDecoder();
|
||||||
|
|
||||||
CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
|
CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
|
||||||
CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
|
CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
|
||||||
|
@ -182,9 +183,6 @@ void PlumbersGame::loadImage(const Common::String &dirname, const Common::String
|
||||||
if (!file.open(name))
|
if (!file.open(name))
|
||||||
error("unable to load image %s", name.c_str());
|
error("unable to load image %s", name.c_str());
|
||||||
|
|
||||||
delete _image;
|
|
||||||
|
|
||||||
_image = new Image::BitmapDecoder();
|
|
||||||
_image->loadStream(file);
|
_image->loadStream(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue