2014-10-08 15:17:31 +00:00
|
|
|
#include "landtexture.hpp"
|
|
|
|
|
2017-09-05 23:29:07 +00:00
|
|
|
#include <sstream>
|
2017-09-04 23:31:09 +00:00
|
|
|
#include <stdexcept>
|
2017-08-25 23:51:30 +00:00
|
|
|
|
2014-10-08 15:17:31 +00:00
|
|
|
#include <components/esm/esmreader.hpp>
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
2015-07-21 17:25:43 +00:00
|
|
|
void LandTexture::load(ESM::ESMReader &esm, bool &isDeleted)
|
2014-10-08 15:17:31 +00:00
|
|
|
{
|
2015-07-21 17:25:43 +00:00
|
|
|
ESM::LandTexture::load(esm, isDeleted);
|
2014-10-08 15:17:31 +00:00
|
|
|
|
2015-08-22 11:10:54 +00:00
|
|
|
mPluginIndex = esm.getIndex();
|
2014-10-08 15:17:31 +00:00
|
|
|
}
|
|
|
|
|
2017-08-25 23:51:30 +00:00
|
|
|
std::string LandTexture::createUniqueRecordId(int plugin, int index)
|
|
|
|
{
|
2017-09-05 23:29:07 +00:00
|
|
|
std::stringstream ss;
|
|
|
|
ss << 'L' << plugin << '#' << index;
|
|
|
|
return ss.str();
|
2017-08-25 23:51:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LandTexture::parseUniqueRecordId(const std::string& id, int& plugin, int& index)
|
|
|
|
{
|
|
|
|
size_t middle = id.find('#');
|
|
|
|
|
|
|
|
if (middle == std::string::npos || id[0] != 'L')
|
|
|
|
throw std::runtime_error("Invalid LandTexture ID");
|
|
|
|
|
|
|
|
plugin = std::stoi(id.substr(1,middle-1));
|
|
|
|
index = std::stoi(id.substr(middle+1));
|
|
|
|
}
|
2014-10-08 15:17:31 +00:00
|
|
|
}
|