Skip to content

Commit

Permalink
improve fix_liquid_out_of_bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Sep 24, 2023
1 parent eeda13d commit 88a5e2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game_api/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 88a5e2c

Please sign in to comment.