Merge branch 'review/slice-9-ab'

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 13:40:20 +03:00
co-authored by Cursor
11 changed files with 338 additions and 2 deletions
+2 -2
View File
@@ -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;
+8
View File
@@ -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)