Noise: Prevent unittest crash caused by division by zero
[oweals/minetest.git] / src / game.cpp
index f0c11cb98260ca9b497f043aa71d92719b4512b9..ba48402035e6a93b9cf4013081ee45dc6372b512 100644 (file)
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "game.h"
 
 #include <iomanip>
+#include <cmath>
 #include "client/renderingengine.h"
 #include "camera.h"
 #include "client.h"
@@ -995,7 +996,7 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
        s32 chat_y = 5;
 
        if (show_debug)
-               chat_y += 2 * line_height;
+               chat_y += 3 * line_height;
 
        // first pass to calculate height of text to be set
        const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize();
@@ -4124,7 +4125,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
                                                .getInterpolated(video::SColor(255, 0, 0, 0), 0.9);
                                sky->overrideColors(clouds_dark, clouds->getColor());
                                sky->setBodiesVisible(false);
-                               runData.fog_range = 20.0f * BS;
+                               runData.fog_range = std::fmin(runData.fog_range * 0.5f, 32.0f * BS);
                                // do not draw clouds after all
                                clouds->setVisible(false);
                        }