Skip to content

Commit

Permalink
NWN: Use ScopedPtr for the legal billboard
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent 5eab3c4 commit 4ced301
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
27 changes: 6 additions & 21 deletions src/engines/nwn/gui/legal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,14 @@ class FadeModel : public Graphics::Aurora::Model_NWN {
};


static FadeModel *createFade(const Common::UString &name) {
FadeModel *model = 0;

try {
model = new FadeModel(name);
} catch (...) {
delete model;
throw;
}

return model;
}


Legal::Legal() : _billboard(0) {
_billboard = createFade("load_legal");
Legal::Legal() {
_billboard.reset(new FadeModel("load_legal"));

_billboard->setPosition(0.0f, 0.0f, -1000.0f);
_billboard->setTag("Legal");
}

Legal::~Legal() {
delete _billboard;
}

void Legal::fadeIn() {
Expand All @@ -167,8 +152,8 @@ void Legal::fadeIn() {
}

if (abort || EventMan.quitRequested()) {
delete _billboard;
_billboard = 0;
_billboard->hide();
_billboard.reset();
}
}

Expand Down Expand Up @@ -199,8 +184,8 @@ void Legal::show() {
break;
}

delete _billboard;
_billboard = 0;
_billboard->hide();
_billboard.reset();
}

} // End of namespace NWN
Expand Down
4 changes: 3 additions & 1 deletion src/engines/nwn/gui/legal.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_NWN_GUI_LEGAL_H
#define ENGINES_NWN_GUI_LEGAL_H

#include "src/common/scopedptr.h"

namespace Engines {

namespace NWN {
Expand All @@ -41,7 +43,7 @@ class Legal {
void show();

private:
FadeModel *_billboard;
Common::ScopedPtr<FadeModel> _billboard;
};

} // End of namespace NWN
Expand Down

0 comments on commit 4ced301

Please sign in to comment.