Rename TechTreeCache -> TechTree

This commit is contained in:
Paul Chote
2010-09-17 23:46:17 +12:00
committed by Chris Forbes
parent 08b25d10c1
commit fb90400524
8 changed files with 13 additions and 13 deletions

View File

@@ -83,7 +83,6 @@
<Compile Include="Traits\BaseBuilding.cs" /> <Compile Include="Traits\BaseBuilding.cs" />
<Compile Include="Traits\LintAttributes.cs" /> <Compile Include="Traits\LintAttributes.cs" />
<Compile Include="Traits\Player\PlayerResources.cs" /> <Compile Include="Traits\Player\PlayerResources.cs" />
<Compile Include="Traits\Player\TechTreeCache.cs" />
<Compile Include="Traits\World\Shroud.cs" /> <Compile Include="Traits\World\Shroud.cs" />
<Compile Include="Widgets\ChatEntryWidget.cs" /> <Compile Include="Widgets\ChatEntryWidget.cs" />
<Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" /> <Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" />
@@ -228,6 +227,7 @@
<Compile Include="Traits\Armor.cs" /> <Compile Include="Traits\Armor.cs" />
<Compile Include="Graphics\CursorProvider.cs" /> <Compile Include="Graphics\CursorProvider.cs" />
<Compile Include="Traits\Player\PlayerProductionQueue.cs" /> <Compile Include="Traits\Player\PlayerProductionQueue.cs" />
<Compile Include="Traits\Player\TechTree.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -15,7 +15,7 @@ using OpenRA.FileFormats;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
public class PlayerProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeCacheInfo> public class PlayerProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeInfo>
{ {
public override object Create(ActorInitializer init) { return new PlayerProductionQueue(init.self, this); } public override object Create(ActorInitializer init) { return new PlayerProductionQueue(init.self, this); }
} }

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Traits
this.self = self; this.self = self;
this.Info = info; this.Info = info;
var ttc = playerActor.Trait<TechTreeCache>(); var ttc = playerActor.Trait<TechTree>();
foreach (var a in AllBuildables(Info.Type)) foreach (var a in AllBuildables(Info.Type))
{ {

View File

@@ -15,16 +15,16 @@ using OpenRA.GameRules;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
class TechTreeCacheInfo : ITraitInfo class TechTreeInfo : ITraitInfo
{ {
public object Create(ActorInitializer init) { return new TechTreeCache(init);} public object Create(ActorInitializer init) { return new TechTree(init);}
} }
class TechTreeCache class TechTree
{ {
readonly List<Watcher> watchers = new List<Watcher>(); readonly List<Watcher> watchers = new List<Watcher>();
readonly Player player; readonly Player player;
public TechTreeCache(ActorInitializer init) public TechTree(ActorInitializer init)
{ {
player = init.self.Owner; player = init.self.Owner;
init.world.ActorAdded += ActorChanged; init.world.ActorAdded += ActorChanged;

View File

@@ -12,7 +12,7 @@ using System.Linq;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
public abstract class SupportPowerInfo : ITraitInfo, ITraitPrerequisite<TechTreeCacheInfo> public abstract class SupportPowerInfo : ITraitInfo, ITraitPrerequisite<TechTreeInfo>
{ {
public readonly bool RequiresPower = true; public readonly bool RequiresPower = true;
public readonly bool OneShot = false; public readonly bool OneShot = false;
@@ -62,7 +62,7 @@ namespace OpenRA.Traits
effectivePrereq = Info.Prerequisites effectivePrereq = Info.Prerequisites
.Select(a => a.ToLowerInvariant()).ToArray(); .Select(a => a.ToLowerInvariant()).ToArray();
self.Trait<TechTreeCache>().Add( Info.OrderName, Info.Prerequisites.Select( a => a.ToLowerInvariant() ).ToList(), this ); self.Trait<TechTree>().Add( Info.OrderName, Info.Prerequisites.Select( a => a.ToLowerInvariant() ).ToList(), this );
} }
public void Tick(Actor self) public void Tick(Actor self)
@@ -101,7 +101,7 @@ namespace OpenRA.Traits
return Owner.PlayerActor.Trait<PlayerResources>().GetPowerState() == PowerState.Normal; return Owner.PlayerActor.Trait<PlayerResources>().GetPowerState() == PowerState.Normal;
// Takes 0.3ms on pchote's machine -- calling it every tick for every active special power is retarded // Takes 0.3ms on pchote's machine -- calling it every tick for every active special power is retarded
var buildings = TechTreeCache.GatherBuildings(Owner); var buildings = TechTree.GatherBuildings(Owner);
return effectivePrereq.All(a => buildings[a].Any(b => !b.Trait<Building>().Disabled)); return effectivePrereq.All(a => buildings[a].Any(b => !b.Trait<Building>().Disabled));
} }

View File

@@ -1,6 +1,6 @@
Player: Player:
PlaceBuilding: PlaceBuilding:
TechTreeCache: TechTree:
NukePower: NukePower:
Image: atomicnh Image: atomicnh
ChargeTime: 5 ChargeTime: 5

View File

@@ -1,5 +1,5 @@
Player: Player:
TechTreeCache: TechTree:
PlayerResources: PlayerResources:
InitialCash: 5000 InitialCash: 5000
ActorGroupProxy: ActorGroupProxy:

View File

@@ -1,5 +1,5 @@
Player: Player:
TechTreeCache: TechTree:
PlayerProductionQueue@Building: PlayerProductionQueue@Building:
Type: Building Type: Building
BuildSpeed: .4 BuildSpeed: .4