moved SpawnPoints to Map

This commit is contained in:
Bob
2010-01-18 02:58:03 +13:00
parent ab1abee843
commit fd6d2a1f99
2 changed files with 11 additions and 8 deletions

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using IjwFramework.Types;
namespace OpenRa.FileFormats
{
@@ -21,6 +23,8 @@ namespace OpenRa.FileFormats
public readonly TileReference[ , ] MapTiles = new TileReference[ 128, 128 ];
public readonly List<TreeReference> Trees = new List<TreeReference>();
public readonly IEnumerable<int2> SpawnPoints;
static string Truncate( string s, int maxLength )
{
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
@@ -49,6 +53,12 @@ namespace OpenRa.FileFormats
UnpackTileData(ReadPackedSection(file.GetSection("MapPack")));
UnpackOverlayData(ReadPackedSection(file.GetSection("OverlayPack")));
ReadTrees(file);
SpawnPoints = file.GetSection("Waypoints")
.Select(kv => Pair.New(int.Parse(kv.Key), new int2(int.Parse(kv.Value) % 128, int.Parse(kv.Value) / 128)))
.Where(a => a.First < 8)
.Select(a => a.Second)
.ToArray();
}
static MemoryStream ReadPackedSection(IniSection mapPackSection)