moved SpawnPoints to Map
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using IjwFramework.Types;
|
||||||
|
|
||||||
namespace OpenRa.FileFormats
|
namespace OpenRa.FileFormats
|
||||||
{
|
{
|
||||||
@@ -21,6 +23,8 @@ namespace OpenRa.FileFormats
|
|||||||
public readonly TileReference[ , ] MapTiles = new TileReference[ 128, 128 ];
|
public readonly TileReference[ , ] MapTiles = new TileReference[ 128, 128 ];
|
||||||
public readonly List<TreeReference> Trees = new List<TreeReference>();
|
public readonly List<TreeReference> Trees = new List<TreeReference>();
|
||||||
|
|
||||||
|
public readonly IEnumerable<int2> SpawnPoints;
|
||||||
|
|
||||||
static string Truncate( string s, int maxLength )
|
static string Truncate( string s, int maxLength )
|
||||||
{
|
{
|
||||||
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
|
return s.Length <= maxLength ? s : s.Substring(0,maxLength );
|
||||||
@@ -49,6 +53,12 @@ namespace OpenRa.FileFormats
|
|||||||
UnpackTileData(ReadPackedSection(file.GetSection("MapPack")));
|
UnpackTileData(ReadPackedSection(file.GetSection("MapPack")));
|
||||||
UnpackOverlayData(ReadPackedSection(file.GetSection("OverlayPack")));
|
UnpackOverlayData(ReadPackedSection(file.GetSection("OverlayPack")));
|
||||||
ReadTrees(file);
|
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)
|
static MemoryStream ReadPackedSection(IniSection mapPackSection)
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ namespace OpenRa
|
|||||||
static HardwarePalette palette;
|
static HardwarePalette palette;
|
||||||
static string mapName;
|
static string mapName;
|
||||||
internal static Session LobbyInfo = new Session();
|
internal static Session LobbyInfo = new Session();
|
||||||
internal static int2[] SpawnPoints;
|
|
||||||
static bool changePending;
|
static bool changePending;
|
||||||
|
|
||||||
public static void ChangeMap(string mapName)
|
public static void ChangeMap(string mapName)
|
||||||
@@ -87,12 +86,6 @@ namespace OpenRa
|
|||||||
skipMakeAnims = false;
|
skipMakeAnims = false;
|
||||||
|
|
||||||
chrome = new Chrome(renderer);
|
chrome = new Chrome(renderer);
|
||||||
|
|
||||||
SpawnPoints = Rules.AllRules.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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Initialize(string mapName, Renderer renderer, int2 clientSize,
|
internal static void Initialize(string mapName, Renderer renderer, int2 clientSize,
|
||||||
@@ -251,7 +244,7 @@ namespace OpenRa
|
|||||||
|
|
||||||
public static void StartGame()
|
public static void StartGame()
|
||||||
{
|
{
|
||||||
var available = SpawnPoints.ToList();
|
var available = world.Map.SpawnPoints.ToList();
|
||||||
var taken = new List<int2>();
|
var taken = new List<int2>();
|
||||||
|
|
||||||
foreach (var client in LobbyInfo.Clients)
|
foreach (var client in LobbyInfo.Clients)
|
||||||
|
|||||||
Reference in New Issue
Block a user