1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 14:49:40 +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 // Add animated textures
std::vector<osg::ref_ptr<osg::Texture2D> > textures; std::vector<osg::ref_ptr<osg::Texture2D> > textures;
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount"); int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
frameCount = std::min(std::max(frameCount, 0), 320);
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture"); const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
for (int i=0; i<frameCount; ++i) for (int i=0; i<frameCount; ++i)
{ {
@ -644,6 +646,8 @@ Water::~Water()
void Water::listAssetsToPreload(std::vector<std::string> &textures) void Water::listAssetsToPreload(std::vector<std::string> &textures)
{ {
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount"); int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
frameCount = std::min(std::max(frameCount, 0), 320);
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture"); const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
for (int i=0; i<frameCount; ++i) for (int i=0; i<frameCount; ++i)
{ {