public static void Prefix(uint citizenID, ref Citizen data, ref ushort sourceBuilding, ref ushort targetBuilding) { if (data.m_workBuilding != targetBuilding) { var building = Singleton <BuildingManager> .instance.m_buildings.m_buffer[targetBuilding]; if (building.Info.m_class.m_service == ItemClass.Service.Commercial) { CitizenManager instance = Singleton <CitizenManager> .instance; ushort homeBuilding = data.m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = data.GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); Citizen.BehaviourData behaviour = default; int aliveVisitCount = 0; int totalVisitCount = 0; RealCityCommercialBuildingAI.InitDelegate(); RealCityCommercialBuildingAI.GetVisitBehaviour((CommercialBuildingAI)(building.Info.m_buildingAI), targetBuilding, ref building, ref behaviour, ref aliveVisitCount, ref totalVisitCount); var amount = building.m_customBuffer2 / MainDataStore.maxGoodPurchase - totalVisitCount + aliveVisitCount; var CommercialBuildingAI = building.Info.m_buildingAI as CommercialBuildingAI; var maxCount = CommercialBuildingAI.CalculateVisitplaceCount((ItemClass.Level)building.m_level, new Randomizer(targetBuilding), building.m_width, building.m_length); if ((amount <= 0) || (maxCount <= totalVisitCount)) { //Close CommercialBuilding //Reject citizen to building which lack of goods sourceBuilding = targetBuilding; building.m_flags &= ~Building.Flags.Active; return; } if (data.m_flags.IsFlagSet(Citizen.Flags.Tourist)) { //DebugLog.LogToFileOnly("Find Tourist in HumanAIStartMovingPatch"); } else { //DebugLog.LogToFileOnly("Find Resident in HumanAIStartMovingPatch"); if (CitizenUnitData.familyMoney[containingUnit] < MainDataStore.maxGoodPurchase * RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping)) { //Reject poor citizen to building if (CitizenUnitData.familyGoods[containingUnit] > 1000) { //If a family is lacking goods very seriously, even they do not have enough money, they can buy goods. //minimumLivingAllowance will cover this expense. sourceBuilding = targetBuilding; return; } } else if (CitizenUnitData.familyGoods[containingUnit] > 2000) { //Reject citizen who already have enough goods to building sourceBuilding = targetBuilding; return; } } } } }
public static bool Prefix(ushort buildingID, ref Building data, uint citizen) { CitizenManager citizenManager = Singleton <CitizenManager> .instance; BuildingInfo buildingInfo = data.Info; if ((citizenManager.m_citizens.m_buffer[citizen].m_flags & Citizen.Flags.Tourist) != Citizen.Flags.None) { var consumptionMoney = -MainDataStore.maxGoodPurchase; buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Shopping, ref consumptionMoney); int priceInt = 0; IndustryBuildingGetResourcePricePatch.Prefix(ref priceInt, TransferManager.TransferReason.Shopping, data.Info.m_class.m_service); var m_goodsSellPrice = priceInt / 100; MainDataStore.outsideTouristMoney += (consumptionMoney * m_goodsSellPrice); } else { ushort homeBuilding = citizenManager.m_citizens.m_buffer[citizen].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = citizenManager.m_citizens.m_buffer[citizen].GetContainingUnit((uint)citizen, citizenUnit, CitizenUnit.Flags.Home); int priceInt = 0; IndustryBuildingGetResourcePricePatch.Prefix(ref priceInt, TransferManager.TransferReason.Shopping, data.Info.m_class.m_service); var m_goodsSellPrice = priceInt / 100; if (containingUnit != 0) { //int goodAmount = (int)(-(CitizenUnitData.familyMoney[containingUnit]) / m_goodsSellPrice); int goodAmount = -MainDataStore.maxGoodPurchase; if (goodAmount < 0) { buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Shopping, ref goodAmount); if (goodAmount != 0) { CitizenUnitData.familyGoods[containingUnit] = (ushort)(CitizenUnitData.familyGoods[containingUnit] - (goodAmount * 10)); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { citizenManager.m_citizens.m_buffer[citizen].m_flags &= ~Citizen.Flags.NeedGoods; } } } else { goodAmount = 0; } CitizenData.citizenMoney[citizen] = (CitizenData.citizenMoney[citizen] + goodAmount * m_goodsSellPrice); CitizenUnitData.familyMoney[containingUnit] = CitizenUnitData.familyMoney[containingUnit] + goodAmount * m_goodsSellPrice; } } Singleton <BuildingAI> .instance.VisitorEnter(buildingID, ref data, citizen); return(false); }
public static void Postfix(ref CitizenInstance citizenData) { CitizenManager instance = Singleton <CitizenManager> .instance; uint citizen = citizenData.m_citizen; if (citizen != 0) { ushort homeBuilding = instance.m_citizens.m_buffer[citizen].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizen].GetContainingUnit((uint)citizen, citizenUnit, CitizenUnit.Flags.Home); if (containingUnit != 0) { if (CitizenUnitData.familyGoods[containingUnit] < 2000) { instance.m_citizens.m_buffer[citizen].m_flags |= Citizen.Flags.NeedGoods; } } } }
public static void Prefix(ref CitizenInstance citizenData, ref Citizen.AgeGroup ageGroup) { if (RealCity.noPassengerCar) { CitizenManager instance = Singleton <CitizenManager> .instance; var citizenID = citizenData.m_citizen; ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if ((containingUnit == 0) || (citizenID == 0)) { //Change ageGroup to Child to disable car. ageGroup = Citizen.AgeGroup.Child; } else { if (CitizenUnitData.familyMoney[containingUnit] < MainDataStore.highWealth) { ageGroup = Citizen.AgeGroup.Child; } } } }
public static bool Prefix(TransferManager.TransferReason material, ref TransferManager.TransferOffer offer) { switch (material) { case TransferManager.TransferReason.Shopping: case TransferManager.TransferReason.ShoppingB: case TransferManager.TransferReason.ShoppingC: case TransferManager.TransferReason.ShoppingD: case TransferManager.TransferReason.ShoppingE: case TransferManager.TransferReason.ShoppingF: case TransferManager.TransferReason.ShoppingG: case TransferManager.TransferReason.ShoppingH: case TransferManager.TransferReason.Entertainment: case TransferManager.TransferReason.EntertainmentB: case TransferManager.TransferReason.EntertainmentC: case TransferManager.TransferReason.EntertainmentD: case TransferManager.TransferReason.TouristA: case TransferManager.TransferReason.TouristB: case TransferManager.TransferReason.TouristC: case TransferManager.TransferReason.TouristD: if (RealCity.realCityV10) { if (MainDataStore.outsideTouristMoney < 0) { if (Singleton <BuildingManager> .instance.m_buildings.m_buffer[offer.Building].Info.m_buildingAI is OutsideConnectionAI) { return(false); } } } break; case TransferManager.TransferReason.Oil: case TransferManager.TransferReason.Ore: case TransferManager.TransferReason.Coal: case TransferManager.TransferReason.Petrol: case TransferManager.TransferReason.Food: case TransferManager.TransferReason.Grain: case TransferManager.TransferReason.Lumber: case TransferManager.TransferReason.Logs: case TransferManager.TransferReason.Goods: case TransferManager.TransferReason.LuxuryProducts: case TransferManager.TransferReason.AnimalProducts: case TransferManager.TransferReason.Flours: case TransferManager.TransferReason.Petroleum: case TransferManager.TransferReason.Plastics: case TransferManager.TransferReason.Metals: case TransferManager.TransferReason.Glass: case TransferManager.TransferReason.PlanedTimber: case TransferManager.TransferReason.Paper: break; default: return(true); } if (offer.Citizen != 0) { var instance = Singleton <CitizenManager> .instance; ushort homeBuilding = instance.m_citizens.m_buffer[offer.Citizen].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[offer.Citizen].GetContainingUnit((uint)offer.Citizen, citizenUnit, CitizenUnit.Flags.Home); if (!instance.m_citizens.m_buffer[offer.Citizen].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { if (CitizenUnitData.familyMoney[containingUnit] < MainDataStore.maxGoodPurchase * RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping)) { //Reject poor citizen to building return(false); } } } else if (offer.Building != 0) { var instance = Singleton <BuildingManager> .instance; var buildingID = offer.Building; var buildingData = instance.m_buildings.m_buffer[buildingID]; if (buildingData.Info.m_class.m_service == ItemClass.Service.Industrial) { RealCityIndustrialBuildingAI.InitDelegate(); RealCityCommonBuildingAI.InitDelegate(); var industrialBuildingAI = buildingData.Info.m_buildingAI as IndustrialBuildingAI; TransferManager.TransferReason incomingTransferReason = RealCityIndustrialBuildingAI.GetIncomingTransferReason((IndustrialBuildingAI)(buildingData.Info.m_buildingAI), buildingID); TransferManager.TransferReason secondaryIncomingTransferReason = RealCityIndustrialBuildingAI.GetSecondaryIncomingTransferReason((IndustrialBuildingAI)(buildingData.Info.m_buildingAI), buildingID); int maxIncomingLoadSize = RealCityIndustrialBuildingAI.MaxIncomingLoadSize((IndustrialBuildingAI)(buildingData.Info.m_buildingAI)); int num = 0; int num1 = 0; int incomingCargoCapacity = 0; int value = 0; if (incomingTransferReason != TransferManager.TransferReason.None) { if (secondaryIncomingTransferReason != TransferManager.TransferReason.None) { RealCityCommonBuildingAI.CalculateGuestVehicles1((IndustrialBuildingAI)(buildingData.Info.m_buildingAI), buildingID, ref buildingData, incomingTransferReason, secondaryIncomingTransferReason, ref num, ref num1, ref incomingCargoCapacity, ref value); } else { RealCityCommonBuildingAI.CalculateGuestVehicles((IndustrialBuildingAI)(buildingData.Info.m_buildingAI), buildingID, ref buildingData, incomingTransferReason, ref num, ref num1, ref incomingCargoCapacity, ref value); } } int productionCapacity = industrialBuildingAI.CalculateProductionCapacity((ItemClass.Level)buildingData.m_level, new Randomizer((int)buildingID), buildingData.m_width, buildingData.m_length); int consumptionDivider = RealCityIndustrialBuildingAI.GetConsumptionDivider((IndustrialBuildingAI)(buildingData.Info.m_buildingAI)); int fullCapacity = Mathf.Max(productionCapacity * 500 / consumptionDivider, maxIncomingLoadSize * 4); int incomingAmontNeeded = fullCapacity - (int)buildingData.m_customBuffer1 - incomingCargoCapacity; incomingAmontNeeded -= 8000; if (incomingAmontNeeded < 0) { return(false); } else { if (material == incomingTransferReason) { //first remove. //game bug, will send 2 incomingTransferReason per period TransferManager.TransferOffer offer1 = default; offer1.Building = buildingID; Singleton <TransferManager> .instance.RemoveIncomingOffer(incomingTransferReason, offer1); } } } else if (buildingData.Info.m_class.m_service == ItemClass.Service.Commercial) { RealCityCommercialBuildingAI.InitDelegate(); RealCityCommonBuildingAI.InitDelegate(); var commercialBuildingAI = buildingData.Info.m_buildingAI as CommercialBuildingAI; int maxIncomingLoadSize = RealCityCommercialBuildingAI.MaxIncomingLoadSize((CommercialBuildingAI)(buildingData.Info.m_buildingAI)); int visitplaceCount = commercialBuildingAI.CalculateVisitplaceCount((ItemClass.Level)buildingData.m_level, new Randomizer((int)buildingID), buildingData.m_width, buildingData.m_length); int fullCapacity = Mathf.Max(visitplaceCount * 500, maxIncomingLoadSize * 4); int num = 0; int num1 = 0; int incomingCargoCapacity = 0; int value = 0; TransferManager.TransferReason incomingTransferReason = RealCityCommercialBuildingAI.GetIncomingTransferReason((CommercialBuildingAI)(buildingData.Info.m_buildingAI)); if (incomingTransferReason != TransferManager.TransferReason.None) { if (incomingTransferReason == TransferManager.TransferReason.Goods || incomingTransferReason == TransferManager.TransferReason.Food) { RealCityCommonBuildingAI.CalculateGuestVehicles1((CommercialBuildingAI)(buildingData.Info.m_buildingAI), buildingID, ref buildingData, incomingTransferReason, TransferManager.TransferReason.LuxuryProducts, ref num, ref num1, ref incomingCargoCapacity, ref value); } else { RealCityCommonBuildingAI.CalculateGuestVehicles((CommercialBuildingAI)(buildingData.Info.m_buildingAI), buildingID, ref buildingData, incomingTransferReason, ref num, ref num1, ref incomingCargoCapacity, ref value); } buildingData.m_tempImport = (byte)Mathf.Clamp(value, (int)buildingData.m_tempImport, 255); } int incomingAmontNeeded = fullCapacity - (int)buildingData.m_customBuffer1 - incomingCargoCapacity; incomingAmontNeeded -= 6000; if (incomingAmontNeeded < 0) { return(false); } } } return(true); }
public static bool Prefix(ushort buildingID, ref Building data, uint citizen) { CitizenManager citizenManager = Singleton <CitizenManager> .instance; BuildingInfo buildingInfo = data.Info; if ((citizenManager.m_citizens.m_buffer[citizen].m_flags & Citizen.Flags.Tourist) != Citizen.Flags.None) { int consumptionMoney = MainDataStore.govermentSalary << 4; if (citizenManager.m_citizens.m_buffer[citizen].WealthLevel == Citizen.Wealth.High) { consumptionMoney <<= 2; } if (citizenManager.m_citizens.m_buffer[citizen].WealthLevel == Citizen.Wealth.Medium) { consumptionMoney <<= 1; } consumptionMoney = -consumptionMoney; if (MainDataStore.outsideTouristMoney > 0) { buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Entertainment, ref consumptionMoney); MainDataStore.outsideTouristMoney += (consumptionMoney); } consumptionMoney = -MainDataStore.maxGoodPurchase; buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Shopping, ref consumptionMoney); int priceInt = 0; IndustryBuildingGetResourcePricePatch.Prefix(ref priceInt, TransferManager.TransferReason.Shopping, data.Info.m_class.m_service); var m_goodsSellPrice = priceInt / 100; MainDataStore.outsideTouristMoney += (consumptionMoney * m_goodsSellPrice); } else { ushort homeBuilding = citizenManager.m_citizens.m_buffer[citizen].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = citizenManager.m_citizens.m_buffer[citizen].GetContainingUnit((uint)citizen, citizenUnit, CitizenUnit.Flags.Home); if (containingUnit != 0) { //int goodAmount = (int)(-(CitizenUnitData.familyMoney[containingUnit]) / RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping)); int goodAmount = -MainDataStore.maxGoodPurchase; if (goodAmount < 0) { buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Shopping, ref goodAmount); if (goodAmount != 0) { CitizenUnitData.familyGoods[containingUnit] = (ushort)(CitizenUnitData.familyGoods[containingUnit] - (goodAmount * 10)); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { citizenManager.m_citizens.m_buffer[citizen].m_flags &= ~Citizen.Flags.NeedGoods; } } } else { goodAmount = 0; } var familyMoney = (CitizenUnitData.familyMoney[containingUnit] + goodAmount * RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping)); float consumptionIndex; if (buildingInfo.m_class.m_subService == ItemClass.SubService.CommercialLeisure) { consumptionIndex = 0.25f; } else if ((buildingInfo.m_class.m_subService == ItemClass.SubService.CommercialTourist)) { consumptionIndex = 0.2f; } else if ((buildingInfo.m_class.m_subService == ItemClass.SubService.CommercialEco)) { consumptionIndex = 0.05f; } else if ((buildingInfo.m_class.m_subService == ItemClass.SubService.CommercialHigh)) { consumptionIndex = 0.15f; } else { consumptionIndex = 0.1f; } int consumptionMoney = -(int)(consumptionIndex * familyMoney); if (consumptionMoney < 0) { int money = consumptionMoney; buildingInfo.m_buildingAI.ModifyMaterialBuffer(buildingID, ref data, TransferManager.TransferReason.Entertainment, ref money); } else { consumptionMoney = 0; } CitizenData.citizenMoney[citizen] = (CitizenData.citizenMoney[citizen] + consumptionMoney + goodAmount * RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping)); CitizenUnitData.familyMoney[containingUnit] = CitizenUnitData.familyMoney[containingUnit] + consumptionMoney + goodAmount * RealCityIndustryBuildingAI.GetResourcePrice(TransferManager.TransferReason.Shopping); } } Singleton <BuildingAI> .instance.VisitorEnter(buildingID, ref data, citizen); return(false); }
public static void LimitCommericalBuildingAccess(ushort buildingID, ref Building buildingData) { if (buildingData.Info.m_class.m_service == ItemClass.Service.Commercial) { Citizen.BehaviourData behaviour = default; int aliveVisitCount = 0; int totalVisitCount = 0; RealCityCommercialBuildingAI.InitDelegate(); RealCityCommercialBuildingAI.GetVisitBehaviour((CommercialBuildingAI)buildingData.Info.m_buildingAI, buildingID, ref buildingData, ref behaviour, ref aliveVisitCount, ref totalVisitCount); var amount = buildingData.m_customBuffer2 / MainDataStore.maxGoodPurchase - totalVisitCount + aliveVisitCount; var AI = buildingData.Info.m_buildingAI as CommercialBuildingAI; var maxcount = AI.CalculateVisitplaceCount((ItemClass.Level)buildingData.m_level, new Randomizer(buildingID), buildingData.m_width, buildingData.m_length); if ((amount <= 0) || (maxcount <= totalVisitCount)) { buildingData.m_flags &= ~Building.Flags.Active; } if (RealCityEconomyExtension.Can16timesUpdate(buildingID)) { //Remove citizen which already have goods CitizenManager instance = Singleton <CitizenManager> .instance; uint num = buildingData.m_citizenUnits; int num2 = 0; while (num != 0u) { if ((ushort)(instance.m_units.m_buffer[(int)((UIntPtr)num)].m_flags & CitizenUnit.Flags.Visit) != 0) { var citizenID = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_citizen0; if (citizenID != 0u) { ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { if (!instance.m_citizens.m_buffer[citizenID].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { BuildingManager instance1 = Singleton <BuildingManager> .instance; instance.m_citizens.m_buffer[citizenID].RemoveFromUnits(citizenID, instance1.m_buildings.m_buffer[buildingID].m_citizenUnits, CitizenUnit.Flags.Visit); return; } } } citizenID = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_citizen1; if (citizenID != 0u) { ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { if (!instance.m_citizens.m_buffer[citizenID].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { BuildingManager instance1 = Singleton <BuildingManager> .instance; instance.m_citizens.m_buffer[citizenID].RemoveFromUnits(citizenID, instance1.m_buildings.m_buffer[buildingID].m_citizenUnits, CitizenUnit.Flags.Visit); return; } } } citizenID = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_citizen2; if (citizenID != 0u) { ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { if (!instance.m_citizens.m_buffer[citizenID].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { BuildingManager instance1 = Singleton <BuildingManager> .instance; instance.m_citizens.m_buffer[citizenID].RemoveFromUnits(citizenID, instance1.m_buildings.m_buffer[buildingID].m_citizenUnits, CitizenUnit.Flags.Visit); return; } } } citizenID = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_citizen3; if (citizenID != 0u) { ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { if (!instance.m_citizens.m_buffer[citizenID].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { BuildingManager instance1 = Singleton <BuildingManager> .instance; instance.m_citizens.m_buffer[citizenID].RemoveFromUnits(citizenID, instance1.m_buildings.m_buffer[buildingID].m_citizenUnits, CitizenUnit.Flags.Visit); return; } } } citizenID = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_citizen4; if (citizenID != 0u) { ushort homeBuilding = instance.m_citizens.m_buffer[citizenID].m_homeBuilding; uint citizenUnit = CitizenData.GetCitizenUnit(homeBuilding); uint containingUnit = instance.m_citizens.m_buffer[citizenID].GetContainingUnit((uint)citizenID, citizenUnit, CitizenUnit.Flags.Home); if (CitizenUnitData.familyGoods[containingUnit] > 2000) { if (!instance.m_citizens.m_buffer[citizenID].m_flags.IsFlagSet(Citizen.Flags.Tourist)) { BuildingManager instance1 = Singleton <BuildingManager> .instance; instance.m_citizens.m_buffer[citizenID].RemoveFromUnits(citizenID, instance1.m_buildings.m_buffer[buildingID].m_citizenUnits, CitizenUnit.Flags.Visit); return; } } } } num = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_nextUnit; if (++num2 > 524288) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } } }