Example #1
0
        public void GetCitizenIncome(CitizenUnit.Flags flags, Building buildingData, ref int income, ref int tourists)
        {
            int           level = 0;
            UnlockManager um    = Singleton <UnlockManager> .instance;

            if (!um.Unlocked(ItemClass.SubService.PublicTransportMetro))
            {
                level += 1;
                if (!um.Unlocked(ItemClass.Service.PublicTransport))
                {
                    level += 1;
                    if (!um.Unlocked(ItemClass.Service.HealthCare))
                    {
                        level += 1;
                    }
                }
            }

            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 & flags) != 0)
                {
                    GetCitizenIncome(instance.m_units.m_buffer[(int)((UIntPtr)num)], level, ref income, ref tourists);
                }
                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;
                }
            }
        }