Fix IDE0039

This commit is contained in:
RoosterDragon
2023-02-19 11:56:54 +00:00
committed by abcdefg30
parent 4b3f7034b2
commit d4135d608e
67 changed files with 498 additions and 505 deletions

View File

@@ -270,15 +270,14 @@ namespace OpenRA
{
OrderManager om = null;
Action lobbyReady = null;
lobbyReady = () =>
void LobbyReady()
{
LobbyInfoChanged -= lobbyReady;
LobbyInfoChanged -= LobbyReady;
foreach (var o in setupOrders)
om.IssueOrder(o);
};
}
LobbyInfoChanged += lobbyReady;
LobbyInfoChanged += LobbyReady;
om = JoinServer(CreateLocalServer(mapUID), "");
}

View File

@@ -124,7 +124,7 @@ namespace OpenRA
var fs = modData.DefaultFileSystem;
Ruleset ruleset = null;
Action f = () =>
void LoadRuleset()
{
var actors = MergeOrDefault("Manifest,Rules", fs, m.Rules, null, null,
k => new ActorInfo(modData.ObjectCreator, k.Key.ToLowerInvariant(), k.Value),
@@ -147,13 +147,13 @@ namespace OpenRA
// The default ruleset does not include a preferred tileset or sequence set
ruleset = new Ruleset(actors, weapons, voices, notifications, music, null, null, modelSequences);
};
}
if (modData.IsOnMainThread)
{
modData.HandleLoadingProgress();
var loader = new Task(f);
var loader = new Task(LoadRuleset);
loader.Start();
// Animate the loadscreen while we wait
@@ -161,7 +161,7 @@ namespace OpenRA
modData.HandleLoadingProgress();
}
else
f();
LoadRuleset();
return ruleset;
}
@@ -183,7 +183,7 @@ namespace OpenRA
var dr = modData.DefaultRules;
Ruleset ruleset = null;
Action f = () =>
void LoadRuleset()
{
var actors = MergeOrDefault("Rules", fileSystem, m.Rules, mapRules, dr.Actors,
k => new ActorInfo(modData.ObjectCreator, k.Key.ToLowerInvariant(), k.Value),
@@ -214,13 +214,13 @@ namespace OpenRA
k => k);
ruleset = new Ruleset(actors, weapons, voices, notifications, music, terrainInfo, sequences, modelSequences);
};
}
if (modData.IsOnMainThread)
{
modData.HandleLoadingProgress();
var loader = new Task(f);
var loader = new Task(LoadRuleset);
loader.Start();
// Animate the loadscreen while we wait
@@ -228,7 +228,7 @@ namespace OpenRA
modData.HandleLoadingProgress();
}
else
f();
LoadRuleset();
return ruleset;
}

View File

@@ -480,17 +480,17 @@ namespace OpenRA
AllEdgeCells = UpdateEdgeCells();
// Invalidate the entry for a cell if anything could cause the terrain index to change.
Action<CPos> invalidateTerrainIndex = c =>
void InvalidateTerrainIndex(CPos c)
{
if (cachedTerrainIndexes != null)
cachedTerrainIndexes[c] = InvalidCachedTerrainIndex;
};
}
// Even though the cache is lazily initialized, we must attach these event handlers on init.
// This ensures our handler to invalidate the cache runs first,
// so other listeners to these same events will get correct data when calling GetTerrainIndex.
CustomTerrain.CellEntryChanged += invalidateTerrainIndex;
Tiles.CellEntryChanged += invalidateTerrainIndex;
CustomTerrain.CellEntryChanged += InvalidateTerrainIndex;
Tiles.CellEntryChanged += InvalidateTerrainIndex;
}
void UpdateRamp(CPos cell)

View File

@@ -37,24 +37,24 @@ namespace OpenRA.Server
var status = cache[map];
var failed = false;
Action<string> onLintFailure = message =>
void OnLintFailure(string message)
{
Log.Write("server", "Map {0} failed lint with error: {1}", map.Title, message);
failed = true;
};
}
Action<string> onLintWarning = _ => { };
void OnLintWarning(string _) { }
foreach (var customMapPassType in modData.ObjectCreator.GetTypesImplementing<ILintServerMapPass>())
{
try
{
var customMapPass = (ILintServerMapPass)modData.ObjectCreator.CreateBasic(customMapPassType);
customMapPass.Run(onLintFailure, onLintWarning, modData, map, rules);
customMapPass.Run(OnLintFailure, OnLintWarning, modData, map, rules);
}
catch (Exception e)
{
onLintFailure(e.ToString());
OnLintFailure(e.ToString());
}
}

View File

@@ -541,7 +541,7 @@ namespace OpenRA.Server
return;
}
Action completeConnection = () =>
void CompleteConnection()
{
lock (LobbyInfo)
{
@@ -602,13 +602,13 @@ namespace OpenRA.Server
else if (Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots))
SendLocalizedMessageTo(newConn, BotsDisabled);
}
};
}
if (Type == ServerType.Local)
{
// Local servers can only be joined by the local client, so we can trust their identity without validation
client.Fingerprint = handshake.Fingerprint;
completeConnection();
CompleteConnection();
}
else if (!string.IsNullOrEmpty(handshake.Fingerprint) && !string.IsNullOrEmpty(handshake.AuthSignature))
{
@@ -678,7 +678,7 @@ namespace OpenRA.Server
DropClient(newConn);
}
else
completeConnection();
CompleteConnection();
}));
});
}
@@ -691,7 +691,7 @@ namespace OpenRA.Server
DropClient(newConn);
}
else
completeConnection();
CompleteConnection();
}
}
catch (Exception ex)

View File

@@ -93,9 +93,9 @@ namespace OpenRA
this.loaders = loaders;
this.fileSystem = fileSystem;
Func<ISoundFormat, ISoundSource> loadIntoMemory = soundFormat => soundEngine.AddSoundSourceFromMemory(
ISoundSource LoadIntoMemory(ISoundFormat soundFormat) => soundEngine.AddSoundSourceFromMemory(
soundFormat.GetPCMInputStream().ReadAllBytes(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate);
sounds = new Cache<string, ISoundSource>(filename => LoadSound(filename, loadIntoMemory));
sounds = new Cache<string, ISoundSource>(filename => LoadSound(filename, LoadIntoMemory));
currentSounds.Clear();
currentNotifications.Clear();
video = null;
@@ -252,11 +252,11 @@ namespace OpenRA
StopMusic();
Func<ISoundFormat, ISound> stream = soundFormat => soundEngine.Play2DStream(
ISound Stream(ISoundFormat soundFormat) => soundEngine.Play2DStream(
soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate,
looped, true, WPos.Zero, MusicVolume * m.VolumeModifier);
music = LoadSound(m.Filename, stream);
music = LoadSound(m.Filename, Stream);
if (music == null)
{
onMusicComplete = null;