Fix RCS1061
This commit is contained in:
@@ -58,14 +58,11 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
var tilesetNode = node.Value.NodeWithKeyOrDefault(tileset);
|
||||
if (tilesetNode != null)
|
||||
{
|
||||
if (frames == null)
|
||||
if (frames == null && LoadField<string>("Length", null, data) != "*")
|
||||
{
|
||||
if (LoadField<string>("Length", null, data) != "*")
|
||||
{
|
||||
var subStart = LoadField("Start", 0, data);
|
||||
var subLength = LoadField("Length", 1, data);
|
||||
frames = Exts.MakeArray(subLength, i => subStart + i);
|
||||
}
|
||||
var subStart = LoadField("Start", 0, data);
|
||||
var subLength = LoadField("Length", 1, data);
|
||||
frames = Exts.MakeArray(subLength, i => subStart + i);
|
||||
}
|
||||
|
||||
return new[] { new ReservationInfo(tilesetNode.Value.Value, frames, frames, tilesetNode.Location) };
|
||||
|
||||
@@ -109,9 +109,10 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
|
||||
foreach (var n in node.Value.Nodes)
|
||||
if (checkArgKeys.Contains(n.Key))
|
||||
if (!namedKeys.Contains(n.Value.Value) && !Hotkey.TryParse(n.Value.Value, out var unused))
|
||||
emitError($"{filename} {node.Value.Value}:{n.Key} refers to a Key named `{n.Value.Value}` that does not exist.");
|
||||
if (checkArgKeys.Contains(n.Key) &&
|
||||
!namedKeys.Contains(n.Value.Value) &&
|
||||
!Hotkey.TryParse(n.Value.Value, out var unused))
|
||||
emitError($"{filename} {node.Value.Value}:{n.Key} refers to a Key named `{n.Value.Value}` that does not exist.");
|
||||
}
|
||||
|
||||
if (node.Value.Nodes != null)
|
||||
|
||||
@@ -40,9 +40,8 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (!playerNames.Contains(ownerName))
|
||||
emitError($"Actor `{kv.Key}` is owned by unknown player `{ownerName}`.");
|
||||
|
||||
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info))
|
||||
if (!info.ValidOwnerNames.Contains(ownerName))
|
||||
emitError($"Actor `{kv.Key}` owner `{ownerName}` is not one of ValidOwnerNames: {info.ValidOwnerNames.JoinWith(", ")}");
|
||||
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info) && !info.ValidOwnerNames.Contains(ownerName))
|
||||
emitError($"Actor `{kv.Key}` owner `{ownerName}` is not one of ValidOwnerNames: {info.ValidOwnerNames.JoinWith(", ")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,9 +256,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (element is Placeable placeable)
|
||||
{
|
||||
var expression = placeable.Expression;
|
||||
if (expression is IInlineExpression inlineExpression)
|
||||
if (inlineExpression is VariableReference variableReference)
|
||||
CheckVariableReference(variableReference.Id.Name.ToString(), key, attribute, emitWarning, file);
|
||||
if (expression is IInlineExpression inlineExpression &&
|
||||
inlineExpression is VariableReference variableReference)
|
||||
CheckVariableReference(variableReference.Id.Name.ToString(), key, attribute, emitWarning, file);
|
||||
|
||||
if (expression is SelectExpression selectExpression)
|
||||
{
|
||||
@@ -269,9 +269,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (variantElement is Placeable variantPlaceable)
|
||||
{
|
||||
var variantExpression = variantPlaceable.Expression;
|
||||
if (variantExpression is IInlineExpression variantInlineExpression)
|
||||
if (variantInlineExpression is VariableReference variantVariableReference)
|
||||
CheckVariableReference(variantVariableReference.Id.Name.ToString(), key, attribute, emitWarning, file);
|
||||
if (variantExpression is IInlineExpression variantInlineExpression &&
|
||||
variantInlineExpression is VariableReference variantVariableReference)
|
||||
CheckVariableReference(variantVariableReference.Id.Name.ToString(), key, attribute, emitWarning, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,9 +377,8 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
// If the impact position is within any actor's HitShape, we have a direct hit
|
||||
// PERF: Avoid using TraitsImplementing<HitShape> that needs to find the actor in the trait dictionary.
|
||||
foreach (var targetPos in victim.EnabledTargetablePositions)
|
||||
if (targetPos is HitShape h)
|
||||
if (h.DistanceFromEdge(victim, pos).Length <= 0)
|
||||
return true;
|
||||
if (targetPos is HitShape h && h.DistanceFromEdge(victim, pos).Length <= 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -94,9 +94,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var pos = self.CenterPosition;
|
||||
var armaments = ChooseArmamentsForTarget(target, forceAttack);
|
||||
foreach (var a in armaments)
|
||||
if (target.IsInRange(pos, a.MaxRange()) && (a.Weapon.MinRange == WDist.Zero || !target.IsInRange(pos, a.Weapon.MinRange)))
|
||||
if (TargetInFiringArc(self, target, Info.FacingTolerance))
|
||||
return true;
|
||||
if (target.IsInRange(pos, a.MaxRange()) &&
|
||||
(a.Weapon.MinRange == WDist.Zero || !target.IsInRange(pos, a.Weapon.MinRange)) &&
|
||||
TargetInFiringArc(self, target, Info.FacingTolerance))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -247,13 +247,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
a => a.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault).Sum(p => p.Amount));
|
||||
|
||||
// First priority is to get out of a low power situation
|
||||
if (playerPower != null && playerPower.ExcessPower < minimumExcessPower)
|
||||
if (playerPower != null && playerPower.ExcessPower < minimumExcessPower &&
|
||||
power != null && power.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault).Sum(p => p.Amount) > 0)
|
||||
{
|
||||
if (power != null && power.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault).Sum(p => p.Amount) > 0)
|
||||
{
|
||||
AIUtils.BotDebug("{0} decided to build {1}: Priority override (low power)", queue.Actor.Owner, power.Name);
|
||||
return power;
|
||||
}
|
||||
AIUtils.BotDebug("{0} decided to build {1}: Priority override (low power)", queue.Actor.Owner, power.Name);
|
||||
return power;
|
||||
}
|
||||
|
||||
// Next is to build up a strong economy
|
||||
|
||||
@@ -34,14 +34,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var rb = self.TraitOrDefault<RepairableBuilding>();
|
||||
if (rb != null)
|
||||
if (rb != null && e.DamageState > DamageState.Light && e.PreviousDamageState <= DamageState.Light && !rb.RepairActive)
|
||||
{
|
||||
if (e.DamageState > DamageState.Light && e.PreviousDamageState <= DamageState.Light && !rb.RepairActive)
|
||||
{
|
||||
AIUtils.BotDebug("{0} noticed damage {1} {2}->{3}, repairing.",
|
||||
self.Owner, self, e.PreviousDamageState, e.DamageState);
|
||||
bot.QueueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, Target.FromActor(self), false));
|
||||
}
|
||||
AIUtils.BotDebug("{0} noticed damage {1} {2}->{3}, repairing.",
|
||||
self.Owner, self, e.PreviousDamageState, e.DamageState);
|
||||
bot.QueueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, Target.FromActor(self), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,11 +75,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Timed tokens do not count towards the source cap: the condition with the shortest
|
||||
// remaining duration can always be revoked to make room.
|
||||
if (Info.SourceCap > 0)
|
||||
if (permanentTokens.TryGetValue(source, out var permanentTokensForSource) && permanentTokensForSource.Count >= Info.SourceCap)
|
||||
return false;
|
||||
if (Info.SourceCap > 0 &&
|
||||
permanentTokens.TryGetValue(source, out var permanentTokensForSource) &&
|
||||
permanentTokensForSource.Count >= Info.SourceCap)
|
||||
return false;
|
||||
|
||||
if (Info.TotalCap > 0 && permanentTokens.Values.Sum(t => t.Count) >= Info.TotalCap)
|
||||
if (Info.TotalCap > 0 &&
|
||||
permanentTokens.Values.Sum(t => t.Count) >= Info.TotalCap)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -93,29 +93,34 @@ namespace OpenRA.Mods.Common.Traits
|
||||
static bool TargetChanged(in Target lastTarget, in Target target)
|
||||
{
|
||||
// Invalidate reveal changing the target.
|
||||
if (lastTarget.Type == TargetType.FrozenActor && target.Type == TargetType.Actor)
|
||||
if (lastTarget.FrozenActor.Actor == target.Actor)
|
||||
return false;
|
||||
if (lastTarget.Type == TargetType.FrozenActor &&
|
||||
target.Type == TargetType.Actor &&
|
||||
lastTarget.FrozenActor.Actor == target.Actor)
|
||||
return false;
|
||||
|
||||
if (lastTarget.Type == TargetType.Actor && target.Type == TargetType.FrozenActor)
|
||||
if (target.FrozenActor.Actor == lastTarget.Actor)
|
||||
return false;
|
||||
if (lastTarget.Type == TargetType.Actor &&
|
||||
target.Type == TargetType.FrozenActor &&
|
||||
target.FrozenActor.Actor == lastTarget.Actor)
|
||||
return false;
|
||||
|
||||
if (lastTarget.Type != target.Type)
|
||||
return true;
|
||||
|
||||
// Invalidate attacking different targets with shared target types.
|
||||
if (lastTarget.Type == TargetType.Actor && target.Type == TargetType.Actor)
|
||||
if (lastTarget.Actor != target.Actor)
|
||||
return true;
|
||||
if (lastTarget.Type == TargetType.Actor &&
|
||||
target.Type == TargetType.Actor &&
|
||||
lastTarget.Actor != target.Actor)
|
||||
return true;
|
||||
|
||||
if (lastTarget.Type == TargetType.FrozenActor && target.Type == TargetType.FrozenActor)
|
||||
if (lastTarget.FrozenActor != target.FrozenActor)
|
||||
return true;
|
||||
if (lastTarget.Type == TargetType.FrozenActor &&
|
||||
target.Type == TargetType.FrozenActor &&
|
||||
lastTarget.FrozenActor != target.FrozenActor)
|
||||
return true;
|
||||
|
||||
if (lastTarget.Type == TargetType.Terrain && target.Type == TargetType.Terrain)
|
||||
if (lastTarget.CenterPosition != target.CenterPosition)
|
||||
return true;
|
||||
if (lastTarget.Type == TargetType.Terrain &&
|
||||
target.Type == TargetType.Terrain &&
|
||||
lastTarget.CenterPosition != target.CenterPosition)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,17 +48,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void INotifyDockClient.Docked(Actor self, Actor host)
|
||||
{
|
||||
if (info.Condition != null && (info.DockHostNames == null || info.DockHostNames.Contains(host.Info.Name)))
|
||||
if (info.Condition != null &&
|
||||
(info.DockHostNames == null || info.DockHostNames.Contains(host.Info.Name)) &&
|
||||
token == Actor.InvalidConditionToken)
|
||||
{
|
||||
if (token == Actor.InvalidConditionToken)
|
||||
if (delayedtoken == Actor.InvalidConditionToken)
|
||||
token = self.GrantCondition(info.Condition);
|
||||
else
|
||||
{
|
||||
if (delayedtoken == Actor.InvalidConditionToken)
|
||||
token = self.GrantCondition(info.Condition);
|
||||
else
|
||||
{
|
||||
token = delayedtoken;
|
||||
delayedtoken = Actor.InvalidConditionToken;
|
||||
}
|
||||
token = delayedtoken;
|
||||
delayedtoken = Actor.InvalidConditionToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,17 +48,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void INotifyDockHost.Docked(Actor self, Actor client)
|
||||
{
|
||||
if (info.Condition != null && (info.DockClientNames == null || info.DockClientNames.Contains(client.Info.Name)))
|
||||
if (info.Condition != null &&
|
||||
(info.DockClientNames == null || info.DockClientNames.Contains(client.Info.Name)) &&
|
||||
token == Actor.InvalidConditionToken)
|
||||
{
|
||||
if (token == Actor.InvalidConditionToken)
|
||||
if (delayedtoken == Actor.InvalidConditionToken)
|
||||
token = self.GrantCondition(info.Condition);
|
||||
else
|
||||
{
|
||||
if (delayedtoken == Actor.InvalidConditionToken)
|
||||
token = self.GrantCondition(info.Condition);
|
||||
else
|
||||
{
|
||||
token = delayedtoken;
|
||||
delayedtoken = Actor.InvalidConditionToken;
|
||||
}
|
||||
token = delayedtoken;
|
||||
delayedtoken = Actor.InvalidConditionToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,15 +97,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var palettePresetRows = 2;
|
||||
var paletteCustomRows = 1;
|
||||
|
||||
if (logicArgs.TryGetValue("PaletteColumns", out var yaml))
|
||||
if (!int.TryParse(yaml.Value, out paletteCols))
|
||||
throw new YamlException($"Invalid value for PaletteColumns: {yaml.Value}");
|
||||
if (logicArgs.TryGetValue("PalettePresetRows", out yaml))
|
||||
if (!int.TryParse(yaml.Value, out palettePresetRows))
|
||||
throw new YamlException($"Invalid value for PalettePresetRows: {yaml.Value}");
|
||||
if (logicArgs.TryGetValue("PaletteCustomRows", out yaml))
|
||||
if (!int.TryParse(yaml.Value, out paletteCustomRows))
|
||||
throw new YamlException($"Invalid value for PaletteCustomRows: {yaml.Value}");
|
||||
if (logicArgs.TryGetValue("PaletteColumns", out var yaml) && !int.TryParse(yaml.Value, out paletteCols))
|
||||
throw new YamlException($"Invalid value for PaletteColumns: {yaml.Value}");
|
||||
if (logicArgs.TryGetValue("PalettePresetRows", out yaml) && !int.TryParse(yaml.Value, out palettePresetRows))
|
||||
throw new YamlException($"Invalid value for PalettePresetRows: {yaml.Value}");
|
||||
if (logicArgs.TryGetValue("PaletteCustomRows", out yaml) && !int.TryParse(yaml.Value, out paletteCustomRows))
|
||||
throw new YamlException($"Invalid value for PaletteCustomRows: {yaml.Value}");
|
||||
|
||||
var presetColors = colorManager.PresetColors;
|
||||
for (var j = 0; j < palettePresetRows; j++)
|
||||
|
||||
@@ -140,15 +140,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
// Check for duplicate actor ID
|
||||
if (!CurrentActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase))
|
||||
if (!CurrentActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase) && editorActorLayer[actorId] != null)
|
||||
{
|
||||
if (editorActorLayer[actorId] != null)
|
||||
{
|
||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||
actorIDErrorLabel.Text = TranslationProvider.GetString(DuplicateActorId);
|
||||
actorIDErrorLabel.Visible = true;
|
||||
return;
|
||||
}
|
||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||
actorIDErrorLabel.Text = TranslationProvider.GetString(DuplicateActorId);
|
||||
actorIDErrorLabel.Visible = true;
|
||||
return;
|
||||
}
|
||||
|
||||
SetActorID(actorId);
|
||||
|
||||
@@ -100,27 +100,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
badgesVisible = false;
|
||||
|
||||
if (localProfile.State == LocalPlayerProfile.LinkState.Linked)
|
||||
if (localProfile.State == LocalPlayerProfile.LinkState.Linked && localProfile.ProfileData.Badges.Count > 0)
|
||||
{
|
||||
if (localProfile.ProfileData.Badges.Count > 0)
|
||||
{
|
||||
Func<int, int> negotiateWidth = _ => widget.Get("PROFILE_HEADER").Bounds.Width;
|
||||
Func<int, int> negotiateWidth = _ => widget.Get("PROFILE_HEADER").Bounds.Width;
|
||||
|
||||
// Remove any stale badges that may be left over from a previous session
|
||||
badgeContainer.RemoveChildren();
|
||||
// Remove any stale badges that may be left over from a previous session
|
||||
badgeContainer.RemoveChildren();
|
||||
|
||||
var badges = Ui.LoadWidget("PLAYER_PROFILE_BADGES_INSERT", badgeContainer, new WidgetArgs()
|
||||
var badges = Ui.LoadWidget("PLAYER_PROFILE_BADGES_INSERT", badgeContainer, new WidgetArgs()
|
||||
{
|
||||
{ "worldRenderer", worldRenderer },
|
||||
{ "profile", localProfile.ProfileData },
|
||||
{ "negotiateWidth", negotiateWidth }
|
||||
});
|
||||
|
||||
if (badges.Bounds.Height > 0)
|
||||
{
|
||||
badgeContainer.Bounds.Height = badges.Bounds.Height;
|
||||
badgesVisible = true;
|
||||
}
|
||||
if (badges.Bounds.Height > 0)
|
||||
{
|
||||
badgeContainer.Bounds.Height = badges.Bounds.Height;
|
||||
badgesVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var keyhandler = widget.Get<LogicKeyListenerWidget>(parentName);
|
||||
keyhandler.AddHandler(e =>
|
||||
{
|
||||
if (e.Event == KeyInputEvent.Down)
|
||||
if (namedKey.IsActivatedBy(e))
|
||||
return OnHotkeyActivated(e);
|
||||
if (e.Event == KeyInputEvent.Down && namedKey.IsActivatedBy(e))
|
||||
return OnHotkeyActivated(e);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -107,16 +107,15 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
if (useClassicMouseStyle && HasMouseFocus)
|
||||
if (useClassicMouseStyle && HasMouseFocus &&
|
||||
!IsValidDragbox && World.Selection.Actors.Count != 0 &&
|
||||
!multiClick && uog.InputOverridesSelection(World, mousePos, mi))
|
||||
{
|
||||
if (!IsValidDragbox && World.Selection.Actors.Count != 0 && !multiClick && uog.InputOverridesSelection(World, mousePos, mi))
|
||||
{
|
||||
// Order units instead of selecting
|
||||
ApplyOrders(World, mi);
|
||||
isDragging = false;
|
||||
YieldMouseFocus(mi);
|
||||
return true;
|
||||
}
|
||||
// Order units instead of selecting
|
||||
ApplyOrders(World, mi);
|
||||
isDragging = false;
|
||||
YieldMouseFocus(mi);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (multiClick)
|
||||
|
||||
Reference in New Issue
Block a user