Always name locations
This commit is contained in:
parent
228ad53cca
commit
442015b942
|
@ -20,12 +20,12 @@ public class Location
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location's full human-readable name.
|
/// The location's full human-readable name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location's shorthand abbreviation.
|
/// The location's shorthand abbreviation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Abbreviation { get; }
|
public string Abbreviation { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location's type.
|
/// The location's type.
|
||||||
|
@ -39,7 +39,7 @@ public class Location
|
||||||
public IEnumerable<Location> Adjacents => this.AdjacentList;
|
public IEnumerable<Location> Adjacents => this.AdjacentList;
|
||||||
private List<Location> AdjacentList { get; set; }
|
private List<Location> AdjacentList { get; set; }
|
||||||
|
|
||||||
public Location(Province province, string? name, string? abbreviation, LocationType type)
|
public Location(Province province, string name, string abbreviation, LocationType type)
|
||||||
{
|
{
|
||||||
this.Province = province;
|
this.Province = province;
|
||||||
this.Name = name;
|
this.Name = name;
|
||||||
|
@ -50,7 +50,7 @@ public class Location
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return this.Name == null
|
return this.Name == "land" || this.Name == "water"
|
||||||
? $"{this.Province.Name} ({this.Type})"
|
? $"{this.Province.Name} ({this.Type})"
|
||||||
: $"{this.Province.Name} ({this.Type}:{this.Name}]";
|
: $"{this.Province.Name} ({this.Type}:{this.Name}]";
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,10 +121,10 @@ public class Map
|
||||||
#region Provinces
|
#region Provinces
|
||||||
Province.Empty("North Africa", "NAF")
|
Province.Empty("North Africa", "NAF")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Tunis", "TUN")
|
Province.Supply("Tunis", "TUN")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Bohemia", "BOH")
|
Province.Empty("Bohemia", "BOH")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Supply("Budapest", "BUD")
|
Province.Supply("Budapest", "BUD")
|
||||||
|
@ -133,71 +133,71 @@ public class Map
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Supply("Trieste", "TRI")
|
Province.Supply("Trieste", "TRI")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Tyrolia", "TYR")
|
Province.Empty("Tyrolia", "TYR")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Time("Vienna", "VIE")
|
Province.Time("Vienna", "VIE")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Albania", "ALB")
|
Province.Empty("Albania", "ALB")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Bulgaria", "BUL")
|
Province.Supply("Bulgaria", "BUL")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation("east coast", "ec")
|
.AddCoastLocation("east coast", "ec")
|
||||||
.AddCoastLocation("south coast", "sc"),
|
.AddCoastLocation("south coast", "sc"),
|
||||||
Province.Supply("Greece", "GRE")
|
Province.Supply("Greece", "GRE")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Rumania", "RUM", "RMA")
|
Province.Supply("Rumania", "RUM", "RMA")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Serbia", "SER")
|
Province.Supply("Serbia", "SER")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Clyde", "CLY")
|
Province.Empty("Clyde", "CLY")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Edinburgh", "EDI")
|
Province.Supply("Edinburgh", "EDI")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Liverpool", "LVP", "LPL")
|
Province.Supply("Liverpool", "LVP", "LPL")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("London", "LON")
|
Province.Time("London", "LON")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Wales", "WAL")
|
Province.Empty("Wales", "WAL")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Yorkshire", "YOR")
|
Province.Empty("Yorkshire", "YOR")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Brest", "BRE")
|
Province.Supply("Brest", "BRE")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Burgundy", "BUR")
|
Province.Empty("Burgundy", "BUR")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Gascony", "GAS")
|
Province.Empty("Gascony", "GAS")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Marseilles", "MAR")
|
Province.Supply("Marseilles", "MAR")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("Paris", "PAR")
|
Province.Time("Paris", "PAR")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Picardy", "PIC")
|
Province.Empty("Picardy", "PIC")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("Berlin", "BER")
|
Province.Time("Berlin", "BER")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Kiel", "KIE")
|
Province.Supply("Kiel", "KIE")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Munich", "MUN")
|
Province.Supply("Munich", "MUN")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Prussia", "PRU")
|
Province.Empty("Prussia", "PRU")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Ruhr", "RUH", "RHR")
|
Province.Empty("Ruhr", "RUH", "RHR")
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Empty("Silesia", "SIL")
|
Province.Empty("Silesia", "SIL")
|
||||||
|
@ -208,43 +208,43 @@ public class Map
|
||||||
.AddCoastLocation("south coast", "sc"),
|
.AddCoastLocation("south coast", "sc"),
|
||||||
Province.Supply("Portugal", "POR")
|
Province.Supply("Portugal", "POR")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Apulia", "APU")
|
Province.Empty("Apulia", "APU")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Naples", "NAP")
|
Province.Supply("Naples", "NAP")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Piedmont", "PIE")
|
Province.Empty("Piedmont", "PIE")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("Rome", "ROM", "RME")
|
Province.Time("Rome", "ROM", "RME")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Tuscany", "TUS")
|
Province.Empty("Tuscany", "TUS")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Venice", "VEN")
|
Province.Supply("Venice", "VEN")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Belgium", "BEL")
|
Province.Supply("Belgium", "BEL")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Holland", "HOL")
|
Province.Supply("Holland", "HOL")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Finland", "FIN")
|
Province.Empty("Finland", "FIN")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Livonia", "LVN", "LVA")
|
Province.Empty("Livonia", "LVN", "LVA")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("Moscow", "MOS")
|
Province.Time("Moscow", "MOS")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Sevastopol", "SEV")
|
Province.Supply("Sevastopol", "SEV")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Saint Petersburg", "STP")
|
Province.Supply("Saint Petersburg", "STP")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation("north coast", "nc")
|
.AddCoastLocation("north coast", "nc")
|
||||||
|
@ -255,28 +255,28 @@ public class Map
|
||||||
.AddLandLocation(),
|
.AddLandLocation(),
|
||||||
Province.Supply("Denmark", "DEN")
|
Province.Supply("Denmark", "DEN")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Norway", "NWY")
|
Province.Supply("Norway", "NWY")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Sweden", "SWE")
|
Province.Supply("Sweden", "SWE")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Ankara", "ANK")
|
Province.Supply("Ankara", "ANK")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Armenia", "ARM")
|
Province.Empty("Armenia", "ARM")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Time("Constantinople", "CON")
|
Province.Time("Constantinople", "CON")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Supply("Smyrna", "SMY")
|
Province.Supply("Smyrna", "SMY")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Syria", "SYR")
|
Province.Empty("Syria", "SYR")
|
||||||
.AddLandLocation()
|
.AddLandLocation()
|
||||||
.AddCoastLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("Barents Sea", "BAR")
|
Province.Empty("Barents Sea", "BAR")
|
||||||
.AddOceanLocation(),
|
.AddOceanLocation(),
|
||||||
Province.Empty("English Channel", "ENC", "ECH")
|
Province.Empty("English Channel", "ENC", "ECH")
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class Province
|
||||||
this.Abbreviations = abbreviations;
|
this.Abbreviations = abbreviations;
|
||||||
this.IsSupplyCenter = isSupply;
|
this.IsSupplyCenter = isSupply;
|
||||||
this.IsTimeCenter = isTime;
|
this.IsTimeCenter = isTime;
|
||||||
this.LocationList = new List<Location>();
|
this.LocationList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -49,26 +49,26 @@ public class Province
|
||||||
/// Create a new province with no supply center.
|
/// Create a new province with no supply center.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Province Empty(string name, params string[] abbreviations)
|
public static Province Empty(string name, params string[] abbreviations)
|
||||||
=> new Province(name, abbreviations, isSupply: false, isTime: false);
|
=> new(name, abbreviations, isSupply: false, isTime: false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new province with a supply center.
|
/// Create a new province with a supply center.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Province Supply(string name, params string[] abbreviations)
|
public static Province Supply(string name, params string[] abbreviations)
|
||||||
=> new Province(name, abbreviations, isSupply: true, isTime: false);
|
=> new(name, abbreviations, isSupply: true, isTime: false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new province with a time center.
|
/// Create a new province with a time center.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Province Time(string name, params string[] abbreviations)
|
public static Province Time(string name, params string[] abbreviations)
|
||||||
=> new Province(name, abbreviations, isSupply: true, isTime: true);
|
=> new(name, abbreviations, isSupply: true, isTime: true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new land location in this province.
|
/// Create a new land location in this province.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Province AddLandLocation()
|
public Province AddLandLocation()
|
||||||
{
|
{
|
||||||
Location location = new Location(this, name: null, abbreviation: null, LocationType.Land);
|
Location location = new(this, "land", "l", LocationType.Land);
|
||||||
this.LocationList.Add(location);
|
this.LocationList.Add(location);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -78,19 +78,7 @@ public class Province
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Province AddOceanLocation()
|
public Province AddOceanLocation()
|
||||||
{
|
{
|
||||||
Location location = new Location(this, name: null, abbreviation: null, LocationType.Water);
|
Location location = new(this, "water", "w", LocationType.Water);
|
||||||
this.LocationList.Add(location);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new coastal location. Coastal locations must have names to disambiguate them
|
|
||||||
/// from the single land location in coastal provinces.
|
|
||||||
/// </summary>
|
|
||||||
public Province AddCoastLocation()
|
|
||||||
{
|
|
||||||
// Use a default name for provinces with only one coastal location
|
|
||||||
Location location = new Location(this, "coast", "c", LocationType.Water);
|
|
||||||
this.LocationList.Add(location);
|
this.LocationList.Add(location);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +89,7 @@ public class Province
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Province AddCoastLocation(string name, string abbreviation)
|
public Province AddCoastLocation(string name, string abbreviation)
|
||||||
{
|
{
|
||||||
Location location = new Location(this, name, abbreviation, LocationType.Water);
|
Location location = new(this, name, abbreviation, LocationType.Water);
|
||||||
this.LocationList.Add(location);
|
this.LocationList.Add(location);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue