From a3299d70307ad06ea77aee37e728df58d64cba23 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Wed, 30 Sep 2015 02:48:16 +0300 Subject: [PATCH] Unhardcode mod logo and preview image paths --- OpenRA.Game/ModMetadata.cs | 2 ++ OpenRA.Mods.Common/Widgets/Logic/ModBrowserLogic.cs | 4 ++-- mods/cnc/mod.yaml | 2 ++ mods/d2k/mod.yaml | 2 ++ mods/ra/mod.yaml | 2 ++ mods/ts/mod.yaml | 2 ++ 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/ModMetadata.cs b/OpenRA.Game/ModMetadata.cs index 09c30e3942..2d24c3fc73 100644 --- a/OpenRA.Game/ModMetadata.cs +++ b/OpenRA.Game/ModMetadata.cs @@ -25,6 +25,8 @@ namespace OpenRA public string Description; public string Version; public string Author; + public string LogoImagePath; + public string PreviewImagePath; public bool Hidden; public ContentInstaller Content; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ModBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ModBrowserLogic.cs index bab41933bc..81ad20fc94 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ModBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ModBrowserLogic.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { try { - using (var preview = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "preview.png"))) + using (var preview = new Bitmap(Platform.ResolvePath(mod.PreviewImagePath))) if (preview.Width == 296 && preview.Height == 196) previews.Add(mod.Id, sheetBuilder.Add(preview)); } @@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic try { - using (var logo = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "logo.png"))) + using (var logo = new Bitmap(Platform.ResolvePath(mod.LogoImagePath))) if (logo.Width == 96 && logo.Height == 96) logos.Add(mod.Id, sheetBuilder.Add(logo)); } diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 17177eae48..ea251587f2 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -3,6 +3,8 @@ Metadata: Description: Join the Global Defense Initiative or the Brotherhood of Nod in our\nrecreation of the classic game that started it all.\n\nTiberian Dawn modernizes the original Command & Conquer gameplay\nby introducing features from later games, including per-factory\nproduction queues, unit veterancy, and capturable tech structures. Version: {DEV_VERSION} Author: the OpenRA Developers + LogoImagePath: ./mods/cnc/logo.png + PreviewImagePath: ./mods/cnc/preview.png RequiresMods: modchooser: {DEV_VERSION} diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index b8171cf7f1..4cdc2b838e 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -3,6 +3,8 @@ Metadata: Description: Three great houses fight for the precious spice, melange.\nHe who controls the spice controls the universe!\n\nTry to establish a foothold on the desert planet Arrakis\nwith its harsh environmental conditions and protect your\nharvesting operations from giant sandworms as well as\nruthless enemy factions. Version: {DEV_VERSION} Author: the OpenRA Developers + LogoImagePath: ./mods/d2k/logo.png + PreviewImagePath: ./mods/d2k/preview.png RequiresMods: modchooser: {DEV_VERSION} diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index 4b188744e5..1d89a43aef 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -3,6 +3,8 @@ Metadata: Description: In a world where Hitler was assassinated and the Third Reich never\nexisted, the Soviet Union seeks power over all of Europe. Allied\nagainst this Evil Empire, the free world faces a Cold War turned hot.\n\nRed Alert fuses the quick and fun gameplay of the original\nC&C: Red Alert, with balance improvements and new gameplay\nfeatures inspired by modern RTS games. Version: {DEV_VERSION} Author: the OpenRA Developers + LogoImagePath: ./mods/ra/logo.png + PreviewImagePath: ./mods/ra/preview.png RequiresMods: modchooser: {DEV_VERSION} diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index 8429f84ef7..961f2f37c5 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -3,6 +3,8 @@ Metadata: Description: Developer stub, not yet ready for release! Version: {DEV_VERSION} Author: the OpenRA Developers + LogoImagePath: ./mods/ts/logo.png + PreviewImagePath: ./mods/ts/preview.png RequiresMods: modchooser: {DEV_VERSION}