public comPlaceUnit(clsUnit Unit, Player owner, clsUnitType UnitTypeToPlace) : base("PlaceUnit") { this.m_objUnitToCommand = Unit; this.m_Owner = owner; this.m_UnitTypeToPlace = UnitTypeToPlace; }
private void btnAdd_Click(object sender, EventArgs e) { if (txtID.Text.Trim() == string.Empty) { MessageBox.Show("Unit Category id cannot be empty."); txtID.Focus(); return; } if (txtDesc.Text.Trim() == "") { MessageBox.Show("Description cannot be empty."); txtDesc.Focus(); return; } foreach (DataGridViewRow dgr in dgList.Rows) { if (dgr.Cells["UnitTypeID"].Value.ToString().Trim().ToUpper() == txtID.Text.Trim().ToUpper() && this.id != Convert.ToInt32(dgr.Cells["ID1"].Value)) { MessageBox.Show("A unit type with same ID already exists."); return; } } clsUnitType cat = new clsUnitType(); cat.strUnitTypeID = txtID.Text.Trim(); cat.strDesc = txtDesc.Text.Trim(); cat.id = this.id; bool result = da.AddUnitType(cat); if (result == false) { MessageBox.Show("An error occurred."); return; } LoadProjects(); Clear(); }
public static void CreateGeneratorTilesets() { Generator_TilesetArizona = new clsGeneratorTileset(); Generator_TilesetArizona.Tileset = App.Tileset_Arizona; Generator_TilesetUrban = new clsGeneratorTileset(); Generator_TilesetUrban.Tileset = App.Tileset_Urban; Generator_TilesetRockies = new clsGeneratorTileset(); Generator_TilesetRockies.Tileset = App.Tileset_Rockies; UnitType_OilResource = GetUnitTypeFromCode("OilResource"); UnitType_CommandCentre = GetUnitTypeFromCode("A0CommandCentre"); UnitType_Truck = GetUnitTypeFromCode("ConstructionDroid"); UnitType_Factory = GetUnitTypeFromCode("A0LightFactory"); UnitType_FactoryModule = GetUnitTypeFromCode("A0FacMod1"); UnitType_CyborgFactory = GetUnitTypeFromCode("A0CyborgFactory"); UnitType_ResearchFacility = GetUnitTypeFromCode("A0ResearchFacility"); UnitType_ResearchModule = GetUnitTypeFromCode("A0ResearchModule1"); UnitType_PowerGenerator = GetUnitTypeFromCode("A0PowerGenerator"); UnitType_PowerModule = GetUnitTypeFromCode("A0PowMod1"); UnitType_Derrick = GetUnitTypeFromCode("A0ResourceExtractor"); UnitType_Boulder1 = GetUnitTypeFromCode("Boulder1"); UnitType_Boulder2 = GetUnitTypeFromCode("Boulder2"); UnitType_Boulder3 = GetUnitTypeFromCode("Boulder3"); UnitType_Ruin1 = GetUnitTypeFromCode("Ruin1"); UnitType_Ruin3 = GetUnitTypeFromCode("Ruin3"); UnitType_Ruin4 = GetUnitTypeFromCode("Ruin4"); UnitType_Ruin5 = GetUnitTypeFromCode("Ruin5"); UnitType_5Trees = GetUnitTypeFromCode("Tree1"); UnitType_4Trees = GetUnitTypeFromCode("Tree2"); UnitType_1Tree = GetUnitTypeFromCode("Tree3"); UnitType_5TreesSnowy = GetUnitTypeFromCode("TreeSnow1"); UnitType_4TreesSnowy = GetUnitTypeFromCode("TreeSnow2"); UnitType_1TreeSnowy = GetUnitTypeFromCode("TreeSnow3"); UnitType_Highrise1 = GetUnitTypeFromCode("building1"); UnitType_Highrise2 = GetUnitTypeFromCode("building2"); UnitType_Highrise3 = GetUnitTypeFromCode("building3"); UnitType_HalfHighrise = GetUnitTypeFromCode("building11"); UnitType_HighriseStump1 = GetUnitTypeFromCode("building7"); UnitType_HighriseStump2 = GetUnitTypeFromCode("building8"); UnitType_BuildingStump = GetUnitTypeFromCode("WreckedBuilding9"); UnitType_SmallBuilding1 = GetUnitTypeFromCode("building10"); UnitType_SmallBuilding2 = GetUnitTypeFromCode("building12"); UnitType_SmallBuilding3 = GetUnitTypeFromCode("WreckedBuilding17"); UnitType_LogCabin1 = GetUnitTypeFromCode("LogCabin1"); UnitType_LogCabin2 = GetUnitTypeFromCode("LogCabin2"); UnitType_LogCabin3 = GetUnitTypeFromCode("LogCabin3"); UnitType_LogCabin4 = GetUnitTypeFromCode("LogCabin4"); UnitType_LogCabin5 = GetUnitTypeFromCode("LogCabin5"); UnitType_Crane = GetUnitTypeFromCode("Crane"); UnitType_OilDrum = GetUnitTypeFromCode("OilDrum"); Generator_TilesetArizona.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Boulder1, 1)); Generator_TilesetArizona.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Boulder2, 1)); Generator_TilesetArizona.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Boulder3, 1)); Generator_TilesetArizona.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Ruin1, 1)); Generator_TilesetArizona.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Ruin3, 1)); Generator_TilesetArizona.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Ruin4, 1)); Generator_TilesetArizona.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Ruin5, 1)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Highrise1, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Highrise2, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Highrise3, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_HalfHighrise, 1)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_SmallBuilding1, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_SmallBuilding2, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_SmallBuilding3, 3)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_HighriseStump1, 1)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_HighriseStump2, 1)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_BuildingStump, 1)); Generator_TilesetUrban.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_Crane, 2)); Generator_TilesetRockies.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_5Trees, 1)); Generator_TilesetRockies.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_4Trees, 1)); Generator_TilesetRockies.ScatteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_1Tree, 2)); //Tileset_Rockies.ScatteredUnit_Add(New clsWZTileset.sUnitChance(UnitType_5TreesSnowy, 1)) //Tileset_Rockies.ScatteredUnit_Add(New clsWZTileset.sUnitChance(UnitType_4TreesSnowy, 1)) //Tileset_Rockies.ScatteredUnit_Add(New clsWZTileset.sUnitChance(UnitType_1TreeSnowy, 2)) Generator_TilesetRockies.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_LogCabin1, 3)); Generator_TilesetRockies.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_LogCabin2, 1)); Generator_TilesetRockies.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_LogCabin3, 1)); Generator_TilesetRockies.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_LogCabin4, 1)); Generator_TilesetRockies.ClusteredUnit_Add(new clsGeneratorTileset.sUnitChance(UnitType_LogCabin5, 3)); int Num = 0; //terrain arizona TerrainStyle_Arizona.LayerCount = 5; Num = 0; Array.Resize(ref TerrainStyle_Arizona.Layers, Num + 1); TerrainStyle_Arizona.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Arizona.Layers[Num].TileNum = 48; //red TerrainStyle_Arizona.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Arizona.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Arizona.Layers[Num].HeightMax = 256.0F; TerrainStyle_Arizona.Layers[Num].AvoidLayers = new bool[TerrainStyle_Arizona.LayerCount]; TerrainStyle_Arizona.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Arizona.Layers, Num + 1); TerrainStyle_Arizona.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Arizona.Layers[Num].TileNum = 11; //yellow TerrainStyle_Arizona.Layers[Num].TerrainmapDensity = 0.5F; TerrainStyle_Arizona.Layers[Num].TerrainmapScale = 2.0F; TerrainStyle_Arizona.Layers[Num].HeightMax = 256.0F; TerrainStyle_Arizona.Layers[Num].AvoidLayers = new bool[TerrainStyle_Arizona.LayerCount]; TerrainStyle_Arizona.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Arizona.Layers, Num + 1); TerrainStyle_Arizona.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Arizona.Layers[Num].TileNum = 5; //brown TerrainStyle_Arizona.Layers[Num].TerrainmapDensity = 0.4F; TerrainStyle_Arizona.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Arizona.Layers[Num].HeightMax = 256.0F; TerrainStyle_Arizona.Layers[Num].AvoidLayers = new bool[TerrainStyle_Arizona.LayerCount]; TerrainStyle_Arizona.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Arizona.Layers, Num + 1); TerrainStyle_Arizona.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Arizona.Layers[Num].TileNum = 23; //green TerrainStyle_Arizona.Layers[Num].TerrainmapDensity = 0.75F; TerrainStyle_Arizona.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Arizona.Layers[Num].HeightMax = 256.0F; TerrainStyle_Arizona.Layers[Num].AvoidLayers = new bool[TerrainStyle_Arizona.LayerCount]; TerrainStyle_Arizona.Layers[Num].WithinLayer = Num - 1; Num++; Array.Resize(ref TerrainStyle_Arizona.Layers, Num + 1); TerrainStyle_Arizona.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Arizona.Layers[Num].TileNum = 18; //cliff TerrainStyle_Arizona.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Arizona.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Arizona.Layers[Num].HeightMax = 256.0F; TerrainStyle_Arizona.Layers[Num].IsCliff = true; TerrainStyle_Arizona.Layers[Num].AvoidLayers = new bool[TerrainStyle_Arizona.LayerCount]; TerrainStyle_Arizona.Layers[Num].WithinLayer = -1; TerrainStyle_Arizona.Tileset = Generator_TilesetArizona; Generator_TilesetArizona.BorderTextureNum = 18; //terrain urban TerrainStyle_Urban.LayerCount = 6; Num = 0; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 7; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 0; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 0.5F; TerrainStyle_Urban.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 22; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 0.333F; TerrainStyle_Urban.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 50; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 0.333F; TerrainStyle_Urban.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; //Num += 1 //ReDim Preserve TerrainStyle_Urban.Layers(Num) //TerrainStyle_Urban.Layers(Num) = New clsMap.sGenerateMasterTerrainArgs.clsLayer //TerrainStyle_Urban.Layers(Num).TileNum = 19 //TerrainStyle_Urban.Layers(Num).TerrainmapDensity = 0.25F //TerrainStyle_Urban.Layers(Num).TerrainmapScale = 1.5F //TerrainStyle_Urban.Layers(Num).HeightMax = 256.0F //ReDim TerrainStyle_Urban.Layers(Num).AvoidLayers(TerrainStyle_Urban.LayerCount - 1) //TerrainStyle_Urban.Layers(Num).WithinLayer = -1 Num++; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 51; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 0.4F; TerrainStyle_Urban.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Urban.Layers, Num + 1); TerrainStyle_Urban.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Urban.Layers[Num].TileNum = 70; TerrainStyle_Urban.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Urban.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Urban.Layers[Num].HeightMax = 256.0F; TerrainStyle_Urban.Layers[Num].IsCliff = true; TerrainStyle_Urban.Layers[Num].AvoidLayers = new bool[TerrainStyle_Urban.LayerCount]; TerrainStyle_Urban.Layers[Num].WithinLayer = -1; TerrainStyle_Urban.Tileset = Generator_TilesetUrban; Generator_TilesetUrban.BorderTextureNum = 70; //terrain rockies TerrainStyle_Rockies.LayerCount = 7; Num = 0; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 0; //green TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 53; //brown TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 0.4F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 23; //green & snow TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 0.333F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 1.5F; TerrainStyle_Rockies.Layers[Num].HeightMin = 85.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 64; //snow TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 0.5F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 1.0F; TerrainStyle_Rockies.Layers[Num].HeightMin = 85.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = Num - 1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 41; //brown & snow TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Rockies.Layers[Num].HeightMin = 170.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = -1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 64; //snow TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 0.875F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 1.0F; TerrainStyle_Rockies.Layers[Num].HeightMin = 170.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = Num - 1; Num++; Array.Resize(ref TerrainStyle_Rockies.Layers, Num + 1); TerrainStyle_Rockies.Layers[Num] = new clsMap.sGenerateMasterTerrainArgs.clsLayer(); TerrainStyle_Rockies.Layers[Num].TileNum = 30; //cliff TerrainStyle_Rockies.Layers[Num].TerrainmapDensity = 1.0F; TerrainStyle_Rockies.Layers[Num].TerrainmapScale = 0.0F; TerrainStyle_Rockies.Layers[Num].HeightMax = 256.0F; TerrainStyle_Rockies.Layers[Num].IsCliff = true; TerrainStyle_Rockies.Layers[Num].AvoidLayers = new bool[TerrainStyle_Rockies.LayerCount]; TerrainStyle_Rockies.Layers[Num].WithinLayer = -1; TerrainStyle_Rockies.Tileset = Generator_TilesetRockies; Generator_TilesetRockies.BorderTextureNum = 30; }