2014-02-10 14:00:14 +01:00
|
|
|
//////////////////////////////////
|
|
|
|
// Created by Sam Svensson 2013 //
|
|
|
|
//////////////////////////////////
|
|
|
|
|
|
|
|
#include "LevelLoader.h"
|
|
|
|
#include "LevelParser.h"
|
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
using namespace GameLogic::LevelFileLoader;
|
|
|
|
|
|
|
|
struct LevelLoader::PrivData
|
|
|
|
{
|
|
|
|
LevelParser parser;
|
|
|
|
std::string folderPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
LevelLoader::LevelLoader()
|
|
|
|
: pData(new PrivData)
|
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
//standard path
|
|
|
|
pData->folderPath = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
LevelLoader::LevelLoader(std::string folderPath)
|
|
|
|
: pData(new PrivData)
|
|
|
|
{
|
|
|
|
pData->folderPath = folderPath;
|
2014-02-10 14:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
LevelLoader::~LevelLoader()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LevelLoader::LoadLevel(std::string fileName)
|
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
return pData->parser.Parse(pData->folderPath + fileName);
|
2014-02-10 14:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
LevelMetaData LevelLoader::LoadLevelHeader(std::string fileName)
|
|
|
|
{
|
2014-02-12 14:48:58 +01:00
|
|
|
return pData->parser.ParseHeader(pData->folderPath + fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string LevelLoader::GetFolderPath()
|
|
|
|
{
|
|
|
|
return this->pData->folderPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LevelLoader::SetFolderPath(std::string folderPath)
|
|
|
|
{
|
2014-02-19 11:38:36 +01:00
|
|
|
this->pData->folderPath = folderPath;
|
2014-02-10 14:00:14 +01:00
|
|
|
}
|