Skip to content

Commit

Permalink
Copy map instead of passing it along
Browse files Browse the repository at this point in the history
  • Loading branch information
Majiir committed Sep 6, 2014
1 parent 81ffc76 commit ea36d4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Plugin/Kethane/Generators/CellularResourceGenerator.cs
Expand Up @@ -12,7 +12,7 @@ public IBodyResources Load(CelestialBody body, ConfigNode node)
{
var amounts = new CellMap<double>(KethaneData.GridLevel);
Initialize(body, amounts);
return new BodyResources(amounts);
return new BodyResources(new CellMap<double>(amounts));
}
else
{
Expand Down
5 changes: 5 additions & 0 deletions Plugin/KethaneGeodesicGrid/GeodesicGrid/CellMap.cs
Expand Up @@ -19,6 +19,11 @@ public CellMap(int level, Func<Cell, T> selector)
values = Cell.AtLevel(level).Select(selector).ToArray();
}

public CellMap(CellMap<T> other)
{
values = other.values.ToArray();
}

public int Level
{
get { return new Cell((uint)values.Length - 1).Level; }
Expand Down

0 comments on commit ea36d4d

Please sign in to comment.