mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Tools/MeshExtractor: Added some stuff to make the switch to C++11 easier
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user