Summary
In SWLOR.Game.Server/Service/Property.cs, the ProcessCityElections method has an inverted condition for detecting tied votes. The comment says the incumbent mayor should win when the top two candidates are tied, but the condition uses != instead of ==, causing the incumbent to be kept in place whenever the top two candidates have different vote counts — i.e., when there is a clear winner. The actual winner never receives the city in this scenario.
Affected Code
// Comment: "If top two are the same, incumbent mayor wins."
else if (orderedVotes.Count >= 2 && orderedVotes.ElementAt(0).Value != orderedVotes.ElementAt(1).Value)
// ^^^ should be ==
{
Log.Write(LogGroup.Property, $"Top 2 candidates were tied. Incumbent mayor '{incumbentMayorId}' wins the election.");
}
Suggested Fix
Change the condition from != to ==:
else if (orderedVotes.Count >= 2 && orderedVotes.ElementAt(0).Value == orderedVotes.ElementAt(1).Value)
{
Log.Write(LogGroup.Property, $"Top 2 candidates were tied. Incumbent mayor '{incumbentMayorId}' wins the election.");
}
References
Summary
In
SWLOR.Game.Server/Service/Property.cs, theProcessCityElectionsmethod has an inverted condition for detecting tied votes. The comment says the incumbent mayor should win when the top two candidates are tied, but the condition uses!=instead of==, causing the incumbent to be kept in place whenever the top two candidates have different vote counts — i.e., when there is a clear winner. The actual winner never receives the city in this scenario.Affected Code
Suggested Fix
Change the condition from
!=to==:References
SWLOR.Game.Server/Service/Property.cs