Skip to content

Commit

Permalink
KOTOR2: Use loadOptionalGFF3() when looking for object blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent ec01e77 commit 4958ce0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
9 changes: 3 additions & 6 deletions src/engines/kotor2/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "src/graphics/aurora/modelnode.h"
#include "src/graphics/aurora/model.h"

#include "src/engines/aurora/util.h"
#include "src/engines/aurora/model.h"

#include "src/engines/kotor2/creature.h"
Expand Down Expand Up @@ -94,12 +95,8 @@ void Creature::load(const Aurora::GFF3Struct &creature) {
Common::UString temp = creature.getString("TemplateResRef");

Common::ScopedPtr<Aurora::GFF3File> utc;
if (!temp.empty()) {
try {
utc.reset(new Aurora::GFF3File(temp, Aurora::kFileTypeUTC, MKTAG('U', 'T', 'C', ' ')));
} catch (...) {
}
}
if (!temp.empty())
utc.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTC, MKTAG('U', 'T', 'C', ' ')));

load(creature, utc ? &utc->getTopLevel() : 0);

Expand Down
10 changes: 4 additions & 6 deletions src/engines/kotor2/door.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

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

#include "src/engines/aurora/util.h"

#include "src/engines/kotor2/door.h"
#include "src/engines/kotor2/module.h"

Expand All @@ -53,12 +55,8 @@ void Door::load(const Aurora::GFF3Struct &door) {
Common::UString temp = door.getString("TemplateResRef");

Common::ScopedPtr<Aurora::GFF3File> utd;
if (!temp.empty()) {
try {
utd.reset(new Aurora::GFF3File(temp, Aurora::kFileTypeUTD, MKTAG('U', 'T', 'D', ' ')));
} catch (...) {
}
}
if (!temp.empty())
utd.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTD, MKTAG('U', 'T', 'D', ' ')));

Situated::load(door, utd ? &utd->getTopLevel() : 0);

Expand Down
10 changes: 4 additions & 6 deletions src/engines/kotor2/placeable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

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

#include "src/engines/aurora/util.h"

#include "src/engines/kotor2/placeable.h"

namespace Engines {
Expand All @@ -50,12 +52,8 @@ void Placeable::load(const Aurora::GFF3Struct &placeable) {
Common::UString temp = placeable.getString("TemplateResRef");

Common::ScopedPtr<Aurora::GFF3File> utp;
if (!temp.empty()) {
try {
utp.reset(new Aurora::GFF3File(temp, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' ')));
} catch (...) {
}
}
if (!temp.empty())
utp.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' ')));

Situated::load(placeable, utp ? &utp->getTopLevel() : 0);

Expand Down
10 changes: 4 additions & 6 deletions src/engines/kotor2/waypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "src/aurora/gff3file.h"

#include "src/engines/aurora/util.h"

#include "src/engines/kotor2/waypoint.h"

namespace Engines {
Expand All @@ -48,12 +50,8 @@ void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
Common::UString temp = waypoint.getString("TemplateResRef");

Common::ScopedPtr<Aurora::GFF3File> utw;
if (!temp.empty()) {
try {
utw.reset(new Aurora::GFF3File(temp, Aurora::kFileTypeUTW, MKTAG('U', 'T', 'W', ' ')));
} catch (...) {
}
}
if (!temp.empty())
utw.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTW, MKTAG('U', 'T', 'W', ' ')));

load(waypoint, utw ? &utw->getTopLevel() : 0);
}
Expand Down

0 comments on commit 4958ce0

Please sign in to comment.