Skip to content

Commit

Permalink
NWN: Use ScopedPtr in the options GUI classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent e60679b commit c5d0053
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
6 changes: 2 additions & 4 deletions src/engines/nwn/gui/options/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ OptionsGameMenu::OptionsGameMenu(bool isMain, ::Engines::Console *console) : GUI
// TODO: Violence level
getWidget("ViolenceSlider", true)->setDisabled(true);

_gorepass = new OptionsGorePasswordMenu(isMain, _console);
_feedback = new OptionsFeedbackMenu (isMain, _console);
_gorepass.reset(new OptionsGorePasswordMenu(isMain, _console));
_feedback.reset(new OptionsFeedbackMenu (isMain, _console));
}

OptionsGameMenu::~OptionsGameMenu() {
delete _feedback;
delete _gorepass;
}

void OptionsGameMenu::show() {
Expand Down
6 changes: 4 additions & 2 deletions src/engines/nwn/gui/options/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_NWN_GUI_OPTIONS_GAME_H
#define ENGINES_NWN_GUI_OPTIONS_GAME_H

#include "src/common/scopedptr.h"

#include "src/engines/nwn/gui/gui.h"

namespace Engines {
Expand All @@ -48,8 +50,8 @@ class OptionsGameMenu : public GUI {
private:
int _difficulty;

GUI *_gorepass;
GUI *_feedback;
Common::ScopedPtr<GUI> _gorepass;
Common::ScopedPtr<GUI> _feedback;

void updateDifficulty(int difficulty);

Expand Down
3 changes: 1 addition & 2 deletions src/engines/nwn/gui/options/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ OptionsSoundMenu::OptionsSoundMenu(bool isMain, ::Engines::Console *console) : G
if (soundHeadphones)
soundHeadphones->setDisabled(true);

_advanced = new OptionsSoundAdvancedMenu(isMain, _console);
_advanced.reset(new OptionsSoundAdvancedMenu(isMain, _console));
}

void OptionsSoundMenu::show() {
Expand All @@ -102,7 +102,6 @@ void OptionsSoundMenu::show() {
}

OptionsSoundMenu::~OptionsSoundMenu() {
delete _advanced;
}

void OptionsSoundMenu::initWidget(Widget &widget) {
Expand Down
4 changes: 3 additions & 1 deletion src/engines/nwn/gui/options/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_NWN_GUI_OPTIONS_SOUND_H
#define ENGINES_NWN_GUI_OPTIONS_SOUND_H

#include "src/common/scopedptr.h"

#include "src/sound/types.h"

#include "src/engines/nwn/gui/gui.h"
Expand All @@ -46,7 +48,7 @@ class OptionsSoundMenu : public GUI {
void callbackActive(Widget &widget);

private:
GUI *_advanced;
Common::ScopedPtr<GUI> _advanced;

double _volMusic;
double _volSFX;
Expand Down
6 changes: 2 additions & 4 deletions src/engines/nwn/gui/options/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ OptionsVideoMenu::OptionsVideoMenu(bool isMain, ::Engines::Console *console) : G
// TODO: Creature shadows
getWidget("ShadowSlider", true)->setDisabled(true);

_resolution = new OptionsResolutionMenu (isMain, _console);
_advanced = new OptionsVideoAdvancedMenu(isMain, _console);
_resolution.reset(new OptionsResolutionMenu (isMain, _console));
_advanced.reset (new OptionsVideoAdvancedMenu(isMain, _console));
}

OptionsVideoMenu::~OptionsVideoMenu() {
delete _advanced;
delete _resolution;
}

void OptionsVideoMenu::show() {
Expand Down
6 changes: 4 additions & 2 deletions src/engines/nwn/gui/options/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_NWN_GUI_OPTIONS_VIDEO_H
#define ENGINES_NWN_GUI_OPTIONS_VIDEO_H

#include "src/common/scopedptr.h"

#include "src/engines/nwn/gui/gui.h"

namespace Engines {
Expand All @@ -44,8 +46,8 @@ class OptionsVideoMenu : public GUI {
void callbackActive(Widget &widget);

private:
GUI *_resolution;
GUI *_advanced;
Common::ScopedPtr<GUI> _resolution;
Common::ScopedPtr<GUI> _advanced;

float _gamma;

Expand Down

0 comments on commit c5d0053

Please sign in to comment.