Example #1
0
 public MapIterator(GameMap map)
 {
     this.map = map;
 }
Example #2
0
 public void tableize(GameMap map)
 {
     TableBrush.doTables(map, this);
 }
Example #3
0
 public void carpetize(GameMap map)
 {
     CarpetBrush.doCarpets(map, this);
 }
Example #4
0
 public void borderize(GameMap map)
 {
     GroundBrush.doBorders(map, this);
 }
Example #5
0
 public void wallize(GameMap map)
 {
     WallBrush.doWalls(map, this);
 }
Example #6
0
 public Action(MapEditor editor)
 {
     changeList  = new List <Change>();
     this.map    = editor.gameMap;
     this.editor = editor;
 }
Example #7
0
 public void SetMap(GameMap map)
 {
     this.map = map;
 }
Example #8
0
        public void cut(MapEditor editor, int floor)
        {
            if (editor.selection.size() == 0)
            {
                // gui.SetStatusText(wxT("No tiles to cut."));
                return;
            }

            clear();
            tiles = new GameMap();

            int tile_count = 0;
            int item_count = 0;

            copyPos = new Position(0xFFFF, 0xFFFF, floor);

            BatchAction batch  = new BatchAction(ActionIdentifier.ACTION_CUT_TILES);
            Action      action = new Action(editor);

            List <Position> tilestoborder = new List <Position>();

            foreach (Tile tile in editor.selection.getTiles())
            {
                tile_count++;

                Tile newtile     = tile.deepCopy();
                Tile copied_tile = new Tile(tile.getPosition());

                if ((tile.Ground != null) && tile.Ground.isSelected())
                {
                    copied_tile.house_id = newtile.house_id;
                    newtile.house_id     = 0;
                    copied_tile.setMapFlags(tile.getMapFlags());
                    newtile.setMapFlags(TileState.TILESTATE_NONE);
                }

                List <Item> tile_selection = newtile.popSelectedItems();
                foreach (Item iit in tile_selection)
                {
                    item_count++;
                    // Add items to copybuffer
                    copied_tile.addItem(iit);
                }

                if ((newtile.creature != null) && newtile.creature.isSelected())
                {
                    copied_tile.creature = newtile.creature;
                    newtile.creature     = null;
                }

                if ((newtile.spawn != null) && newtile.spawn.isSelected())
                {
                    copied_tile.spawn = newtile.spawn;
                    newtile.spawn     = null;
                }

                tiles.setTile(copied_tile.getPosition(), copied_tile);

                if (copied_tile.Position.X < copyPos.x)
                {
                    copyPos.x = copied_tile.Position.X;
                }

                if (copied_tile.Position.Y < copyPos.y)
                {
                    copyPos.y = copied_tile.Position.Y;
                }

                if (Settings.GetBoolean(Key.USE_AUTOMAGIC))
                {
                    for (int y = -2; y <= 2; y++)
                    {
                        for (int x = -2; x <= 2; x++)
                        {
                            tilestoborder.Add(new Position(tile.getX() + x, tile.getY() + y, tile.getZ()));
                        }
                    }
                }
                action.addChange(new Change(newtile));
            }

            batch.addAndCommitAction(action);

            // Remove duplicates
            //      tilestoborder.sort();
            //tilestoborder.unique();

            if (Settings.GetBoolean(Key.USE_AUTOMAGIC))
            {
                action = new Action(editor);
                foreach (Position it in tilestoborder)
                {
                    Tile tile = editor.map.getTile(it);
                    if (tile != null)
                    {
                        Tile new_tile = tile.deepCopy();
                        new_tile.borderize(editor.map);
                        new_tile.wallize(editor.map);
                        action.addChange(new Change(new_tile));
                    }
                    else
                    {
                        Tile new_tile = new Tile(it);
                        new_tile.borderize(editor.map);
                        if (new_tile.size() != 0)
                        {
                            action.addChange(new Change(new_tile));
                        }
                        else
                        {
                            new_tile = null;
                        }
                    }
                }

                batch.addAndCommitAction(action);
            }

            editor.addBatch(batch);
            //   std.stringstream ss = new std.stringstream();
            //ss << "Cut out " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1 ? "s" : "") << ")";
            //gui.SetStatusText(wxstr(ss.str()));
        }
Example #9
0
 public void clear()
 {
     tiles = null;
 }
Example #10
0
 public CopyBuffer()
 {
     tiles = new GameMap();
 }