mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-18 01:11:36 +00:00
Keep things coherent between references and and cell table
This commit is contained in:
parent
69f2285a95
commit
3bbf60373a
4 changed files with 8 additions and 13 deletions
|
@ -6,11 +6,5 @@ void CSMWorld::Cell::load(ESM::ESMReader& esm, bool& isDeleted)
|
||||||
{
|
{
|
||||||
ESM::Cell::load(esm, isDeleted, false);
|
ESM::Cell::load(esm, isDeleted, false);
|
||||||
|
|
||||||
mId = ESM::RefId::stringRefId(mName);
|
mId = ESM::RefId::stringRefId(ESM::Cell::mId.toString());
|
||||||
if (isExterior())
|
|
||||||
{
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << "#" << mData.mX << " " << mData.mY;
|
|
||||||
mId = ESM::RefId::stringRefId(stream.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -869,7 +869,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant get(const Record<ESXRecordT>& record) const override
|
QVariant get(const Record<ESXRecordT>& record) const override
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(record.get().mCell.serializeText().c_str());
|
return QString::fromUtf8(record.get().mCell.toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(Record<ESXRecordT>& record, const QVariant& data) override
|
void set(Record<ESXRecordT>& record, const QVariant& data) override
|
||||||
|
|
|
@ -256,9 +256,9 @@ namespace ESM
|
||||||
{ RefId::index(REC_ARMO, 42), "ARMO:0x2a" },
|
{ RefId::index(REC_ARMO, 42), "ARMO:0x2a" },
|
||||||
{ RefId::esm3ExteriorCell(-13, 42), "-13:42" },
|
{ RefId::esm3ExteriorCell(-13, 42), "-13:42" },
|
||||||
{ RefId::esm3ExteriorCell(std::numeric_limits<int>::min(), std::numeric_limits<int>::min()),
|
{ RefId::esm3ExteriorCell(std::numeric_limits<int>::min(), std::numeric_limits<int>::min()),
|
||||||
"-2147483648:-2147483648" },
|
"#2147483648 -2147483648" },
|
||||||
{ RefId::esm3ExteriorCell(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()),
|
{ RefId::esm3ExteriorCell(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()),
|
||||||
"2147483647:2147483647" },
|
"#2147483647 2147483647" },
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(ESMRefIdToString, ESMRefIdToStringTest, ValuesIn(toStringParams));
|
INSTANTIATE_TEST_SUITE_P(ESMRefIdToString, ESMRefIdToStringTest, ValuesIn(toStringParams));
|
||||||
|
|
|
@ -11,9 +11,10 @@ namespace ESM
|
||||||
{
|
{
|
||||||
constexpr std::size_t separator = 1;
|
constexpr std::size_t separator = 1;
|
||||||
std::string result;
|
std::string result;
|
||||||
result.resize(getDecIntegralCapacity(mX) + separator + getDecIntegralCapacity(mY), '\0');
|
result.resize(separator + getDecIntegralCapacity(mX) + separator + getDecIntegralCapacity(mY), '\0');
|
||||||
const std::size_t endX = serializeDecIntegral(mX, 0, result);
|
result[0] = '#';
|
||||||
result[endX] = ':';
|
const std::size_t endX = serializeDecIntegral(mX, separator, result);
|
||||||
|
result[endX] = ' ';
|
||||||
const std::size_t endY = serializeDecIntegral(mY, endX + separator, result);
|
const std::size_t endY = serializeDecIntegral(mY, endX + separator, result);
|
||||||
result.resize(endY);
|
result.resize(endY);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue