mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 02:45:32 +00:00
Do not store object position, if it is the same as in CellRef
This commit is contained in:
parent
3b1c717ab9
commit
75e7a3e8b1
3 changed files with 23 additions and 2 deletions
|
@ -57,6 +57,26 @@ struct Position
|
|||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
bool inline operator== (const Position& left, const Position& right) noexcept
|
||||
{
|
||||
return left.pos[0] == right.pos[0] &&
|
||||
left.pos[1] == right.pos[1] &&
|
||||
left.pos[2] == right.pos[2] &&
|
||||
left.rot[0] == right.rot[0] &&
|
||||
left.rot[1] == right.rot[1] &&
|
||||
left.rot[2] == right.rot[2];
|
||||
}
|
||||
|
||||
bool inline operator!= (const Position& left, const Position& right) noexcept
|
||||
{
|
||||
return left.pos[0] != right.pos[0] ||
|
||||
left.pos[1] != right.pos[1] ||
|
||||
left.pos[2] != right.pos[2] ||
|
||||
left.rot[0] != right.rot[0] ||
|
||||
left.rot[1] != right.rot[1] ||
|
||||
left.rot[2] != right.rot[2];
|
||||
}
|
||||
|
||||
template <int a, int b, int c, int d>
|
||||
struct FourCC
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ void ESM::ObjectState::load (ESMReader &esm)
|
|||
mCount = 1;
|
||||
esm.getHNOT (mCount, "COUN");
|
||||
|
||||
mPosition = mRef.mPos;
|
||||
esm.getHNOT (mPosition, "POS_", 24);
|
||||
|
||||
if (esm.isNextSub("LROT"))
|
||||
|
@ -61,7 +62,7 @@ void ESM::ObjectState::save (ESMWriter &esm, bool inInventory) const
|
|||
if (mCount!=1)
|
||||
esm.writeHNT ("COUN", mCount);
|
||||
|
||||
if (!inInventory)
|
||||
if (!inInventory && mPosition != mRef.mPos)
|
||||
esm.writeHNT ("POS_", mPosition, 24);
|
||||
|
||||
if (mFlags != 0)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "esmwriter.hpp"
|
||||
|
||||
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
||||
int ESM::SavedGame::sCurrentFormat = 11;
|
||||
int ESM::SavedGame::sCurrentFormat = 12;
|
||||
|
||||
void ESM::SavedGame::load (ESMReader &esm)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue