#597 fix crash when spawning mapactors if there is no player in the slot. said actors are not spawned now.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
@@ -23,6 +24,11 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
foreach (var actorReference in world.Map.Actors.Value)
|
foreach (var actorReference in world.Map.Actors.Value)
|
||||||
{
|
{
|
||||||
|
// if there is no real player associated, dont spawn it.
|
||||||
|
var ownerName = actorReference.Value.InitDict.Get<OwnerInit>().PlayerName;
|
||||||
|
if (!world.players.Values.Any(p => p.InternalName == ownerName))
|
||||||
|
continue;
|
||||||
|
|
||||||
var initDict = actorReference.Value.InitDict;
|
var initDict = actorReference.Value.InitDict;
|
||||||
initDict.Add(new SkipMakeAnimsInit());
|
initDict.Add(new SkipMakeAnimsInit());
|
||||||
Actors[actorReference.Key] = world.CreateActor(actorReference.Value.Type, initDict);
|
Actors[actorReference.Key] = world.CreateActor(actorReference.Value.Type, initDict);
|
||||||
|
|||||||
BIN
mods/ra_perf/maps/571-testcase.oramap
Normal file
BIN
mods/ra_perf/maps/571-testcase.oramap
Normal file
Binary file not shown.
BIN
mods/ra_perf/maps/597-testcase.oramap
Normal file
BIN
mods/ra_perf/maps/597-testcase.oramap
Normal file
Binary file not shown.
Reference in New Issue
Block a user