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>(); 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> /// <summary>
/// Set another location as bordering this location. /// Set another location as bordering this location.
/// </summary> /// </summary>

View File

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

View File

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

View File

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

View File

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