2014-10-08 15:17:31 +00:00
|
|
|
#include "land.hpp"
|
|
|
|
|
|
|
|
#include <sstream>
|
2017-09-04 23:31:09 +00:00
|
|
|
#include <stdexcept>
|
2014-10-08 15:17:31 +00:00
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
2015-07-21 17:25:43 +00:00
|
|
|
void Land::load(ESM::ESMReader &esm, bool &isDeleted)
|
2014-10-08 15:17:31 +00:00
|
|
|
{
|
2015-11-13 00:34:36 +00:00
|
|
|
ESM::Land::load(esm, isDeleted);
|
2017-09-04 05:06:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string Land::createUniqueRecordId(int x, int y)
|
|
|
|
{
|
2014-10-08 15:17:31 +00:00
|
|
|
std::ostringstream stream;
|
2017-09-04 05:06:58 +00:00
|
|
|
stream << "#" << x << " " << y;
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Land::parseUniqueRecordId(const std::string& id, int& x, int& y)
|
|
|
|
{
|
|
|
|
size_t mid = id.find(' ');
|
|
|
|
|
|
|
|
if (mid == std::string::npos || id[0] != '#')
|
|
|
|
throw std::runtime_error("Invalid Land ID");
|
|
|
|
|
|
|
|
x = std::stoi(id.substr(1, mid - 1));
|
|
|
|
y = std::stoi(id.substr(mid + 1));
|
2014-10-08 15:17:31 +00:00
|
|
|
}
|
|
|
|
}
|