make classic production queue speedup less error prone

- avoid float modifiers because of rounding errors and desync
- try not to crash when the last production building is gone
- don't do LINQ queries on selfsame buildings if not required
This commit is contained in:
Matthias Mailänder
2013-03-12 12:49:16 +01:00
parent 7676ef6a14
commit 6d6664d930
5 changed files with 55 additions and 36 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public readonly string Type = null;
public readonly string Group = null;
public float BuildSpeed = 0.4f;
public float BuildSpeedModifier = 0.4f;
public readonly int LowPowerSlowdown = 3;
public readonly string ReadyAudio = "UnitReady";
@@ -262,7 +262,7 @@ namespace OpenRA.Mods.RA
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0;
var time = unit.GetBuildTime() * Info.BuildSpeed;
var time = unit.GetBuildTime() * Info.BuildSpeedModifier;
return (int) time;
}