public static void BuildDescendantHouseholdSpecs(FutureDescendantService ths) { Common.StringBuilder msg = new Common.StringBuilder("BuildDescendantHouseholdSpecs"); try { if (Household.ActiveHousehold != null) { // Custom for (int i = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Count - 1; i >= 0; i--) { FutureDescendantService.FutureDescendantHouseholdInfo info = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i]; if (info.HasAncestorFromHousehold(Household.ActiveHousehold) && info.mProgenitorSimIds.Count != 4) { msg += Common.NewLine + "mProgenitorSimIds wasn't 4 (" + info.mProgenitorSimIds.Count + ") so removing " + info.mHouseholdName; FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info); FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.RemoveAt(i); } } // List <SimDescription> simDescriptions = Household.ActiveHousehold.SimDescriptions; foreach (SimDescription description in simDescriptions) { // Custom ProcessSim(ths, description); } foreach (SimDescription description2 in simDescriptions) { ths.GenerateAncestorMap(description2); } foreach (FutureDescendantService.FutureDescendantHouseholdInfo info in FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo) { if (info.HasAncestorFromHousehold(Household.ActiveHousehold)) { info.CalculateHouseholdScores(); } } } } catch (Exception e) { Common.Exception("", e); } finally { Common.DebugWriteLog(msg); } }
private static bool ProcessDescendantHouseholds(FutureDescendantService ths) { Common.StringBuilder msg = new Common.StringBuilder("ProcessDescendantHouseholds"); for (int i = 0x0; i < FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Count; i++) { try { FutureDescendantService.FutureDescendantHouseholdInfo info = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i]; Household descendantHousehold = info.DescendantHousehold; if (descendantHousehold != null) { if (Household.ActiveHousehold != null && info.HasAncestorFromHousehold(Household.ActiveHousehold)) { msg += Common.NewLine + "descendantHousehold is not null."; while (descendantHousehold.NumMembers > info.mCurrentDesiredHouseholdSize) { msg += Common.NewLine + "Removing descendant because the current size (" + descendantHousehold.NumMembers + ") is greater than the desired (" + info.mCurrentDesiredHouseholdSize + ")"; info.RemoveDescendant(); } while (descendantHousehold.NumMembers < info.mCurrentDesiredHouseholdSize) { msg += Common.NewLine + "Adding descendant because the current size (" + descendantHousehold.NumMembers + ") is less than the desired (" + info.mCurrentDesiredHouseholdSize + ")"; // Custom if (!FutureDescendantHouseholdInfoEx.CreateAndAddDescendant(info)) { break; } } foreach (ulong num2 in Household.mDirtyNameSimIds) { if (info.IsSimAProgenitor(num2)) { SimDescription description = SimDescription.Find(num2); if (description != null) { foreach (SimDescription description2 in info.DescendantHousehold.SimDescriptions) { description2.LastName = description.LastName; } } } } } } else { msg += Common.NewLine + "descendantHousehold is null so instatiating a new one."; // Custom Household household2 = FutureDescendantHouseholdInfoEx.Instantiate(info); FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i].mFutureDescendantHouseholdInfoDirty = true; if (household2 == null) { msg += Common.NewLine + "NULL"; } } } catch (Exception e) { Common.Exception(i.ToString(), e); } finally { Common.DebugWriteLog(msg); } } Household.ClearDirtyNameSimIDs(); return(true); }