* fractional weights dont work in StationEvents
* force-int
* sure why not, we can keep floats I guess.
return null;
}
- var sumOfWeights = 0;
+ var sumOfWeights = 0.0f;
foreach (var stationEvent in availableEvents.Values)
{
- sumOfWeights += (int) stationEvent.Weight;
+ sumOfWeights += stationEvent.Weight;
}
- sumOfWeights = _random.Next(sumOfWeights);
+ sumOfWeights = _random.NextFloat(sumOfWeights);
foreach (var (proto, stationEvent) in availableEvents)
{
- sumOfWeights -= (int) stationEvent.Weight;
+ sumOfWeights -= stationEvent.Weight;
- if (sumOfWeights <= 0)
+ if (sumOfWeights <= 0.0f)
{
return proto.ID;
}