protected static void DropNonMatchingStudents(ManagerCareer manager, Common.IStatGenerator stats, Lot lot) { LotOptions lotOptions = manager.GetLotOptions(lot); foreach (RabbitHole hole in lot.GetObjects <RabbitHole>()) { if (hole.CareerLocations == null) { continue; } foreach (CareerLocation location in hole.CareerLocations.Values) { if (location == null) { continue; } if (location.Career is School) { if (location.Workers == null) { continue; } foreach (SimDescription sim in new List <SimDescription>(location.Workers)) { try { if (!lotOptions.AllowCastes(stats, sim)) { if (sim.CareerManager != null) { if (sim.CareerManager.School != null) { sim.CareerManager.School.LeaveJobNow(Career.LeaveJobReason.kJobBecameInvalid); } sim.CareerManager.School = null; } manager.Scenarios.Post(new ScheduledAssignSchoolScenario(sim)); } } catch (Exception e) { Common.Exception(sim, e); } } } } } }