1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Clamp fallback value from config

This commit is contained in:
Andrei Kortunov 2019-11-13 15:02:14 +04:00
parent 079c77ff22
commit 5c6ca82c45

View File

@ -528,6 +528,8 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
// Add animated textures
std::vector<osg::ref_ptr<osg::Texture2D> > textures;
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
frameCount = std::min(std::max(frameCount, 0), 320);
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
for (int i=0; i<frameCount; ++i)
{
@ -644,6 +646,8 @@ Water::~Water()
void Water::listAssetsToPreload(std::vector<std::string> &textures)
{
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
frameCount = std::min(std::max(frameCount, 0), 320);
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
for (int i=0; i<frameCount; ++i)
{