fixed crash in crate spawner (exclusive upper bound *isnt*, thanks Bill...); tuned crate params

This commit is contained in:
Chris Forbes
2010-02-13 18:52:36 +13:00
parent 37cdae2ff3
commit bb3f74a7c5
2 changed files with 6 additions and 5 deletions

View File

@@ -31,9 +31,10 @@ namespace OpenRa.Traits
crates.RemoveAll(c => !c.IsInWorld);
while (crates.Count < info.Minimum)
SpawnCrate(self, info);
if (crates.Count < info.Maximum)
var toSpawn = Math.Min(0, info.Minimum - crates.Count)
+ (crates.Count < info.Maximum ? 1 : 0);
for (var n = 0; n < toSpawn; n++)
SpawnCrate(self, info);
}
}
@@ -45,7 +46,7 @@ namespace OpenRa.Traits
for (; ; )
{
var p = new int2(Game.SharedRandom.Next(128), Game.SharedRandom.Next(128));
var p = new int2(Game.SharedRandom.Next(0,127), Game.SharedRandom.Next(0,127));
if (self.World.IsCellBuildable(p, umt))
{
self.World.AddFrameEndTask(

View File

@@ -67,7 +67,7 @@ World:
ChoosePaletteOnSelect:
BridgeLoadHook:
CrateSpawner:
Minimum: 0
Minimum: 1
Maximum: 3
SpawnInterval: 30
WaterChance: .2