public void InitializeUserInput() { if ( _ReadyForUserInput ) { return; } _ReadyForUserInput = true; int X = 0; int Y = 0; SectorCount.X = (int)(Math.Ceiling((double)(Terrain.TileSize.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling((double)(Terrain.TileSize.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new sXY_int(X, Y)); } } clsUnit Unit = default(clsUnit); foreach ( clsUnit tempLoopVar_Unit in Units ) { Unit = tempLoopVar_Unit; UnitSectorsCalc(Unit); } ShadowSectors = new clsShadowSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { ShadowSector_Create(new sXY_int(X, Y)); } } SectorGraphicsChanges = new clsSectorChanges(this); SectorGraphicsChanges.SetAllChanged(); SectorUnitHeightsChanges = new clsSectorChanges(this); SectorTerrainUndoChanges = new clsSectorChanges(this); AutoTextureChanges = new clsAutoTextureChanges(this); TerrainInterpretChanges = new clsTerrainUpdate(Terrain.TileSize); UnitChanges = new SimpleClassList<clsUnitChange>(); UnitChanges.MaintainOrder = true; GatewayChanges = new SimpleClassList<clsGatewayChange>(); GatewayChanges.MaintainOrder = true; Undos = new SimpleClassList<clsUndo>(); Undos.MaintainOrder = true; UndoPosition = 0; SelectedUnits = new ConnectedList<clsUnit, clsMap>(this); if ( InterfaceOptions == null ) { InterfaceOptions = new clsInterfaceOptions(); } ViewInfo = new clsViewInfo(this, Program.frmMainInstance.MapViewControl); _SelectedUnitGroup = new clsUnitGroupContainer(); SelectedUnitGroup.Item = ScavengerUnitGroup; Messages = new SimpleClassList<clsMessage>(); Messages.MaintainOrder = true; }
protected void TerrainBlank(sXY_int TileSize) { int X = 0; int Y = 0; Terrain = new clsTerrain(TileSize); SectorCount.X = (int)(Math.Ceiling((double)(Terrain.TileSize.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling((double)(Terrain.TileSize.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new sXY_int(X, Y)); } } }
public clsMap(clsMap MapToCopy, sXY_int Offset, sXY_int Area) { frmMainLink = new ConnectedListLink<clsMap, frmMain>(this); Gateways = new ConnectedList<clsGateway, clsMap>(this); int EndX = 0; int EndY = 0; int X = 0; int Y = 0; Initialize(); //make some map data for selection EndX = Math.Min(MapToCopy.Terrain.TileSize.X - Offset.X, Area.X); EndY = Math.Min(MapToCopy.Terrain.TileSize.Y - Offset.Y, Area.Y); Terrain = new clsTerrain(Area); for ( Y = 0; Y <= Terrain.TileSize.Y - 1; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X - 1; X++ ) { Terrain.Tiles[X, Y].Texture.TextureNum = -1; } } for ( Y = 0; Y <= EndY; Y++ ) { for ( X = 0; X <= EndX; X++ ) { Terrain.Vertices[X, Y].Height = MapToCopy.Terrain.Vertices[Offset.X + X, Offset.Y + Y].Height; Terrain.Vertices[X, Y].Terrain = MapToCopy.Terrain.Vertices[Offset.X + X, Offset.Y + Y].Terrain; } } for ( Y = 0; Y <= EndY - 1; Y++ ) { for ( X = 0; X <= EndX - 1; X++ ) { Terrain.Tiles[X, Y].Copy(MapToCopy.Terrain.Tiles[Offset.X + X, Offset.Y + Y]); } } for ( Y = 0; Y <= EndY; Y++ ) { for ( X = 0; X <= EndX - 1; X++ ) { Terrain.SideH[X, Y].Road = MapToCopy.Terrain.SideH[Offset.X + X, Offset.Y + Y].Road; } } for ( Y = 0; Y <= EndY - 1; Y++ ) { for ( X = 0; X <= EndX; X++ ) { Terrain.SideV[X, Y].Road = MapToCopy.Terrain.SideV[Offset.X + X, Offset.Y + Y].Road; } } SectorCount.X = (int)(Math.Ceiling((double)(Area.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling((double)(Area.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new sXY_int(X, Y)); } } sXY_int PosDif = new sXY_int(); clsUnitAdd NewUnitAdd = new clsUnitAdd(); NewUnitAdd.Map = this; clsUnit NewUnit = default(clsUnit); clsGateway Gateway = default(clsGateway); foreach ( clsGateway tempLoopVar_Gateway in MapToCopy.Gateways ) { Gateway = tempLoopVar_Gateway; GatewayCreate(new sXY_int(Gateway.PosA.X - Offset.X, Gateway.PosA.Y - Offset.Y), new sXY_int(Gateway.PosB.X - Offset.X, Gateway.PosB.Y - Offset.Y)); } PosDif.X = - Offset.X * App.TerrainGridSpacing; PosDif.Y = - Offset.Y * App.TerrainGridSpacing; clsUnit Unit = default(clsUnit); sXY_int NewPos = new sXY_int(); foreach ( clsUnit tempLoopVar_Unit in MapToCopy.Units ) { Unit = tempLoopVar_Unit; NewPos = Unit.Pos.Horizontal + PosDif; if ( PosIsOnMap(NewPos) ) { NewUnit = new clsUnit(Unit, this); NewUnit.Pos.Horizontal = NewPos; NewUnitAdd.NewUnit = NewUnit; NewUnitAdd.Label = Unit.Label; NewUnitAdd.Perform(); } } }
public void TerrainBlank(XYInt TileSize) { var X = 0; var Y = 0; Terrain = new clsTerrain(TileSize); SectorCount.X = (int)(Math.Ceiling(((double)Terrain.TileSize.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling(((double)Terrain.TileSize.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new XYInt(X, Y)); } } }