mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-27 06:14:09 +00:00
Keep things coherent between references and and cell table
This commit is contained in:
parent
69f2285a95
commit
3bbf60373a
@ -6,11 +6,5 @@ void CSMWorld::Cell::load(ESM::ESMReader& esm, bool& isDeleted)
|
||||
{
|
||||
ESM::Cell::load(esm, isDeleted, false);
|
||||
|
||||
mId = ESM::RefId::stringRefId(mName);
|
||||
if (isExterior())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "#" << mData.mX << " " << mData.mY;
|
||||
mId = ESM::RefId::stringRefId(stream.str());
|
||||
}
|
||||
mId = ESM::RefId::stringRefId(ESM::Cell::mId.toString());
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ namespace CSMWorld
|
||||
|
||||
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
|
||||
|
@ -256,9 +256,9 @@ namespace ESM
|
||||
{ RefId::index(REC_ARMO, 42), "ARMO:0x2a" },
|
||||
{ RefId::esm3ExteriorCell(-13, 42), "-13:42" },
|
||||
{ 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()),
|
||||
"2147483647:2147483647" },
|
||||
"#2147483647 2147483647" },
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(ESMRefIdToString, ESMRefIdToStringTest, ValuesIn(toStringParams));
|
||||
|
@ -11,9 +11,10 @@ namespace ESM
|
||||
{
|
||||
constexpr std::size_t separator = 1;
|
||||
std::string result;
|
||||
result.resize(getDecIntegralCapacity(mX) + separator + getDecIntegralCapacity(mY), '\0');
|
||||
const std::size_t endX = serializeDecIntegral(mX, 0, result);
|
||||
result[endX] = ':';
|
||||
result.resize(separator + getDecIntegralCapacity(mX) + separator + getDecIntegralCapacity(mY), '\0');
|
||||
result[0] = '#';
|
||||
const std::size_t endX = serializeDecIntegral(mX, separator, result);
|
||||
result[endX] = ' ';
|
||||
const std::size_t endY = serializeDecIntegral(mY, endX + separator, result);
|
||||
result.resize(endY);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user