From: Miloš Klouček Date: Sat, 16 Aug 2008 17:30:58 +0000 (+0000) Subject: splitted OnAppBarUserResponse() and code that remaps tiles. X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=8c92d7d5c03b857226fdd07f94b492187a12bdcb;p=supertux.git splitted OnAppBarUserResponse() and code that remaps tiles. SVN-Revision: 5728 --- diff --git a/tools/tilemanager/Application.cs b/tools/tilemanager/Application.cs index dfc1bed04..45922006f 100644 --- a/tools/tilemanager/Application.cs +++ b/tools/tilemanager/Application.cs @@ -277,27 +277,36 @@ public class Application { ShowException(exception); return; } - foreach(Tile tile in Selection) { - if(tile.ID == -1) - continue; - - int oldid = tile.ID; - tile.ID = id++; - // remap in all tilegroups... - foreach(TileGroup tilegroup in tileset.TileGroups) { - int idx = tilegroup.Tiles.IndexOf(oldid); - if(idx >= 0) { - tilegroup.Tiles[idx] = tile.ID; - } - } - } - FillTileList(); - SelectionChanged(); + RemapTiles(id); } finally { AppBar.ClearPrompt(); } } + protected void RemapTiles(int startID) { + if(Tiles == null) + return; + + // remap tiles + int id = startID; + foreach(Tile tile in Selection) { + if(tile.ID == -1) + continue; + + int oldid = tile.ID; + tile.ID = id++; + // remap in all tilegroups... + foreach(TileGroup tilegroup in tileset.TileGroups) { + int idx = tilegroup.Tiles.IndexOf(oldid); + if(idx >= 0) { + tilegroup.Tiles[idx] = tile.ID; + } + } + } + FillTileList(); + SelectionChanged(); + } + protected void OnDrawingAreaExpose(object o, ExposeEventArgs e) { if(pixbuf == null) return;