Skip to content

Commit 330293e

Browse files
committed
Fixes
1 parent 80a7e8c commit 330293e

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/microbe_stage/editor/PatchMapDrawer.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,12 @@ private void RebuildMap()
10741074
AddPatchNode(entry.Value, entry.Value.ScreenCoordinates);
10751075
}
10761076

1077+
// Hide excess cached indicators
1078+
for (var i = nextIndicatorIndex; i < playerSpeciesPopulationIndicators.Count - 1; i++)
1079+
{
1080+
playerSpeciesPopulationIndicators[i].Hide();
1081+
}
1082+
10771083
bool runNodeSelectionsUpdate = true;
10781084

10791085
if (SelectedPatch != null)
@@ -1136,19 +1142,9 @@ private void AddPlayerPopulationIndicators(Patch patch, Species playerSpecies, C
11361142
var playerPopulationIndicatorAmount = (int)Math.Ceiling(patch.GetSpeciesSimulationPopulation(playerSpecies) *
11371143
Constants.PLAYER_POPULATION_INDICATORS_PER_POPULATION);
11381144

1139-
var indicatorExcess = Math.Clamp(playerSpeciesPopulationIndicators.Count - playerPopulationIndicatorAmount,
1140-
0,
1141-
playerSpeciesPopulationIndicators.Count);
1142-
1143-
// Hide excess from the end of the list
1144-
for (int i = 0; i < indicatorExcess; ++i)
1145+
for (int i = 0; i < playerPopulationIndicatorAmount; ++i)
11451146
{
1146-
playerSpeciesPopulationIndicators[playerSpeciesPopulationIndicators.Count - i].Hide();
1147-
}
1148-
1149-
for (int i = nextIndicatorIndex; i < playerPopulationIndicatorAmount; ++i)
1150-
{
1151-
var noCached = i >= playerSpeciesPopulationIndicators.Count;
1147+
var noCached = nextIndicatorIndex >= playerSpeciesPopulationIndicators.Count;
11521148

11531149
Control indicator;
11541150
if (noCached)
@@ -1166,17 +1162,19 @@ private void AddPlayerPopulationIndicators(Patch patch, Species playerSpecies, C
11661162
}
11671163
else
11681164
{
1169-
indicator = playerSpeciesPopulationIndicators[i];
1165+
indicator = playerSpeciesPopulationIndicators[nextIndicatorIndex];
11701166

11711167
indicator.Show();
11721168
}
11731169

11741170
var nodeModifier = node.Position.LengthSquared();
11751171
var modifierSinus = MathF.Sin(i);
11761172

1177-
indicator.Position = position + node.Size * 0.5f + new Vector2(0, 35)
1173+
indicator.Position = position + node.Size * 0.5f + new Vector2(0, 40)
11781174
.Rotated(nodeModifier * 30) +
1179-
new Vector2(0, modifierSinus * 50).Rotated(i * 6 * modifierSinus + nodeModifier);
1175+
new Vector2(0, modifierSinus * 40).Rotated(i * 6 * modifierSinus + nodeModifier);
1176+
1177+
++nextIndicatorIndex;
11801178
}
11811179
}
11821180

0 commit comments

Comments
 (0)