From e20a7ad4cf7b8f6a0f51b516c54d4975614a5188 Mon Sep 17 00:00:00 2001 From: Stefan Wouters-Yaowanasap Date: Tue, 20 Mar 2018 07:06:43 +0100 Subject: [PATCH] #460: Draw year lines/labels in PowerGraph screen --- src/Common.cs | 3 ++- src/Screens/PowerGraph.cs | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Common.cs b/src/Common.cs index 5963ef0f..f88bcf25 100644 --- a/src/Common.cs +++ b/src/Common.cs @@ -176,9 +176,10 @@ public static int TurnToYear(ushort turn) return (turn - 400) + 1850; } - public static string YearString(ushort turn) + public static string YearString(ushort turn, bool zeroAd = false) { int year = TurnToYear(turn); + if (zeroAd && year == 1) year = 0; if (year < 0) return string.Format("{0} BC", -year); return string.Format("{0} AD", year); diff --git a/src/Screens/PowerGraph.cs b/src/Screens/PowerGraph.cs index c0c198f9..84c89cda 100644 --- a/src/Screens/PowerGraph.cs +++ b/src/Screens/PowerGraph.cs @@ -45,8 +45,17 @@ public PowerGraph() : base(MouseCursor.None) this.Clear(8) .DrawText("CIVILIZATION POWERGraph", 0, 5, 100, 3) .DrawText("CIVILIZATION POWERGraph", 0, 15, 100, 2) - .DrawRectangle(4, 9, 312, 184) - .DrawText("4000BC", 1, 15, 0, 194); + .DrawRectangle(4, 9, 312, 184); + + for (int i = 0; i < 13; i++) + { + int xx = 4 + (i * 25); + ushort turn = (ushort)(i * 50); + if (turn > Game.GameTurn) break; + this.DrawLine(xx, 9, xx, 192); + if (turn % 100 != 0) continue; + this.DrawText(Common.YearString(turn).Replace(" ", ""), 1, 15, xx - 4, 194); + } Player[] players = Game.Players.Where(x => !(x.Civilization is Barbarian)).ToArray(); for (int i = 0; i < players.Length; i++)