mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-07 03:15:34 +00:00
Cleanup(CS): Improve readability and clean up some implementations
This commit is contained in:
parent
b12aa46aae
commit
d9194fe481
4 changed files with 40 additions and 20 deletions
|
@ -140,6 +140,7 @@
|
|||
Bug #7676: Incorrect magic effect order in alchemy
|
||||
Bug #7679: Scene luminance value flashes when toggling shaders
|
||||
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 #7721: CS: Special Chars Not Allowed in IDs
|
||||
Bug #7723: Assaulting vampires and werewolves shouldn't be a crime
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "cell.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <qundostack.h>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
|
@ -147,9 +146,6 @@ void CSVRender::Cell::updateLand()
|
|||
|
||||
const ESM::Land& esmLand = land.getRecord(mId).get();
|
||||
|
||||
if (!esmLand.getLandData(ESM::Land::DATA_VHGT))
|
||||
mTerrainStorage->resetHeights();
|
||||
|
||||
if (mTerrain)
|
||||
{
|
||||
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());
|
||||
|
|
|
@ -47,9 +47,6 @@ void CSVRender::CellBorder::buildShape(const ESM::Land& esmLand)
|
|||
{
|
||||
const ESM::Land::LandData* landData = esmLand.getLandData(ESM::Land::DATA_VHGT);
|
||||
|
||||
if (!landData)
|
||||
return;
|
||||
|
||||
mBaseNode->removeChild(mBorderGeometry);
|
||||
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).
|
||||
Each loop starts at a corner vertex and ends right before the next corner vertex.
|
||||
*/
|
||||
for (; x < ESM::Land::LAND_SIZE - 1; ++x)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
if (landData)
|
||||
{
|
||||
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;
|
||||
for (; y < ESM::Land::LAND_SIZE - 1; ++y)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
x = ESM::Land::LAND_SIZE - 1;
|
||||
for (; y < ESM::Land::LAND_SIZE - 1; ++y)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
|
||||
y = ESM::Land::LAND_SIZE - 1;
|
||||
for (; x > 0; --x)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
y = ESM::Land::LAND_SIZE - 1;
|
||||
for (; x > 0; --x)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
|
||||
x = 0;
|
||||
for (; y > 0; --y)
|
||||
vertices->push_back(osg::Vec3f(scaleToWorld(x), scaleToWorld(y), landData->mHeights[landIndex(x, y)]));
|
||||
x = 0;
|
||||
for (; y > 0; --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);
|
||||
|
||||
|
|
|
@ -125,10 +125,16 @@ namespace ESM
|
|||
const LandData* getLandData(int flags) const;
|
||||
|
||||
/// 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.
|
||||
LandData* getLandData() { return mLandData.get(); }
|
||||
LandData* getLandData()
|
||||
{
|
||||
return mLandData.get();
|
||||
}
|
||||
|
||||
/// \attention Must not be called on objects that aren't fully loaded.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue