Traits open files via the Map.

This commit is contained in:
Paul Chote
2016-02-15 03:35:08 +00:00
parent 7106d7ecdf
commit d573e21a48
10 changed files with 14 additions and 13 deletions

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Lint
this.emitError = emitError;
var sequenceSource = map != null ? map.SequenceDefinitions : new List<MiniYamlNode>();
sequenceDefinitions = MiniYaml.Merge(modData.Manifest.Sequences.Select(s => MiniYaml.FromStream(modData.ModFiles.Open(s))).Append(sequenceSource));
sequenceDefinitions = MiniYaml.Merge(modData.Manifest.Sequences.Select(s => MiniYaml.FromStream(map.Open(s))).Append(sequenceSource));
var rules = map == null ? modData.DefaultRules : map.Rules;
var factions = rules.Actors["world"].TraitInfos<FactionInfo>().Select(f => f.InternalName).ToArray();

View File

@@ -13,6 +13,7 @@ using System.Drawing;
using System.IO;
using Eluant;
using OpenRA.Effects;
using OpenRA.FileSystem;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
@@ -165,7 +166,7 @@ namespace OpenRA.Mods.Common.Scripting
Stream s;
try
{
s = Game.ModData.ModFiles.Open(movie);
s = world.Map.Open(movie);
}
catch (FileNotFoundException e)
{

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
public void LoadPalettes(WorldRenderer wr)
{
wr.AddPalette(info.Name, new ImmutablePalette(Game.ModData.ModFiles.Open(world.TileSet.Palette), info.ShadowIndex), info.AllowModifiers);
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(world.TileSet.Palette), info.ShadowIndex), info.AllowModifiers);
}
public IEnumerable<string> PaletteNames { get { yield return info.Name; } }

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
public void LoadPalettes(WorldRenderer wr)
{
if (info.Tileset == null || info.Tileset.ToLowerInvariant() == world.Map.Tileset.ToLowerInvariant())
wr.AddPalette(info.Name, new ImmutablePalette(Game.ModData.ModFiles.Open(info.Filename), info.ShadowIndex), info.AllowModifiers);
wr.AddPalette(info.Name, new ImmutablePalette(world.Map.Open(info.Filename), info.ShadowIndex), info.AllowModifiers);
}
public IEnumerable<string> PaletteNames

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
public void LoadPalettes(WorldRenderer wr)
{
var filename = world.TileSet.PlayerPalette ?? world.TileSet.Palette;
wr.AddPalette(info.Name, new ImmutablePalette(Game.ModData.ModFiles.Open(filename), info.ShadowIndex), info.AllowModifiers);
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(filename), info.ShadowIndex), info.AllowModifiers);
}
}
}