Resources stuff works with overlay names, not indices

This commit is contained in:
Paul Chote
2010-03-04 09:46:21 +13:00
parent 5a7ba347ee
commit 6ad23a191d
3 changed files with 13 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA. * This file is part of OpenRA.
@@ -24,7 +24,7 @@ namespace OpenRA.Traits
{ {
public class ResourceTypeInfo : ITraitInfo public class ResourceTypeInfo : ITraitInfo
{ {
public readonly int[] Overlays = { }; public readonly string[] Overlays = { };
public readonly string[] SpriteNames = { }; public readonly string[] SpriteNames = { };
public readonly string Palette = "terrain"; public readonly string Palette = "terrain";

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -7,7 +7,7 @@ namespace OpenRA.Traits
{ {
class WallLoadHookInfo : ITraitInfo class WallLoadHookInfo : ITraitInfo
{ {
public readonly int[] OverlayIndices = { }; public readonly string[] OverlayTypes = { };
public readonly string ActorType = "brik"; public readonly string ActorType = "brik";
public object Create(Actor self) { return new WallLoadHook( self, this ); } public object Create(Actor self) { return new WallLoadHook( self, this ); }
@@ -27,7 +27,7 @@ namespace OpenRA.Traits
for (int y = map.YOffset; y < map.YOffset + map.Height; y++) for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.XOffset; x < map.XOffset + map.Width; x++) for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
if (info.OverlayIndices.Contains(w.Map.MapTiles[x, y].overlay)) if (info.OverlayTypes.Contains(w.Map.MapTiles[x, y].overlay))
w.CreateActor(info.ActorType, new int2(x, y), w.players[0]); // todo: neutral player or null? w.CreateActor(info.ActorType, new int2(x, y), w.players[0]); // todo: neutral player or null?
} }
} }

View File

@@ -213,25 +213,25 @@ World:
PowerDownButton: PowerDownButton:
WallLoadHook@sbag: WallLoadHook@sbag:
ActorType: sbag ActorType: sbag
OverlayIndices: 0,24 OverlayTypes: sbag
WallLoadHook@cycl: WallLoadHook@cycl:
ActorType: cycl ActorType: cycl
OverlayIndices: 1 OverlayTypes: cycl
WallLoadHook@brik: WallLoadHook@brik:
ActorType: brik ActorType: brik
OverlayIndices: 2 OverlayTypes: brik
WallLoadHook@fenc: WallLoadHook@fenc:
ActorType: fenc ActorType: fenc
OverlayIndices: 3 OverlayTypes: fenc
WallLoadHook@wood: WallLoadHook@wood:
ActorType: wood ActorType: wood
OverlayIndices: 4 OverlayTypes: wood
WallLoadHook@barb: WallLoadHook@barb:
ActorType: barb ActorType: barb
OverlayIndices: 23 OverlayTypes: barb
ResourceLayer: ResourceLayer:
ResourceType@ore: ResourceType@ore:
Overlays: 5,6,7,8 Overlays: gold01,gold02,gold03,gold04
Palette: terrain Palette: terrain
SpriteNames: gold01,gold02,gold03,gold04 SpriteNames: gold01,gold02,gold03,gold04
ValuePerUnit: 25 ValuePerUnit: 25
@@ -239,7 +239,7 @@ World:
GrowthInterval: .3 GrowthInterval: .3
SpreadInterval: .7 SpreadInterval: .7
ResourceType@gem: ResourceType@gem:
Overlays: 9,10,11,12 Overlays: gem01,gem02,gem03,gem04
Palette: terrain Palette: terrain
SpriteNames: gem01,gem02,gem03,gem04 SpriteNames: gem01,gem02,gem03,gem04
ValuePerUnit: 50 ValuePerUnit: 50