add ISync to all traits that have [Sync] members

This commit is contained in:
Chris Forbes
2011-01-26 10:02:24 +13:00
committed by Paul Chote
parent b7ea695f0c
commit f52620f6fc
41 changed files with 56 additions and 54 deletions

View File

@@ -17,6 +17,7 @@ using OpenRA.FileFormats;
namespace OpenRA namespace OpenRA
{ {
public class SyncAttribute : Attribute { } public class SyncAttribute : Attribute { }
public interface ISync { } /* marker interface */
public static class Sync public static class Sync
{ {

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Traits
public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead }; public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead };
public class Health public class Health : ISync
{ {
public readonly HealthInfo Info; public readonly HealthInfo Info;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Traits
public object Create (ActorInitializer init) { return new DeveloperMode(this); } public object Create (ActorInitializer init) { return new DeveloperMode(this); }
} }
public class DeveloperMode : IResolveOrder public class DeveloperMode : IResolveOrder, ISync
{ {
DeveloperModeInfo Info; DeveloperModeInfo Info;
[Sync] public bool FastCharge; [Sync] public bool FastCharge;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Traits
{ {
public object Create(ActorInitializer init) { return new DebugResourceCash(init.self); } public object Create(ActorInitializer init) { return new DebugResourceCash(init.self); }
} }
public class DebugResourceCash public class DebugResourceCash : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugResourceCash(Actor self){this.self = self;} public DebugResourceCash(Actor self){this.self = self;}
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
{ {
public object Create(ActorInitializer init) { return new DebugResourceOre(init.self); } public object Create(ActorInitializer init) { return new DebugResourceOre(init.self); }
} }
public class DebugResourceOre public class DebugResourceOre : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugResourceOre(Actor self){this.self = self;} public DebugResourceOre(Actor self){this.self = self;}
@@ -48,14 +48,14 @@ namespace OpenRA.Traits
{ {
public object Create(ActorInitializer init) { return new DebugResourceOreCapacity(init.self); } public object Create(ActorInitializer init) { return new DebugResourceOreCapacity(init.self); }
} }
public class DebugResourceOreCapacity public class DebugResourceOreCapacity : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugResourceOreCapacity(Actor self){this.self = self;} public DebugResourceOreCapacity(Actor self){this.self = self;}
[Sync] public int foo { get { return self.Trait<PlayerResources>().OreCapacity; } } [Sync] public int foo { get { return self.Trait<PlayerResources>().OreCapacity; } }
} }
public class PlayerResources : ITick public class PlayerResources : ITick, ISync
{ {
readonly Player Owner; readonly Player Owner;
int AdviceInterval; int AdviceInterval;

View File

@@ -15,7 +15,8 @@ namespace OpenRA.Traits
{ {
public object Create(ActorInitializer init) { return new SharesCell(init); } public object Create(ActorInitializer init) { return new SharesCell(init); }
} }
public class SharesCell : IOffsetCenterLocation
public class SharesCell : IOffsetCenterLocation, ISync
{ {
[Sync] [Sync]
public int Position; public int Position;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc
public object Create(ActorInitializer init) { return new PoisonedByTiberium(this); } public object Create(ActorInitializer init) { return new PoisonedByTiberium(this); }
} }
class PoisonedByTiberium : ITick class PoisonedByTiberium : ITick, ISync
{ {
PoisonedByTiberiumInfo info; PoisonedByTiberiumInfo info;
[Sync] int poisonTicks; [Sync] int poisonTicks;

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Air
{ {
public object Create(ActorInitializer init) { return new DebugAircraftFacing(init.self); } public object Create(ActorInitializer init) { return new DebugAircraftFacing(init.self); }
} }
public class DebugAircraftFacing public class DebugAircraftFacing : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugAircraftFacing(Actor self){this.self = self;} public DebugAircraftFacing(Actor self){this.self = self;}
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Air
{ {
public object Create(ActorInitializer init) { return new DebugAircraftSubPxX(init.self); } public object Create(ActorInitializer init) { return new DebugAircraftSubPxX(init.self); }
} }
public class DebugAircraftSubPxX public class DebugAircraftSubPxX : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugAircraftSubPxX(Actor self){this.self = self;} public DebugAircraftSubPxX(Actor self){this.self = self;}
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Air
{ {
public object Create(ActorInitializer init) { return new DebugAircraftSubPxY(init.self); } public object Create(ActorInitializer init) { return new DebugAircraftSubPxY(init.self); }
} }
public class DebugAircraftSubPxY public class DebugAircraftSubPxY : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugAircraftSubPxY(Actor self){this.self = self;} public DebugAircraftSubPxY(Actor self){this.self = self;}
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA.Air
{ {
public object Create(ActorInitializer init) { return new DebugAircraftAltitude(init.self); } public object Create(ActorInitializer init) { return new DebugAircraftAltitude(init.self); }
} }
public class DebugAircraftAltitude public class DebugAircraftAltitude : ISync
{ {
readonly Actor self; readonly Actor self;
public DebugAircraftAltitude(Actor self){this.self = self;} public DebugAircraftAltitude(Actor self){this.self = self;}
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA.Air
public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); } public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); }
} }
public class Aircraft : IMove, IFacing, IOccupySpace public class Aircraft : IMove, IFacing, IOccupySpace, ISync
{ {
protected readonly Actor self; protected readonly Actor self;
[Sync] [Sync]

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA
public abstract object Create(ActorInitializer init); public abstract object Create(ActorInitializer init);
} }
public abstract class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IOrderVoice public abstract class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IOrderVoice, ISync
{ {
[Sync] [Sync]
int nextScanTime = 0; int nextScanTime = 0;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public readonly bool JustMove = false; public readonly bool JustMove = false;
} }
class AttackMove : IResolveOrder, IOrderVoice, ITick class AttackMove : IResolveOrder, IOrderVoice, ITick, ISync
{ {
[Sync] public int2 TargetLocation = int2.Zero; [Sync] public int2 TargetLocation = int2.Zero;

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA.Buildings
} }
} }
public class Building : INotifyDamage, IResolveOrder, IOccupySpace, INotifyCapture public class Building : INotifyDamage, IResolveOrder, IOccupySpace, INotifyCapture, ISync
{ {
readonly Actor self; readonly Actor self;
public readonly BuildingInfo Info; public readonly BuildingInfo Info;

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Buildings
public object Create(ActorInitializer init) { return new CanPowerDown(init); } public object Create(ActorInitializer init) { return new CanPowerDown(init); }
} }
public class CanPowerDown : IResolveOrder, IDisable public class CanPowerDown : IResolveOrder, IDisable, ISync
{ {
[Sync] [Sync]
bool disabled = false; bool disabled = false;

View File

@@ -17,9 +17,9 @@ namespace OpenRA.Mods.RA.Buildings
{ {
public readonly int AdviceInterval = 250; public readonly int AdviceInterval = 250;
public object Create(ActorInitializer init) { return new PowerManager(init, this); } public object Create(ActorInitializer init) { return new PowerManager(init, this); }
} }
public class PowerManager : ITick public class PowerManager : ITick, ISync
{ {
PowerManagerInfo Info; PowerManagerInfo Info;
Player Player; Player Player;

View File

@@ -20,9 +20,9 @@ namespace OpenRA.Mods.RA.Buildings
public readonly float RepairRate = 0.016f; public readonly float RepairRate = 0.016f;
public readonly int RepairStep = 7; public readonly int RepairStep = 7;
public object Create(ActorInitializer init) { return new RepairableBuilding(init.self, this); } public object Create(ActorInitializer init) { return new RepairableBuilding(init.self, this); }
} }
public class RepairableBuilding : ITick, IResolveOrder public class RepairableBuilding : ITick, IResolveOrder, ISync
{ {
[Sync] [Sync]
bool isRepairing = false; bool isRepairing = false;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
public readonly int Interval = 8; public readonly int Interval = 8;
} }
class Burns : ITick class Burns : ITick, ISync
{ {
[Sync] [Sync]
int ticks; int ticks;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA
public readonly int Amount = 3; public readonly int Amount = 3;
} }
class CashTrickler : ITick class CashTrickler : ITick, ISync
{ {
[Sync] [Sync]
int ticks; int ticks;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public readonly int ChargeTime = 120; // Seconds public readonly int ChargeTime = 120; // Seconds
} }
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IOrderVoice class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IOrderVoice, ISync
{ {
// Recharge logic // Recharge logic
[Sync] [Sync]

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.RA
{ {
class ChronoshiftableInfo : TraitInfo<Chronoshiftable> { } class ChronoshiftableInfo : TraitInfo<Chronoshiftable> { }
public class Chronoshiftable : ITick public class Chronoshiftable : ITick, ISync
{ {
// Return-to-sender logic // Return-to-sender logic
[Sync] [Sync]

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new Cloak(init.self, this); } public object Create(ActorInitializer init) { return new Cloak(init.self, this); }
} }
public class Cloak : IRenderModifier, INotifyDamage, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier public class Cloak : IRenderModifier, INotifyDamage, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, ISync
{ {
[Sync] [Sync]
int remainingTime; int remainingTime;

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
} }
// ITeleportable is required for paradrop // ITeleportable is required for paradrop
class Crate : ITick, IOccupySpace, ITeleportable, ICrushable class Crate : ITick, IOccupySpace, ITeleportable, ICrushable, ISync
{ {
readonly Actor self; readonly Actor self;
[Sync] [Sync]

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new GainsExperience(init.self, this); } public object Create(ActorInitializer init) { return new GainsExperience(init.self, this); }
} }
public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier, IRenderModifier public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier, IRenderModifier, ISync
{ {
readonly Actor self; readonly Actor self;
readonly int[] Levels; readonly int[] Levels;

View File

@@ -30,8 +30,8 @@ namespace OpenRA.Mods.RA
} }
public class Harvester : IIssueOrder, IResolveOrder, IPips, public class Harvester : IIssueOrder, IResolveOrder, IPips,
IRenderModifier, IExplodeModifier, IOrderVoice, IRenderModifier, IExplodeModifier, IOrderVoice,
ISpeedModifier ISpeedModifier, ISync
{ {
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>(); Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA
public object Create( ActorInitializer init ) { return new Husk( init ); } public object Create( ActorInitializer init ) { return new Husk( init ); }
} }
class Husk : IOccupySpace, IFacing class Husk : IOccupySpace, IFacing, ISync
{ {
[Sync] [Sync]
int2 location; int2 location;

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
{ {
class IronCurtainableInfo : TraitInfo<IronCurtainable> { } class IronCurtainableInfo : TraitInfo<IronCurtainable> { }
class IronCurtainable : IDamageModifier, ITick class IronCurtainable : IDamageModifier, ITick, ISync
{ {
[Sync] [Sync]
int RemainingTicks = 0; int RemainingTicks = 0;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new LimitedAmmo(this); } public object Create(ActorInitializer init) { return new LimitedAmmo(this); }
} }
public class LimitedAmmo : INotifyAttack, IPips public class LimitedAmmo : INotifyAttack, IPips, ISync
{ {
[Sync] [Sync]
int ammo; int ammo;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new Mine(init, this); } public object Create(ActorInitializer init) { return new Mine(init, this); }
} }
class Mine : ICrushable, IOccupySpace class Mine : ICrushable, IOccupySpace, ISync
{ {
readonly Actor self; readonly Actor self;
readonly MineInfo info; readonly MineInfo info;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
public readonly string[] RearmBuildings = { "fix" }; public readonly string[] RearmBuildings = { "fix" };
} }
class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync
{ {
/* [Sync] when sync can cope with arrays! */ /* [Sync] when sync can cope with arrays! */
public int2[] minefield = null; public int2[] minefield = null;

View File

@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Move
} }
} }
public class Mobile : IIssueOrder, IResolveOrder, IOrderVoice, IOccupySpace, IMove, IFacing, INudge public class Mobile : IIssueOrder, IResolveOrder, IOrderVoice, IOccupySpace, IMove, IFacing, INudge, ISync
{ {
public readonly Actor self; public readonly Actor self;
public readonly MobileInfo Info; public readonly MobileInfo Info;

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
public virtual object Create(ActorInitializer init) { return new OreRefinery(init.self, this); } public virtual object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }
} }
public class OreRefinery : ITick, IAcceptOre, INotifyDamage, INotifySold, INotifyCapture, IPips, IExplodeModifier public class OreRefinery : ITick, IAcceptOre, INotifyDamage, INotifySold, INotifyCapture, IPips, IExplodeModifier, ISync
{ {
readonly Actor self; readonly Actor self;
readonly OreRefineryInfo Info; readonly OreRefineryInfo Info;

View File

@@ -18,9 +18,9 @@ namespace OpenRA.Mods.RA
public class ClassicProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeInfo>, ITraitPrerequisite<PowerManagerInfo>, ITraitPrerequisite<PlayerResourcesInfo> public class ClassicProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeInfo>, ITraitPrerequisite<PowerManagerInfo>, ITraitPrerequisite<PlayerResourcesInfo>
{ {
public override object Create(ActorInitializer init) { return new ClassicProductionQueue(init.self, this); } public override object Create(ActorInitializer init) { return new ClassicProductionQueue(init.self, this); }
} }
public class ClassicProductionQueue : ProductionQueue public class ClassicProductionQueue : ProductionQueue, ISync
{ {
public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info ) public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info )
: base(self, self, info as ProductionQueueInfo) {} : base(self, self, info as ProductionQueueInfo) {}

View File

@@ -13,7 +13,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new ProximityCapturable(init.self, this); } public object Create(ActorInitializer init) { return new ProximityCapturable(init.self, this); }
} }
public class ProximityCapturable : ITick public class ProximityCapturable : ITick, ISync
{ {
[Sync] [Sync]
public Player Owner { get { return Captured ? Self.Owner : OriginalOwner; } } public Player Owner { get { return Captured ? Self.Owner : OriginalOwner; } }

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new RallyPoint(init.self); } public object Create(ActorInitializer init) { return new RallyPoint(init.self); }
} }
public class RallyPoint : IIssueOrder, IResolveOrder public class RallyPoint : IIssueOrder, IResolveOrder, ISync
{ {
[Sync] [Sync]
public int2 rallyPoint; public int2 rallyPoint;

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Render
} }
} }
class RenderWarFactory : RenderBuilding, INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction, INotifySold class RenderWarFactory : RenderBuilding, INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction, INotifySold, ISync
{ {
public Animation roof; public Animation roof;
[Sync] [Sync]

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
public readonly float HealIfBelow = .5f; public readonly float HealIfBelow = .5f;
} }
class SelfHealing : ITick class SelfHealing : ITick, ISync
{ {
[Sync] [Sync]
int ticks; int ticks;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new StoresOre(init.self, this); } public object Create(ActorInitializer init) { return new StoresOre(init.self, this); }
} }
class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre, ISync
{ {
readonly StoresOreInfo Info; readonly StoresOreInfo Info;

View File

@@ -13,7 +13,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new StrategicPoint(init.self, this); } public object Create(ActorInitializer init) { return new StrategicPoint(init.self, this); }
} }
public class StrategicPoint : INotifyCapture, ITick public class StrategicPoint : INotifyCapture, ITick, ISync
{ {
[Sync] public Actor Self; [Sync] public Actor Self;
[Sync] public bool Critical; [Sync] public bool Critical;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.self, this); } public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.self, this); }
} }
public class StrategicVictoryConditions : ITick public class StrategicVictoryConditions : ITick, ISync
{ {
[Sync] public Actor Self; [Sync] public Actor Self;
public StrategicVictoryConditionsInfo Info; public StrategicVictoryConditionsInfo Info;

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA
public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); } public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); }
} }
class GpsPower : SupportPower, INotifyDamage class GpsPower : SupportPower, INotifyDamage, ISync
{ {
public GpsPower(Actor self, GpsPowerInfo info) : base(self, info) { } public GpsPower(Actor self, GpsPowerInfo info) : base(self, info) { }

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
class TakeCoverInfo : TraitInfo<TakeCover>, ITraitPrerequisite<RenderInfantryInfo> { } class TakeCoverInfo : TraitInfo<TakeCover>, ITraitPrerequisite<RenderInfantryInfo> { }
// infantry prone behavior // infantry prone behavior
class TakeCover : ITick, INotifyDamage, IDamageModifier, ISpeedModifier class TakeCover : ITick, INotifyDamage, IDamageModifier, ISpeedModifier, ISync
{ {
const int defaultProneTime = 100; /* ticks, =4s */ const int defaultProneTime = 100; /* ticks, =4s */
const float proneDamage = .5f; const float proneDamage = .5f;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new Turreted(init, this); } public object Create(ActorInitializer init) { return new Turreted(init, this); }
} }
public class Turreted : ITick public class Turreted : ITick, ISync
{ {
[Sync] [Sync]
public int turretFacing = 0; public int turretFacing = 0;

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
#endregion #endregion
} }
public abstract class UnitStance : ITick, IResolveOrder, ISelectionColorModifier, IPostRenderSelection public abstract class UnitStance : ITick, IResolveOrder, ISelectionColorModifier, IPostRenderSelection, ISync
{ {
[Sync] [Sync]
public int NextScanTime; public int NextScanTime;

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
/// ///
/// Will fire only when fired upon /// Will fire only when fired upon
/// </summary> /// </summary>
public class UnitStanceDefensive : UnitStance, INotifyDamage public class UnitStanceDefensive : UnitStance, INotifyDamage, ISync
{ {
public enum ETargetType public enum ETargetType
{ {