Example #1
0
        public bool RemoveCarGen(YmapCarGen cargen)
        {
            if (cargen == null)
            {
                return(false);
            }

            List <YmapCarGen> newcargens = new List <YmapCarGen>();

            if (CarGenerators != null)
            {
                for (int i = 0; i < CarGenerators.Length; i++)
                {
                    var cg = CarGenerators[i];
                    if (cg != cargen)
                    {
                        newcargens.Add(cg);
                    }
                }
                if (newcargens.Count == CarGenerators.Length)
                {
                    return(false); //nothing removed... wasn't present?
                }
            }


            CarGenerators = newcargens.ToArray();

            HasChanged = true;

            return(true);
        }
Example #2
0
 private void EnsureCarGens(Meta Meta)
 {
     CCarGens = MetaTypes.ConvertDataArray <CCarGen>(Meta, MetaName.CCarGen, CMapData.carGenerators);
     if (CCarGens != null)
     {
         //string str = MetaTypes.GetTypesInitString(resentry, Meta); //to generate structinfos and enuminfos
         CarGenerators = new YmapCarGen[CCarGens.Length];
         for (int i = 0; i < CCarGens.Length; i++)
         {
             CarGenerators[i] = new YmapCarGen(this, CCarGens[i]);
         }
     }
 }
Example #3
0
        public void AddCarGen(YmapCarGen cargen)
        {
            List <YmapCarGen> cargens = new List <YmapCarGen>();

            if (CarGenerators != null)
            {
                cargens.AddRange(CarGenerators);
            }
            cargen.Ymap = this;
            cargens.Add(cargen);
            CarGenerators = cargens.ToArray();

            HasChanged = true;
        }