1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 19:23:52 +00:00
openmw/apps/opencs/model/world/land.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
754 B
C++
Raw Normal View History

#include "land.hpp"
#include <sstream>
2022-10-19 17:02:00 +00:00
#include <stddef.h>
2017-09-04 23:31:09 +00:00
#include <stdexcept>
2022-10-19 17:02:00 +00:00
namespace ESM
{
class ESMReader;
}
namespace CSMWorld
{
void Land::load(ESM::ESMReader& esm, bool& isDeleted)
{
ESM::Land::load(esm, isDeleted);
2017-09-04 05:06:58 +00:00
}
std::string Land::createUniqueRecordId(int x, int y)
{
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));
}
}