Fix some pasted particles not getting cut off at the edges of the simulation

The problem is that .x and .y may get rounded toward 0 when being converted to an int, the fix is to floor first.
This commit is contained in:
Tamás Bálint Misius 2023-12-15 19:26:12 +01:00
parent b4d7d276a2
commit c6c4b1de76
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -42,8 +42,8 @@ void Simulation::Load(const GameSave *save, bool includePressure, Vec2<int> bloc
tempPart.x += (float)partP.X;
tempPart.y += (float)partP.Y;
int x = int(tempPart.x + 0.5f);
int y = int(tempPart.y + 0.5f);
int x = int(std::floor(tempPart.x + 0.5f));
int y = int(std::floor(tempPart.y + 0.5f));
// Check various scenarios where we are unable to spawn the element, and set type to 0 to block spawning later
if (!InBounds(x, y))