implemented a new object factory mechanism which is now really independent of the...
[supertux.git] / contrib / tilemanager / Application.cs
index fb20593..457132f 100644 (file)
@@ -26,7 +26,7 @@ public class Application {
     [Glade.Widget]
     private Gtk.Entry DataEntry;
     [Glade.Widget]
-    private Gtk.Entry AnimSpeedEntry;
+    private Gtk.Entry AnimFpsEntry;
     [Glade.Widget]                 
     private Gtk.Entry IDEntry;
     [Glade.Widget]
@@ -254,8 +254,18 @@ public class Application {
                 return;
             }
             foreach(Tile tile in Selection) {
-                if(tile.ID != -1)
-                    tile.ID = id++;
+                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();
@@ -342,8 +352,8 @@ public class Application {
                     tile.ID = Int32.Parse(IDEntry.Text);
                 if(sender == DataEntry)
                     tile.Data = Int32.Parse(DataEntry.Text);
-                if(sender == AnimSpeedEntry)
-                    tile.AnimSpeed = Int32.Parse(AnimSpeedEntry.Text);
+                if(sender == AnimFpsEntry)
+                    tile.AnimFps = Single.Parse(AnimFpsEntry.Text);
             } catch(Exception exception) {
                 // ignore parse errors for now...
             }
@@ -380,7 +390,7 @@ public class Application {
                 SlopeCheckButton.Active = tile.Slope;
                 DontUseCheckButton.Active = tile.ID == -1;
                 DataEntry.Text = tile.Data.ToString();
-                AnimSpeedEntry.Text = tile.AnimSpeed.ToString();
+                AnimFpsEntry.Text = tile.AnimFps.ToString();
                 IDEntry.Text = tile.ID.ToString();
                 IDEntry.Editable = true;
                 first = false;