Пример #1
0
        /// <summary>
        /// UPON HOUSE BUILT
        /// </summary>
        public static string NameHouse
            (ushort building_ID)
        {
            string roadName = NetManager.instance.GetSegmentName(Logic_Tools.GetNearestSegment_toBuilding(BuildingManager.instance.m_buildings.m_buffer[building_ID].m_position));

            Logic_Roads.AddRoad(roadName);
            ushort alpha = (ushort)(2 * (Hook_Addresses_SaveGame.CitySave.Roads.IndexOf(roadName)));

            if (Hook_Addresses_SaveGame.CitySave.Options.ConsiderRoadSide == true)
            {
                string buildingName = RenameEvenOrOdd(Logic_Tools.DetermineSideOfRoad(BuildingManager.instance.m_buildings.m_buffer[building_ID].m_position), roadName);
                Hook_Addresses_SaveGame.CitySave.ModArray[alpha].Add(Logic_Tools.AddAnotherNumber(Hook_Addresses_SaveGame.CitySave.ModArray[alpha].Min(), roadName));
                return(buildingName);
            }
            else
            {
                string buildingName = NamingPatternCheck(roadName, Hook_Addresses_SaveGame.CitySave.ModArray[alpha].Min());
                Hook_Addresses_SaveGame.CitySave.ModArray[alpha].Add(Logic_Tools.AddAnotherNumber(Hook_Addresses_SaveGame.CitySave.ModArray[alpha].Min(), roadName));
                return(buildingName);
            }
        }
Пример #2
0
        // Upon road with new name built
        public static void AddRoad
            (string roadName)
        {
            if (Hook_Addresses_SaveGame.CitySave.Roads.Contains(roadName))
            {
                return;
            }
            else
            {
                // add road to roads List
                Hook_Addresses_SaveGame.CitySave.Roads.Add(roadName);

                // add 2 Lists (available numbers/ used numbers), add first number (usually "1") to the first (= available) List after RNG check
                List <ushort> available            = new List <ushort>();
                List <ushort> used                 = new List <ushort>();
                ushort        initialHouseNumber_1 = 1;
                ushort        initialHouseNumber_2 = 2;

                // RNG options check
                if (Hook_Addresses_SaveGame.CitySave.Options.RandomNumbers == true)
                {
                    System.Random rnd = new System.Random();
                    initialHouseNumber_1 = (ushort)rnd.Next((Hook_Addresses_SaveGame.CitySave.Options.Offset + 1), Hook_Addresses_SaveGame.CitySave.Options.RandomNumbersRange);
                    initialHouseNumber_2 = Logic_Tools.AddAnotherNumber(initialHouseNumber_1, roadName);
                }
                else
                {
                    initialHouseNumber_1 = (ushort)(Hook_Addresses_SaveGame.CitySave.Options.Offset + 1);
                    initialHouseNumber_2 = (ushort)(Hook_Addresses_SaveGame.CitySave.Options.Offset + 2);
                }
                available.Add(initialHouseNumber_1);
                available.Add(initialHouseNumber_2);
                Hook_Addresses_SaveGame.CitySave.ModArray.Add(available);
                Hook_Addresses_SaveGame.CitySave.ModArray.Add(used);
            }
        }