From 88a5e2c3f4a46c4158013540fb8037f9d752e73b Mon Sep 17 00:00:00 2001 From: Mr-Auto <36127424+Mr-Auto@users.noreply.github.com> Date: Sun, 24 Sep 2023 17:44:51 +0200 Subject: [PATCH] improve `fix_liquid_out_of_bounds` --- src/game_api/state.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game_api/state.cpp b/src/game_api/state.cpp index acdf83648..ad5cff27d 100644 --- a/src/game_api/state.cpp +++ b/src/game_api/state.cpp @@ -57,7 +57,11 @@ void fix_liquid_out_of_bounds() { for (uint32_t i = 0; i < it.physics_engine->entity_count; ++i) { - if ((it.physics_engine->entity_coordinates + i)->second < 0.1) // 0.1 just to be safe + auto liquid_coordinates = it.physics_engine->entity_coordinates + i; + if (liquid_coordinates->second < 0 // y < 0 + || liquid_coordinates->first < 0 // x < 0 + || liquid_coordinates->first > g_level_max_x) // x > g_level_max_x + // no y > g_level_max_y as the entity should fall back down eventually anyway { if (!*(it.physics_engine->unknown61 + i)) // just some bs continue;