Sprite editor / moving sprites in tileset

When I edit my tileset in an external editor (e.g. the GIMP), my biggest problem is when I rearrange (I have to, because of certain spite ID ordering aspects in the game engine) sprites on the tileset, of course the ID indexes in the Tiled editor won’t be updated. What is the common practice here? Do you expect a perfect tilemap before you design maps? Could a little sprite editor be implemented?

(not read: “could you please reimplement GIMP in your freetime for me, I pay 0$ ??? omg!!!1”)

I can totally understand the problem, but I’m not sure if adding a sprite editor or even an editor just for moving things around is the best solution.

An alternative approach I would consider, is to allow the user to give Tiled the old and the new set of tilesets, and then Tiled could automatically search for matching tiles and perform appropriate replacements (preferably on multiple maps at the same time).

What about the option to change the tile id? Currently the tile id is grayed out and can’t be changed, but if you could modify the tile id and the map editor would automatically adjust your tiles that would be really helpful too. For example, say that in my map all tiles below a certain value are “walkable” (the player can walk on those tiles, eg. grass, roads, paths, etc.) and tiles above that value are not passable (walls, houses, signs, etc.). If i want to add a new walkable tile, it would be nice to be able to add a new tile and move it in with the rest of the walkable tiles. I dunno a quick way to explain it, so i’ll just give an example:

Tiles:
0-2 = walkable
3-5 = non-passable

Tilemap:
5 5 5 5 5 5
5 0 3 0 0 5
5 0 1 2 0 5
5 0 0 1 4 5
5 5 5 5 5 5

If i want to add a new walkable tile, i need to add it to tile id 3 and push the other tiles back. So now i would have:

tiles:
0-3 = walkable
4-6 = non-passable

tilemap:
6 6 6 6 6 6
6 0 4 0 3 6
6 0 1 2 0 6
6 3 0 1 5 6
6 6 6 6 6 6

The other tiles in the tilemap would get adjusted when adding the new tile (or moving an old tile around). I dunno if that makes sense. I’m not very good at C, but i wrote my own tilemap editor that let’s me switch tiles around one tile at a time, maybe it can explain my idea a little better:

for(y=0;y < map->height;y++) {
    for(x=0;x < map->width;x++) {
        if(map->tile[y][x]==mouse->tile_l)           // swap the currently selected tile
            map->tile[y][x] = mouse->tile_l+1;       // with the tile below it
        else if(map->tile[y][x]==mouse->tile_l+1)    // tile_l is the current tile selected
            map->tile[y][x] = mouse->tile_l;         // with the left mouse button
    }
}