2014-01-24 10:22:18 +01:00
|
|
|
//////////////////////////////////
|
|
|
|
// Created by Sam Svensson 2013 //
|
|
|
|
//////////////////////////////////
|
|
|
|
|
|
|
|
#include "LevelLoader.h"
|
2014-02-03 14:50:15 +01:00
|
|
|
#include "LevelParser.h"
|
2014-02-05 15:46:45 +01:00
|
|
|
|
2014-01-24 10:22:18 +01:00
|
|
|
using namespace GameLogic;
|
2014-01-24 10:42:19 +01:00
|
|
|
using namespace GameLogic::LevelFileLoader;
|
|
|
|
|
2014-02-03 14:50:15 +01:00
|
|
|
struct LevelLoader::PrivData
|
|
|
|
{
|
|
|
|
LevelParser parser;
|
2014-02-18 21:24:21 +01:00
|
|
|
std::wstring folderPath;
|
2014-02-03 14:50:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
LevelLoader::LevelLoader()
|
|
|
|
: pData(new PrivData)
|
|
|
|
{
|
2014-02-10 16:24:05 +01:00
|
|
|
//standard path
|
2014-02-18 21:24:21 +01:00
|
|
|
pData->folderPath = L"";
|
2014-02-10 16:24:05 +01:00
|
|
|
}
|
|
|
|
|
2014-02-18 21:24:21 +01:00
|
|
|
LevelLoader::LevelLoader(std::wstring folderPath)
|
2014-02-10 16:24:05 +01:00
|
|
|
: pData(new PrivData)
|
|
|
|
{
|
|
|
|
pData->folderPath = folderPath;
|
2014-02-03 14:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
LevelLoader::~LevelLoader()
|
|
|
|
{
|
|
|
|
}
|
2014-01-24 10:22:18 +01:00
|
|
|
|
2014-02-18 21:24:21 +01:00
|
|
|
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LevelLoader::LoadLevel(std::wstring fileName)
|
2014-01-24 10:22:18 +01:00
|
|
|
{
|
2014-02-10 16:24:05 +01:00
|
|
|
return pData->parser.Parse(pData->folderPath + fileName);
|
2014-01-24 10:22:18 +01:00
|
|
|
}
|
|
|
|
|
2014-02-18 21:24:21 +01:00
|
|
|
LevelMetaData LevelLoader::LoadLevelHeader(std::wstring fileName)
|
2014-01-24 10:22:18 +01:00
|
|
|
{
|
2014-02-10 16:24:05 +01:00
|
|
|
return pData->parser.ParseHeader(pData->folderPath + fileName);
|
|
|
|
}
|
|
|
|
|
2014-02-18 21:24:21 +01:00
|
|
|
std::wstring LevelLoader::GetFolderPath()
|
2014-02-10 16:24:05 +01:00
|
|
|
{
|
|
|
|
return this->pData->folderPath;
|
|
|
|
}
|
|
|
|
|
2014-02-18 21:24:21 +01:00
|
|
|
void LevelLoader::SetFolderPath(std::wstring folderPath)
|
2014-02-10 16:24:05 +01:00
|
|
|
{
|
2014-02-18 21:24:21 +01:00
|
|
|
this->pData->folderPath = folderPath;
|
2014-01-24 10:22:18 +01:00
|
|
|
}
|