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