Tools/MeshExtractor: Added some stuff to make the switch to C++11 easier

This commit is contained in:
Subv
2013-12-29 21:02:15 -05:00
parent 8cc77ff1fd
commit b89585e843
3 changed files with 27 additions and 3 deletions

View File

@@ -28,6 +28,24 @@ WorldModelGroup::WorldModelGroup(std::string path, int groupIndex) : GroupIndex(
IsBad = true;
return;
}
Load(path);
}
WorldModelGroup::WorldModelGroup(Stream* stream, std::string path, int groupIndex)
{
Data = new ChunkedData(stream, stream->GetSize());
Load(path);
}
WorldModelGroup::~WorldModelGroup()
{
delete Data;
delete SubData;
delete[] MOBA;
}
void WorldModelGroup::Load(std::string& path)
{
Chunk* mainChunk = Data->GetChunkByName("MOGP");
int32 firstSub = mainChunk->FindSubChunkOffset("MOPY");
if (firstSub == -1)

View File

@@ -24,6 +24,10 @@ class WorldModelGroup
{
public:
WorldModelGroup(std::string path, int groupIndex);
WorldModelGroup(Stream* stream, std::string path, int groupIndex);
~WorldModelGroup();
void Load(std::string& path);
ChunkedData* Data;
ChunkedData* SubData;
int GroupIndex;

View File

@@ -18,6 +18,7 @@
#include "WorldModelRoot.h"
#include "ChunkedData.h"
#include "Utils.h"
#include "MPQManager.h"
WorldModelRoot::WorldModelRoot( std::string path )
{
@@ -42,9 +43,10 @@ void WorldModelRoot::ReadGroups()
{
char name[200];
sprintf(name, "%s_%03u.wmo", pathBase.c_str(), i);
WorldModelGroup group(name, i);
if (!group.IsBad)
Groups.push_back(group);
Stream* stream = MPQHandler->GetFile(name);
if (!stream)
continue;
Groups.emplace_back(WorldModelGroup(stream, name, i)); // @ToDo: Use the real signature of emplace_back with variadic templates once we make the full switch to C++11 (At least Visual Studio 2012)
}
}