1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 09:23:52 +00:00

Fix ESM::Land oversights

This commit is contained in:
Capostrophic 2020-04-04 16:39:32 +03:00
parent 02d7b13075
commit 27d4fe9ee1

View file

@ -75,6 +75,8 @@ namespace ESM
mContext = esm.getContext(); mContext = esm.getContext();
mLandData = nullptr; mLandData = nullptr;
for (int i = 0; i < LAND_GLOBAL_MAP_LOD_SIZE; ++i)
mWnam[i] = 0;
// Skip the land data here. Load it when the cell is loaded. // Skip the land data here. Load it when the cell is loaded.
while (esm.hasMoreSubs()) while (esm.hasMoreSubs())
@ -156,8 +158,6 @@ namespace ESM
} }
esm.writeHNT("VHGT", offsets, sizeof(VHGT)); esm.writeHNT("VHGT", offsets, sizeof(VHGT));
} }
}
if (mDataTypes & Land::DATA_WNAM) if (mDataTypes & Land::DATA_WNAM)
{ {
// Generate WNAM record // Generate WNAM record
@ -177,9 +177,6 @@ namespace ESM
} }
esm.writeHNT("WNAM", wnam); esm.writeHNT("WNAM", wnam);
} }
if (mLandData)
{
if (mDataTypes & Land::DATA_VCLR) { if (mDataTypes & Land::DATA_VCLR) {
esm.writeHNT("VCLR", mLandData->mColours); esm.writeHNT("VCLR", mLandData->mColours);
} }
@ -197,7 +194,7 @@ namespace ESM
mPlugin = 0; mPlugin = 0;
for (int i = 0; i < LAND_GLOBAL_MAP_LOD_SIZE; ++i) for (int i = 0; i < LAND_GLOBAL_MAP_LOD_SIZE; ++i)
mWnam[0] = 0; mWnam[i] = 0;
if (!mLandData) if (!mLandData)
mLandData = new LandData; mLandData = new LandData;
@ -338,7 +335,7 @@ namespace ESM
Land::Land (const Land& land) Land::Land (const Land& land)
: mFlags (land.mFlags), mX (land.mX), mY (land.mY), mPlugin (land.mPlugin), : mFlags (land.mFlags), mX (land.mX), mY (land.mY), mPlugin (land.mPlugin),
mContext (land.mContext), mDataTypes (land.mDataTypes), mContext (land.mContext), mDataTypes (land.mDataTypes),
mLandData (land.mLandData ? new LandData (*land.mLandData) : 0) mLandData (land.mLandData ? new LandData (*land.mLandData) : nullptr)
{ {
std::copy(land.mWnam, land.mWnam + LAND_GLOBAL_MAP_LOD_SIZE, mWnam); std::copy(land.mWnam, land.mWnam + LAND_GLOBAL_MAP_LOD_SIZE, mWnam);
} }
@ -364,7 +361,7 @@ namespace ESM
const Land::LandData *Land::getLandData (int flags) const const Land::LandData *Land::getLandData (int flags) const
{ {
if (!(flags & mDataTypes)) if (!(flags & mDataTypes))
return 0; return nullptr;
loadData (flags); loadData (flags);
return mLandData; return mLandData;
@ -400,7 +397,7 @@ namespace ESM
if (!mLandData->mDataLoaded) if (!mLandData->mDataLoaded)
{ {
delete mLandData; delete mLandData;
mLandData = 0; mLandData = nullptr;
} }
} }
} }