1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 03:23:54 +00:00
openmw/apps/opencs/model/world/land.cpp
2022-10-31 21:04:01 +01:00

36 lines
754 B
C++

#include "land.hpp"
#include <sstream>
#include <stddef.h>
#include <stdexcept>
namespace ESM
{
class ESMReader;
}
namespace CSMWorld
{
void Land::load(ESM::ESMReader& esm, bool& isDeleted)
{
ESM::Land::load(esm, isDeleted);
}
std::string Land::createUniqueRecordId(int x, int y)
{
std::ostringstream stream;
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));
}
}