Merge branch 'review/slice-9-ab'
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -239,11 +239,11 @@ public static class TalkCircles
|
||||
}
|
||||
|
||||
var total = candidates.Sum(pair => pair.Weight);
|
||||
var roll = (seed & int.MaxValue) % Math.Max(1, (int)(total * 1000)) / 1000f;
|
||||
var roll = Roll01(seed) * total;
|
||||
var cursor = 0f;
|
||||
foreach (var (topic, weight) in candidates.OrderBy(pair => pair.Topic.DefName, StringComparer.Ordinal))
|
||||
{
|
||||
cursor += weight / total;
|
||||
cursor += weight;
|
||||
if (roll <= cursor)
|
||||
{
|
||||
return topic.DefName;
|
||||
|
||||
@@ -138,6 +138,12 @@ public sealed class School : IDisposable
|
||||
|
||||
internal Dictionary<string, ApologyDebt> ApologyDebts { get; } = new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
/// A finished or interrupted circle wrote opinions onto the roster. <see cref="Tick"/>
|
||||
/// returns this so the worker persists <c>people.json</c> — same seam as morning dress.
|
||||
/// </summary>
|
||||
internal bool RosterTalkDirty { get; set; }
|
||||
|
||||
internal void ResetDayLog()
|
||||
{
|
||||
_dayLog.Clear();
|
||||
@@ -400,6 +406,8 @@ public sealed class School : IDisposable
|
||||
peopleChanged |= AffinitySystem.Apply(this, talked);
|
||||
}
|
||||
|
||||
peopleChanged |= RosterTalkDirty;
|
||||
RosterTalkDirty = false;
|
||||
return peopleChanged;
|
||||
}
|
||||
|
||||
|
||||
@@ -523,6 +523,7 @@ internal static class TalkCircleSystem
|
||||
}
|
||||
|
||||
school.TalkCirclesById.Remove(circle.Id);
|
||||
school.RosterTalkDirty = true;
|
||||
}
|
||||
|
||||
private static bool TryCatchWhisper(School school, ActiveTalkCircle circle)
|
||||
|
||||
Reference in New Issue
Block a user