Skip to content

Commit

Permalink
Fixed crash for worlds with only 1 race.
Browse files Browse the repository at this point in the history
  • Loading branch information
Parker147 committed Aug 1, 2014
1 parent 3d2d0a1 commit 15b6a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion LegendsViewer/Legends/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ private void GenerateCivIdenticons()
//19+ reduced color variance
int maxHue = 300;
int colorVariance;
if (races.Count <= 6) colorVariance = Convert.ToInt32(Math.Floor(maxHue / Convert.ToDouble(races.Count - 1)));
if (races.Count <= 1)
colorVariance = 0;
else if (races.Count <= 6) colorVariance = Convert.ToInt32(Math.Floor(maxHue / Convert.ToDouble(races.Count - 1)));
else if (races.Count > 18) colorVariance = Convert.ToInt32(Math.Floor(maxHue / (Math.Ceiling(races.Count / 3.0) - 1)));
else colorVariance = 60;

Expand Down
3 changes: 2 additions & 1 deletion LegendsViewer/Legends/XMLParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class XMLParser
public XMLParser(World world, string xmlFile)
{
World = world;
XML = new XmlTextReader(xmlFile);
StreamReader reader = new StreamReader(xmlFile, Encoding.GetEncoding("windows-1252"));
XML = new XmlTextReader(reader);
XML.WhitespaceHandling = WhitespaceHandling.Significant;
}

Expand Down

0 comments on commit 15b6a8e

Please sign in to comment.