Maps as packages. Disable broken map selector.

This commit is contained in:
Paul Chote
2010-04-03 18:33:32 +13:00
committed by Bob
parent fd5539d110
commit 4e0170a437
11 changed files with 81 additions and 63 deletions

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using OpenRA.Collections;
using OpenRA.Effects;
using OpenRA.FileFormats;
@@ -78,7 +79,27 @@ namespace OpenRA
{
Timer.Time( "----World.ctor" );
Map = new Map( Game.LobbyInfo.GlobalSettings.Map );
// TODO: Do this properly
string mapPath = null;
foreach (var mod in Game.LobbyInfo.GlobalSettings.Mods)
{
var path = "mods/"+mod+"/maps/"+Game.LobbyInfo.GlobalSettings.Map+"/";
if (Directory.Exists(path))
{
mapPath = path;
break;
}
}
if (mapPath == null)
{
var path = "maps/"+Game.LobbyInfo.GlobalSettings.Map+"/";
if (!Directory.Exists(path))
throw new InvalidDataException("Unknown map `{0}`".F(Game.LobbyInfo.GlobalSettings.Map));
mapPath = path;
}
Map = new Map( new Folder(mapPath) );
customTerrain = new ICustomTerrain[Map.MapSize.X, Map.MapSize.Y];
Timer.Time( "new Map: {0}" );