Allow resource placement outside the map cordon.
This commit is contained in:
@@ -65,10 +65,11 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
var underCursor = editorLayer.PreviewsAt(worldRenderer.Viewport.ViewToWorldPx(mi.Location))
|
||||
.FirstOrDefault();
|
||||
|
||||
var mapResources = world.Map.MapResources.Value;
|
||||
ResourceType type;
|
||||
if (underCursor != null)
|
||||
editorWidget.SetTooltip(underCursor.Tooltip);
|
||||
else if (world.Map.Contains(cell) && resources.TryGetValue(world.Map.MapResources.Value[cell].Type, out type))
|
||||
else if (mapResources.Contains(cell) && resources.TryGetValue(mapResources[cell].Type, out type))
|
||||
editorWidget.SetTooltip(type.Info.Name);
|
||||
else
|
||||
editorWidget.SetTooltip(null);
|
||||
@@ -84,8 +85,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (underCursor != null)
|
||||
editorLayer.Remove(underCursor);
|
||||
|
||||
if (world.Map.MapResources.Value[cell].Type != 0)
|
||||
world.Map.MapResources.Value[cell] = new ResourceTile();
|
||||
if (mapResources.Contains(cell) && mapResources[cell].Type != 0)
|
||||
mapResources[cell] = new ResourceTile();
|
||||
}
|
||||
else if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public bool AllowResourceAt(CPos cell)
|
||||
{
|
||||
if (!world.Map.Contains(cell))
|
||||
var mapResources = world.Map.MapResources.Value;
|
||||
if (!mapResources.Contains(cell))
|
||||
return false;
|
||||
|
||||
var tile = world.Map.MapTiles.Value[cell];
|
||||
@@ -92,7 +93,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var terrainType = world.TileSet.TerrainInfo[tileInfo.TerrainType];
|
||||
|
||||
if (world.Map.MapResources.Value[cell].Type == ResourceType.ResourceType)
|
||||
if (mapResources[cell].Type == ResourceType.ResourceType)
|
||||
return false;
|
||||
|
||||
if (!ResourceType.AllowedTerrainTypes.Contains(terrainType.Type))
|
||||
|
||||
Reference in New Issue
Block a user