From bb7c19ad02723d60062f2e26e7a50e479986b546 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 4 Sep 2018 20:26:08 +0200 Subject: [PATCH] Fix spawning 1 crate too much if maximum == minimum If Maximum == Minimum but 'crates' < Maximum, the formula would simply return min + 1 regardless of max being identical to min. Only adding 1 more crate if Maximum is higher than Minimum fixes that. --- OpenRA.Mods.Common/Traits/World/CrateSpawner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs index 8a53f306b9..d230ecf98c 100644 --- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs +++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits ticks = info.SpawnInterval; var toSpawn = Math.Max(0, info.Minimum - crates) - + (crates < info.Maximum ? 1 : 0); + + (crates < info.Maximum && info.Maximum > info.Minimum ? 1 : 0); for (var n = 0; n < toSpawn; n++) SpawnCrate(self);