Implement yearly intake functionality in school simulation, allowing for the graduation of students and the addition of new first-year pupils. Update the roster management to reflect these changes, ensuring proper entity handling in the simulation. Enhance the API to support name sets during roster installation and revise related tests to validate the new intake process and roster updates.
This commit is contained in:
@@ -239,6 +239,7 @@ internal sealed class SchoolWorker
|
||||
var lastTimestamp = Stopwatch.GetTimestamp();
|
||||
var accumulator = 0d;
|
||||
var lastSave = lastTimestamp;
|
||||
var peopleChanged = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -256,10 +257,11 @@ internal sealed class SchoolWorker
|
||||
lastTimestamp = now;
|
||||
|
||||
var steps = 0;
|
||||
peopleChanged = false;
|
||||
while (accumulator >= fixedDelta && steps < MaxCatchUpSteps)
|
||||
{
|
||||
var stepStarted = Stopwatch.GetTimestamp();
|
||||
school.Tick(fixedDelta, _options.GameMinutesPerRealSecond);
|
||||
peopleChanged |= school.Tick(fixedDelta, _options.GameMinutesPerRealSecond);
|
||||
_metrics.RecordTick(Stopwatch.GetElapsedTime(stepStarted, Stopwatch.GetTimestamp()).TotalMilliseconds);
|
||||
|
||||
accumulator -= fixedDelta;
|
||||
@@ -275,6 +277,11 @@ internal sealed class SchoolWorker
|
||||
accumulator = 0d;
|
||||
}
|
||||
|
||||
if (peopleChanged)
|
||||
{
|
||||
PersistPeople();
|
||||
}
|
||||
|
||||
if (steps > 0)
|
||||
{
|
||||
PublishSnapshot();
|
||||
@@ -508,7 +515,7 @@ internal sealed class SchoolWorker
|
||||
$"School {_id} roster does not match its map; the people file was left untouched.");
|
||||
}
|
||||
|
||||
school.InstallPeople(roster, seed);
|
||||
school.InstallPeople(roster, seed, nameSetId);
|
||||
return generated;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user