remove a redundant method from queries.
This commit is contained in:
@@ -136,7 +136,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
int* c = (int*)bitmapData.Scan0;
|
int* c = (int*)bitmapData.Scan0;
|
||||||
|
|
||||||
foreach (var t in world.Queries.WithTraitMultiple<IRadarSignature>())
|
foreach (var t in world.Queries.WithTrait<IRadarSignature>())
|
||||||
{
|
{
|
||||||
if (!world.LocalShroud.IsVisible(t.Actor))
|
if (!world.LocalShroud.IsVisible(t.Actor))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Network
|
|||||||
report.Frame = orderManager.NetFrameNumber;
|
report.Frame = orderManager.NetFrameNumber;
|
||||||
report.SyncedRandom = orderManager.world.SharedRandom.Last;
|
report.SyncedRandom = orderManager.world.SharedRandom.Last;
|
||||||
report.Traits.Clear();
|
report.Traits.Clear();
|
||||||
foreach (var a in orderManager.world.Queries.WithTraitMultiple<object>())
|
foreach (var a in orderManager.world.Queries.WithTrait<object>())
|
||||||
{
|
{
|
||||||
var sync = Sync.CalculateSyncHash(a.Trait);
|
var sync = Sync.CalculateSyncHash(a.Trait);
|
||||||
if (sync != 0)
|
if (sync != 0)
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace OpenRA
|
|||||||
if (!DisableTick)
|
if (!DisableTick)
|
||||||
{
|
{
|
||||||
actors.Do( x => x.Tick() );
|
actors.Do( x => x.Tick() );
|
||||||
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
|
Queries.WithTrait<ITick>().DoTimed( x =>
|
||||||
{
|
{
|
||||||
x.Trait.Tick( x.Actor );
|
x.Trait.Tick( x.Actor );
|
||||||
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
|
||||||
@@ -241,11 +241,6 @@ namespace OpenRA
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<TraitPair<T>> WithTraitMultiple<T>()
|
|
||||||
{
|
|
||||||
return world.traitDict.ActorsWithTraitMultiple<T>( world );
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OwnedByCachedView : CachedView<Actor, Actor>
|
public class OwnedByCachedView : CachedView<Actor, Actor>
|
||||||
{
|
{
|
||||||
readonly TypeDictionary hasTrait = new TypeDictionary();
|
readonly TypeDictionary hasTrait = new TypeDictionary();
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ namespace OpenRA.Mods.RA
|
|||||||
private void BuildRandom(string category)
|
private void BuildRandom(string category)
|
||||||
{
|
{
|
||||||
// Pick a free queue
|
// Pick a free queue
|
||||||
var queue = world.Queries.WithTraitMultiple<ProductionQueue>()
|
var queue = world.Queries.WithTrait<ProductionQueue>()
|
||||||
.Where(a => a.Actor.Owner == p &&
|
.Where(a => a.Actor.Owner == p &&
|
||||||
a.Trait.Info.Type == category &&
|
a.Trait.Info.Type == category &&
|
||||||
a.Trait.CurrentItem() == null)
|
a.Trait.CurrentItem() == null)
|
||||||
@@ -457,7 +457,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
// Pick a free queue
|
// Pick a free queue
|
||||||
var queue = ai.world.Queries.WithTraitMultiple<ProductionQueue>()
|
var queue = ai.world.Queries.WithTrait<ProductionQueue>()
|
||||||
.Where(a => a.Actor.Owner == ai.p && a.Trait.Info.Type == category)
|
.Where(a => a.Actor.Owner == ai.p && a.Trait.Info.Type == category)
|
||||||
.Select(a => a.Trait)
|
.Select(a => a.Trait)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
var prevItems = GetNumBuildables(self.Owner);
|
var prevItems = GetNumBuildables(self.Owner);
|
||||||
|
|
||||||
// Find the queue with the target actor
|
// Find the queue with the target actor
|
||||||
var queue = w.Queries.WithTraitMultiple<ProductionQueue>()
|
var queue = w.Queries.WithTrait<ProductionQueue>()
|
||||||
.Where(p => p.Actor.Owner == self.Owner &&
|
.Where(p => p.Actor.Owner == self.Owner &&
|
||||||
p.Trait.CurrentItem() != null &&
|
p.Trait.CurrentItem() != null &&
|
||||||
p.Trait.CurrentItem().Item == order.TargetString &&
|
p.Trait.CurrentItem().Item == order.TargetString &&
|
||||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
if (p != p.World.LocalPlayer) return 0; // this only matters for local players.
|
if (p != p.World.LocalPlayer) return 0; // this only matters for local players.
|
||||||
|
|
||||||
return p.World.Queries.WithTraitMultiple<ProductionQueue>()
|
return p.World.Queries.WithTrait<ProductionQueue>()
|
||||||
.Where(a => a.Actor.Owner == p)
|
.Where(a => a.Actor.Owner == p)
|
||||||
.SelectMany(a => a.Trait.BuildableItems()).Distinct().Count();
|
.SelectMany(a => a.Trait.BuildableItems()).Distinct().Count();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
{
|
{
|
||||||
VisibleQueues.Clear();
|
VisibleQueues.Clear();
|
||||||
|
|
||||||
var queues = world.Queries.WithTraitMultiple<ProductionQueue>()
|
var queues = world.Queries.WithTrait<ProductionQueue>()
|
||||||
.Where(p => p.Actor.Owner == world.LocalPlayer)
|
.Where(p => p.Actor.Owner == world.LocalPlayer)
|
||||||
.Select(p => p.Trait);
|
.Select(p => p.Trait);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user