Fix StyleCop issues in TechTree.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void Remove(string key)
|
public void Remove(string key)
|
||||||
{
|
{
|
||||||
watchers.RemoveAll(x => x.key == key);
|
watchers.RemoveAll(x => x.Key == key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cache<string, List<Actor>> GatherBuildables(Player player)
|
static Cache<string, List<Actor>> GatherBuildables(Player player)
|
||||||
@@ -89,16 +89,17 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class Watcher
|
class Watcher
|
||||||
{
|
{
|
||||||
public readonly string key;
|
public readonly string Key;
|
||||||
|
|
||||||
// strings may be either actor type, or "alternate name" key
|
// strings may be either actor type, or "alternate name" key
|
||||||
public readonly string[] prerequisites;
|
readonly string[] prerequisites;
|
||||||
public readonly ITechTreeElement watcher;
|
readonly ITechTreeElement watcher;
|
||||||
bool hasPrerequisites;
|
bool hasPrerequisites;
|
||||||
int buildLimit;
|
int buildLimit;
|
||||||
|
|
||||||
public Watcher(string key, BuildableInfo info, ITechTreeElement watcher)
|
public Watcher(string key, BuildableInfo info, ITechTreeElement watcher)
|
||||||
{
|
{
|
||||||
this.key = key;
|
this.Key = key;
|
||||||
this.prerequisites = info.Prerequisites;
|
this.prerequisites = info.Prerequisites;
|
||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
this.hasPrerequisites = false;
|
this.hasPrerequisites = false;
|
||||||
@@ -112,15 +113,14 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void Update(Cache<string, List<Actor>> buildables)
|
public void Update(Cache<string, List<Actor>> buildables)
|
||||||
{
|
{
|
||||||
var hasReachedBuildLimit = buildLimit > 0 && buildables[key].Count >= buildLimit;
|
var hasReachedBuildLimit = buildLimit > 0 && buildables[Key].Count >= buildLimit;
|
||||||
|
|
||||||
var nowHasPrerequisites = HasPrerequisites(buildables) && !hasReachedBuildLimit;
|
var nowHasPrerequisites = HasPrerequisites(buildables) && !hasReachedBuildLimit;
|
||||||
|
|
||||||
if (nowHasPrerequisites && !hasPrerequisites)
|
if (nowHasPrerequisites && !hasPrerequisites)
|
||||||
watcher.PrerequisitesAvailable(key);
|
watcher.PrerequisitesAvailable(Key);
|
||||||
|
|
||||||
if (!nowHasPrerequisites && hasPrerequisites)
|
if (!nowHasPrerequisites && hasPrerequisites)
|
||||||
watcher.PrerequisitesUnavailable(key);
|
watcher.PrerequisitesUnavailable(Key);
|
||||||
|
|
||||||
hasPrerequisites = nowHasPrerequisites;
|
hasPrerequisites = nowHasPrerequisites;
|
||||||
}
|
}
|
||||||
@@ -136,13 +136,13 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public class ProvidesCustomPrerequisite : ITechTreePrerequisite
|
public class ProvidesCustomPrerequisite : ITechTreePrerequisite
|
||||||
{
|
{
|
||||||
ProvidesCustomPrerequisiteInfo Info;
|
ProvidesCustomPrerequisiteInfo info;
|
||||||
|
|
||||||
public IEnumerable<string> ProvidesPrerequisites { get { yield return Info.Prerequisite; } }
|
public IEnumerable<string> ProvidesPrerequisites { get { yield return info.Prerequisite; } }
|
||||||
|
|
||||||
public ProvidesCustomPrerequisite(ProvidesCustomPrerequisiteInfo info)
|
public ProvidesCustomPrerequisite(ProvidesCustomPrerequisiteInfo info)
|
||||||
{
|
{
|
||||||
Info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user