1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-07 03:45:33 +00:00

Cleanup(CS): Improve readability and clean up some implementations

This commit is contained in:
Dave Corley 2023-12-12 00:14:48 -06:00
parent b12aa46aae
commit d9194fe481
4 changed files with 40 additions and 20 deletions

View file

@ -140,6 +140,7 @@
Bug #7676: Incorrect magic effect order in alchemy Bug #7676: Incorrect magic effect order in alchemy
Bug #7679: Scene luminance value flashes when toggling shaders Bug #7679: Scene luminance value flashes when toggling shaders
Bug #7685: Corky sometimes doesn't follow Llovyn Andus Bug #7685: Corky sometimes doesn't follow Llovyn Andus
Bug #7707: (OpenCS): New landscape records do not contain appropriate flags
Bug #7712: Casting doesn't support spells and enchantments with no effects Bug #7712: Casting doesn't support spells and enchantments with no effects
Bug #7721: CS: Special Chars Not Allowed in IDs Bug #7721: CS: Special Chars Not Allowed in IDs
Bug #7723: Assaulting vampires and werewolves shouldn't be a crime Bug #7723: Assaulting vampires and werewolves shouldn't be a crime

View file

@ -1,7 +1,6 @@
#include "cell.hpp" #include "cell.hpp"
#include <algorithm> #include <algorithm>
#include <qundostack.h>
#include <set> #include <set>
#include <utility> #include <utility>
@ -147,9 +146,6 @@ void CSVRender::Cell::updateLand()
const ESM::Land& esmLand = land.getRecord(mId).get(); const ESM::Land& esmLand = land.getRecord(mId).get();
if (!esmLand.getLandData(ESM::Land::DATA_VHGT))
mTerrainStorage->resetHeights();
if (mTerrain) if (mTerrain)
{ {
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY()); mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());

View file

@ -47,9 +47,6 @@ void CSVRender::CellBorder::buildShape(const ESM::Land& esmLand)
{ {
const ESM::Land::LandData* landData = esmLand.getLandData(ESM::Land::DATA_VHGT); const ESM::Land::LandData* landData = esmLand.getLandData(ESM::Land::DATA_VHGT);
if (!landData)
return;
mBaseNode->removeChild(mBorderGeometry); mBaseNode->removeChild(mBorderGeometry);
mBorderGeometry = new osg::Geometry(); mBorderGeometry = new osg::Geometry();
@ -62,20 +59,40 @@ void CSVRender::CellBorder::buildShape(const ESM::Land& esmLand)
Traverse the cell border counter-clockwise starting at the SW corner vertex (0, 0). Traverse the cell border counter-clockwise starting at the SW corner vertex (0, 0).
Each loop starts at a corner vertex and ends right before the next corner vertex. Each loop starts at a corner vertex and ends right before the next corner vertex.
*/ */
for (; x < ESM::Land::LAND_SIZE - 1; ++x) if (landData)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)])); {
for (; x < ESM::Land::LAND_SIZE - 1; ++x)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
x = ESM::Land::LAND_SIZE - 1; x = ESM::Land::LAND_SIZE - 1;
for (; y < ESM::Land::LAND_SIZE - 1; ++y) for (; y < ESM::Land::LAND_SIZE - 1; ++y)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)])); vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
y = ESM::Land::LAND_SIZE - 1; y = ESM::Land::LAND_SIZE - 1;
for (; x > 0; --x) for (; x > 0; --x)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)])); vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
x = 0; x = 0;
for (; y > 0; --y) for (; y > 0; --y)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)])); vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
}
else
{
for (; x < ESM::Land::LAND_SIZE - 1; ++x)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), ESM::Land::DEFAULT_HEIGHT));
x = ESM::Land::LAND_SIZE - 1;
for (; y < ESM::Land::LAND_SIZE - 1; ++y)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), ESM::Land::DEFAULT_HEIGHT));
y = ESM::Land::LAND_SIZE - 1;
for (; x > 0; --x)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), ESM::Land::DEFAULT_HEIGHT));
x = 0;
for (; y > 0; --y)
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), ESM::Land::DEFAULT_HEIGHT));
}
mBorderGeometry->setVertexArray(vertices); mBorderGeometry->setVertexArray(vertices);

View file

@ -125,10 +125,16 @@ namespace ESM
const LandData* getLandData(int flags) const; const LandData* getLandData(int flags) const;
/// Return land data without loading first anything. Can return a 0-pointer. /// Return land data without loading first anything. Can return a 0-pointer.
const LandData* getLandData() const { return mLandData.get(); } const LandData* getLandData() const
{
return mLandData.get();
}
/// Return land data without loading first anything. Can return a 0-pointer. /// Return land data without loading first anything. Can return a 0-pointer.
LandData* getLandData() { return mLandData.get(); } LandData* getLandData()
{
return mLandData.get();
}
/// \attention Must not be called on objects that aren't fully loaded. /// \attention Must not be called on objects that aren't fully loaded.
/// ///