Skip to content

Commit

Permalink
KOTOR2: Use ScopedPtr in Room
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent ea05497 commit 4c240d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/engines/kotor2/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ namespace Engines {

namespace KotOR2 {

Room::Room(const Common::UString &resRef, float x, float y, float z) : _model(0) {
Room::Room(const Common::UString &resRef, float x, float y, float z) {
load(resRef, x, y, z);
}

Room::~Room() {
delete _model;
}

void Room::load(const Common::UString &resRef, float x, float y, float z) {
if (resRef == "****")
return;

_model = loadModelObject(resRef);
_model.reset(loadModelObject(resRef));
if (!_model)
throw Common::Exception("Can't load room model \"%s\"", resRef.c_str());

Expand Down
4 changes: 3 additions & 1 deletion src/engines/kotor2/room.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_KOTOR2_ROOM_H
#define ENGINES_KOTOR2_ROOM_H

#include "src/common/scopedptr.h"

#include "src/graphics/aurora/types.h"

namespace Common {
Expand All @@ -44,7 +46,7 @@ class Room {
void hide();

private:
Graphics::Aurora::Model *_model;
Common::ScopedPtr<Graphics::Aurora::Model> _model;

void load(const Common::UString &resRef, float x, float y, float z);
};
Expand Down

0 comments on commit 4c240d0

Please sign in to comment.