add shel
This commit is contained in:
@@ -9,7 +9,7 @@ public static class RosterGenerator
|
||||
/// Matches <c>SimulationOptions.DefaultStartDate</c> so tests without a clock still sit in
|
||||
/// the default school year. Callers with a live clock must pass <paramref name="asOf"/>.
|
||||
/// </summary>
|
||||
public static readonly DateTime DefaultAsOf = new(2012, 4, 3, 6, 0, 0, DateTimeKind.Utc);
|
||||
public static readonly DateTime DefaultAsOf = new(2012, 3, 31, 6, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
public static Roster Generate(
|
||||
DefCatalog catalog,
|
||||
|
||||
@@ -33,7 +33,7 @@ public sealed class SchoolDemand
|
||||
|
||||
foreach (var room in map.Rooms)
|
||||
{
|
||||
var slots = PupilSlotsOf(catalog, room);
|
||||
var slots = RoomOccupancy.PupilSlots(catalog, room);
|
||||
if (catalog.Rooms.TryGetValue(room.Def, out var def))
|
||||
{
|
||||
foreach (var position in def.Positions)
|
||||
@@ -67,19 +67,4 @@ public sealed class SchoolDemand
|
||||
|
||||
return new SchoolDemand(classes, seats, staff);
|
||||
}
|
||||
|
||||
private static int PupilSlotsOf(DefCatalog catalog, RoomNode room)
|
||||
{
|
||||
var pupilSlots = 0L;
|
||||
foreach (var fill in room.Slots)
|
||||
{
|
||||
var count = fill.Count < 1 ? 1 : Math.Min(fill.Count, byte.MaxValue);
|
||||
if (catalog.Things.TryGetValue(fill.Thing, out var thing) && thing.PupilSlots > 0)
|
||||
{
|
||||
pupilSlots += (long)thing.PupilSlots * count;
|
||||
}
|
||||
}
|
||||
|
||||
return (int)Math.Clamp(pupilSlots, 0, ushort.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user