Skip to content

Commit

Permalink
Merge pull request #30 from penev92/fixSpriteImages
Browse files Browse the repository at this point in the history
Fixed incorrect detection of sprite sequence image
  • Loading branch information
penev92 authored Oct 23, 2022
2 parents b58215e + 4234a03 commit 4862bad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ protected override IEnumerable<CompletionItem> HandleRulesValue(CursorTarget cur
// NOTE: This will improve if/when we add the attribute.
if (traitInfo.TraitPropertyInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value != null
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))))
{
return spriteSequenceImageNames;
}
Expand Down Expand Up @@ -442,7 +442,7 @@ protected override IEnumerable<CompletionItem> HandleWeaponValue(CursorTarget cu
// Pretend there is such a thing as a "SequenceImageReferenceAttribute" until we add it in OpenRA one day.
// NOTE: This will improve if/when we add the attribute.
if (fieldInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))))
{
return spriteSequenceImageNames;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected override IEnumerable<Location> HandleRulesValue(CursorTarget cursorTar
// Pretend there is such a thing as a "SequenceImageReferenceAttribute" until we add it in OpenRA one day.
// NOTE: This will improve if/when we add the attribute.
if (traitInfo.TraitPropertyInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))))
{
return spriteSequenceImageDefinitions[cursorTarget.TargetString].Select(x => x.Location.ToLspLocation(x.Name.Length));
}
Expand Down Expand Up @@ -360,7 +360,7 @@ protected override IEnumerable<Location> HandleWeaponValue(CursorTarget cursorTa
// Pretend there is such a thing as a "SequenceImageReferenceAttribute" until we add it in OpenRA one day.
// NOTE: This will improve if/when we add the attribute.
if (fieldInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))))
{
return spriteSequenceImageDefinitions[cursorTarget.TargetString].Select(x => x.Location.ToLspLocation(x.Name.Length));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ protected override Hover HandleRulesValue(CursorTarget cursorTarget)
// Pretend there is such a thing as a "SequenceImageReferenceAttribute" until we add it in OpenRA one day.
// NOTE: This will improve if/when we add the attribute.
if (traitInfo.TraitPropertyInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& spriteSequenceImageDefinitions.Contains(cursorTarget.TargetString))
{
var image = spriteSequenceImageDefinitions[cursorTarget.TargetString].First();
Expand Down Expand Up @@ -482,7 +482,7 @@ protected override Hover HandleWeaponValue(CursorTarget cursorTarget)
// Pretend there is such a thing as a "SequenceImageReferenceAttribute" until we add it in OpenRA one day.
// NOTE: This will improve if/when we add the attribute.
if (fieldInfos.Any(x => x.OtherAttributes.Any(y => y.Name == "SequenceReference"
&& y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name))
&& (y.Value.Contains(',') ? y.Value.Substring(0, y.Value.IndexOf(',')) == fieldInfo.Name : y.Value == fieldInfo.Name)))
&& spriteSequenceImageDefinitions.Contains(cursorTarget.TargetString))
{
var image = spriteSequenceImageDefinitions[cursorTarget.TargetString].First();
Expand Down

0 comments on commit 4862bad

Please sign in to comment.