#1241 fixed - crash in ChooseBuildTabOnSelect.SelectionChanged
This commit is contained in:
@@ -31,14 +31,17 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void SelectionChanged()
|
public void SelectionChanged()
|
||||||
{
|
{
|
||||||
|
var palette = Widget.RootWidget.GetWidget<BuildPaletteWidget>("INGAME_BUILD_PALETTE");
|
||||||
|
if (palette == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// Queue-per-structure
|
// Queue-per-structure
|
||||||
var perqueue = world.Selection.Actors.FirstOrDefault(
|
var perqueue = world.Selection.Actors.FirstOrDefault(
|
||||||
a => a.IsInWorld && a.World.LocalPlayer == a.Owner && a.HasTrait<ProductionQueue>());
|
a => a.IsInWorld && a.World.LocalPlayer == a.Owner && a.HasTrait<ProductionQueue>());
|
||||||
|
|
||||||
if (perqueue != null)
|
if (perqueue != null)
|
||||||
{
|
{
|
||||||
Widget.RootWidget.GetWidget<BuildPaletteWidget>("INGAME_BUILD_PALETTE")
|
palette.SetCurrentTab(perqueue.TraitsImplementing<ProductionQueue>().First());
|
||||||
.SetCurrentTab(perqueue.TraitsImplementing<ProductionQueue>().First());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,8 +54,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (types.Length == 0)
|
if (types.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Widget.RootWidget.GetWidget<BuildPaletteWidget>("INGAME_BUILD_PALETTE")
|
palette.SetCurrentTab(world.LocalPlayer.PlayerActor.TraitsImplementing<ProductionQueue>()
|
||||||
.SetCurrentTab(world.LocalPlayer.PlayerActor.TraitsImplementing<ProductionQueue>()
|
|
||||||
.FirstOrDefault(t => types.Contains(t.Info.Type)));
|
.FirstOrDefault(t => types.Contains(t.Info.Type)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user