From 55ff0ac1f4af25e008a7adfb6ecae77ec4f450cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 23 Apr 2023 17:49:46 +0200 Subject: [PATCH] Inline variables. --- OpenRA.Game/Map/MapPreview.cs | 14 +++++++++----- OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index f13b5602c7..3c9b0609d1 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -150,7 +150,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to load rules for `{0}` with error: {1}", Title, e.Message); + Log.Write("debug", $"Failed to load rules for `{Title}` with error:"); + Log.Write("debug", e); } WorldActorInfo = modData.DefaultRules.Actors[SystemActors.World]; @@ -463,7 +464,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed parsing mapserver minimap response: {0}", e); + Log.Write("debug", "Failed parsing mapserver minimap response:"); + Log.Write("debug", e); newData.Preview = null; } } @@ -477,7 +479,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed parsing mapserver response: {0}", e); + Log.Write("debug", "Failed parsing mapserver response:"); + Log.Write("debug", e); } // Commit updated data before running the callbacks @@ -544,7 +547,7 @@ namespace OpenRA await response.ReadAsStreamWithProgress(fileStream, OnDownloadProgress, CancellationToken.None); mapInstallPackage.Update(mapFilename, fileStream.ToArray()); - Log.Write("debug", "Downloaded map to '{0}'", mapFilename); + Log.Write("debug", $"Downloaded map to '{mapFilename}'"); var package = mapInstallPackage.OpenPackage(mapFilename, modData.ModFiles); if (package == null) @@ -557,7 +560,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Map installation failed with error: {0}", e); + Log.Write("debug", "Map installation failed with error:"); + Log.Write("debug", e); innerData.Status = MapStatus.DownloadError; } }); diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs index 0633db205f..f2ddbadce8 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs @@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Returns true if this is a shellmap and the player has paused animations.")] public bool IsPausedShellmap => Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; - [Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")] + [Desc("Returns the value of a `" + nameof(ScriptLobbyDropdown) + "` selected in the game lobby.")] public LuaValue LobbyOption(string id) { var option = Context.World.WorldActor.TraitsImplementing() @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Scripting if (option == null) { - Log.Write("lua", "A ScriptLobbyDropdown with ID `" + id + "` was not found."); + Log.Write("lua", $"A {nameof(ScriptLobbyDropdown)} with ID `{id}` was not found."); return null; }