Renamed Map to CityMap

This commit is contained in:
2015-06-17 12:07:02 +03:00
parent c40690eb85
commit 670f260a4c
23 changed files with 30 additions and 39 deletions

View File

@ -17,7 +17,7 @@ namespace TransportGame.Generator
private float LotSquareMaxSize { get { return ConfigManager.Buildgen.LotSquareMaxSize; } }
private float LotSpacing { get { return ConfigManager.Buildgen.LotSpacing; } }
private Map map;
private CityMap map;
QuadTree<RoadNode> nodeTree;
QuadTree<BuildingLot> lotTree;
@ -214,7 +214,7 @@ namespace TransportGame.Generator
return b;
}
public void Generate(Map map)
public void Generate(CityMap map)
{
this.map = map;
map.Buildings = new List<Building>();

View File

@ -19,9 +19,9 @@ namespace TransportGame.Generator
/// <param name="width">Width</param>
/// <param name="height">Height</param>
/// <returns>City</returns>
public Map Generate(int width, int height)
public CityMap Generate(int width, int height)
{
Map map;
CityMap map;
// Generate terrain
TerrainGenerator terrainGen = new TerrainGenerator();

View File

@ -11,7 +11,7 @@ namespace TransportGame.Generator
{
System.Random random = new System.Random();
public void Generate(Map map)
public void Generate(CityMap map)
{
// Generate range
float mp = (float)(map.Width * map.Height) / (1024 * 1024); // For 4k x 4k range should be around 900

View File

@ -49,7 +49,7 @@ namespace TransportGame.Generator
List<RoadGeneratorSegment> queue;
System.Random random = new System.Random();
Map map;
CityMap map;
private float HighwaySegmentLength { get { return ConfigManager.Roadgen.HighwaySegmentLength; } }
private float DefaultBranchPopulationTreshold { get { return ConfigManager.Roadgen.DefaultBranchPopulationTreshold; } }
@ -71,7 +71,7 @@ namespace TransportGame.Generator
{
}
public void Initialize(Map map)
public void Initialize(CityMap map)
{
this.map = map;
map.RoadNetwork = new RoadNetwork();
@ -142,7 +142,7 @@ namespace TransportGame.Generator
return !map.IsInside(p.X, p.Y) || map.IsWater(p.X, p.Y) || map.GetSteepness(p.X, p.Y) > SteepnessLimit;
}
public void Generate(Map map)
public void Generate(CityMap map)
{
Initialize(map);

View File

@ -34,10 +34,10 @@ namespace TransportGame.Generator
Noise.Scale = ConfigManager.Tergen.ElevationScale;
}
public Map Generate(int width, int height)
public CityMap Generate(int width, int height)
{
// Create map
Map map = new Map(width, height);
CityMap map = new CityMap(width, height);
// Pick a random biome
map.Biome = PickBiome();
@ -61,7 +61,7 @@ namespace TransportGame.Generator
return BiomeManager.Biomes.ElementAt(biome);
}
private void GenerateElevation(Map map)
private void GenerateElevation(CityMap map)
{
for (int x = 0; x < map.Width; ++x)
for (int y = 0; y < map.Height; ++y)

View File

@ -10,7 +10,7 @@ using UnityEngine;
namespace TransportGame.Model
{
[XmlRoot("map")]
public class Map
public class CityMap
{
private float[,] heightmap;
@ -108,7 +108,7 @@ namespace TransportGame.Model
/// <remarks>
/// Warning: heights array will be null.
/// </remarks>
public Map()
public CityMap()
{
PopulationCenters = new List<Vector2>();
}
@ -118,7 +118,7 @@ namespace TransportGame.Model
/// </summary>
/// <param name="width">Width</param>
/// <param name="height">Height</param>
public Map(int width, int height)
public CityMap(int width, int height)
{
heightmap = new float[width, height];
PopulationCenters = new List<Vector2>();

View File

@ -14,10 +14,10 @@ namespace TransportGame.Unity
public Texture2D[] Textures { get; set; }
private GameObject parent = new GameObject("buildings");
private Map map;
private CityMap map;
private System.Random random = new System.Random();
public IEnumerable Generate(Map map)
public IEnumerable Generate(CityMap map)
{
this.map = map;
int i = 0;

View File

@ -35,7 +35,7 @@ namespace TransportGame.Unity
#region Private fields
private Map map;
private CityMap map;
private Dictionary<int, Vector2[]> segmentTerminal1Limit = new Dictionary<int, Vector2[]>();
private Dictionary<int, Vector2[]> segmentTerminal2Limit = new Dictionary<int, Vector2[]>();
@ -47,7 +47,7 @@ namespace TransportGame.Unity
public Material RoadMaterial { get; set; }
public Material SidewalkMaterial { get; set; }
public IEnumerable Generate(Map map)
public IEnumerable Generate(CityMap map)
{
this.map = map;

View File

@ -9,7 +9,7 @@ using UnityEngine;
public class TerrainGeneratorScript : MonoBehaviour
{
private Map map = null;
private CityMap map = null;
public int TerrainWidth = 1024;
public int TerrainHeight = 1024;

View File

@ -91,7 +91,7 @@ namespace TransportGame.Utils
Log(Level.Critical, "{0}: {1}\nStack trace:{2}", ex.GetType().ToString(), ex.Message, ex.StackTrace);
}
public static void DumpMap(Map map, string filename)
public static void DumpMap(CityMap map, string filename)
{
map.SerializeXml(Path.Combine(LogsDirectory, filename));
}