Define ToString methods on the main models

This commit is contained in:
Jaculabilis 2022-03-15 17:36:47 -07:00
parent 9e1782c401
commit 70b004edab
5 changed files with 27 additions and 0 deletions

View File

@ -41,6 +41,13 @@ public class Location
this.AdjacentList = new List<Location>();
}
public override string ToString()
{
return this.Name == null
? $"{this.Province.Name} ({this.Type})"
: $"{this.Province.Name} ({this.Type}:{this.Name}]";
}
/// <summary>
/// Set another location as bordering this location.
/// </summary>

View File

@ -14,4 +14,9 @@ public class Power
{
this.Name = name;
}
public override string ToString()
{
return this.Name;
}
}

View File

@ -40,6 +40,11 @@ public class Province
this.LocationList = new List<Location>();
}
public override string ToString()
{
return this.Name;
}
/// <summary>
/// Create a new province with no supply center.
/// </summary>

View File

@ -64,6 +64,11 @@ public class Season
}
}
public override string ToString()
{
return $"{this.Turn}:{this.Timeline}";
}
/// <summary>
/// Create a root season at the beginning of time.
/// </summary>

View File

@ -39,6 +39,11 @@ public class Unit
this.Type = type;
}
public override string ToString()
{
return $"{this.Power} {this.Type} {this.Location.Province} {this.Season}";
}
/// <summary>
/// Create a new unit. No validation is performed; the adjudicator should only call this
/// method after accepting a build order.