Skip to content

Commit

Permalink
less dumb PlayerResources init
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisforbes committed Jan 9, 2011
1 parent 70afea8 commit b4109b1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions OpenRA.Game/Traits/Player/PlayerResources.cs
Expand Up @@ -19,19 +19,21 @@ public class PlayerResourcesInfo : ITraitInfo
public readonly int InitialOre = 0;
public readonly int AdviceInterval = 250;

public object Create(ActorInitializer init) { return new PlayerResources(init.self); }
public object Create(ActorInitializer init) { return new PlayerResources(init.self, this); }
}

public class PlayerResources : ITick
{
Player Owner;
readonly Player Owner;
int AdviceInterval;
public PlayerResources(Actor self)

public PlayerResources(Actor self, PlayerResourcesInfo info)
{
Owner = self.Owner;
Cash = self.Info.Traits.Get<PlayerResourcesInfo>().InitialCash;
Ore = self.Info.Traits.Get<PlayerResourcesInfo>().InitialOre;
AdviceInterval = self.Info.Traits.Get<PlayerResourcesInfo>().AdviceInterval;

Cash = info.InitialCash;
Ore = info.InitialOre;
AdviceInterval = info.AdviceInterval;
}

[Sync]
Expand Down

0 comments on commit b4109b1

Please sign in to comment.