Skip to content

Commit

Permalink
Revert "removed statWeighting conversion from 7 stat format"
Browse files Browse the repository at this point in the history
This reverts commit 9aa0e48.
  • Loading branch information
cadaei committed Jun 1, 2020
1 parent 9aa0e48 commit 0b89e26
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,37 @@ private void Form1_Load(object sender, EventArgs e)
Dictionary<string, double[]> custW = new Dictionary<string, double[]>();
if (custWs != null && custWd != null)
{
for (int i = 0; i < custWs.Length && i < custWd.Length; i++)
var newToOldIndicesStatWeightings = new int[] { 0, 1, -1, 2, 3, -1, -1, 4, 5, 6, -1, -1 };

// TODO remove this when new stat-order is established, e.g. in 6 months (2019-11)
// if statWeights use the old order, convert
for (int i = 0; i < custWd.Length; i++)
{
custW.Add(custWs[i], custWd[i]);
if (custWd[i].Length == 7)
{
double[] newOrder = new double[Values.STATS_COUNT];
for (int s = 0; s < Values.STATS_COUNT; s++)
{
if (newToOldIndicesStatWeightings[s] >= 0)
{
newOrder[s] = custWd[i][newToOldIndicesStatWeightings[s]];
}
else
{
newOrder[s] = 1;
}
}
custWd[i] = newOrder;
}
}
// end of conversion

for (int i = 0; i < custWs.Length; i++)
{
if (i < custWd.Length)
{
custW.Add(custWs[i], custWd[i]);
}
}
}
breedingPlan1.statWeighting.CustomWeightings = custW;
Expand Down

0 comments on commit 0b89e26

Please sign in to comment.