add shel
This commit is contained in:
@@ -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