fix: convert xmap path names for windows

* make sure, unsaved edits only count in editmode (otherwise "watercolour"
  in map configs would already be "edits")

* nicer filenames for backup-xmaps

* catch failed xmap file write access

* unsavededits is now flag (!= 0) and counter - to enable scripts to
  detect "new edits".

new commands:

xmap_delete_backup    deletes the backup xmap

xmap_keep_backup    moves the backup xmap to a regular named spot

xmap_rename    changes the nickname of an xmap
This commit is contained in:
ac-stef
2014-05-19 12:31:26 +02:00
parent b728a33bb3
commit 493aefd34b
6 changed files with 56 additions and 26 deletions
+8 -7
View File
@@ -191,7 +191,7 @@ void entproperty(int prop, int amount)
loc->drop();
}
if(changedents.find(n) == -1) changedents.add(n); // apply ent changes later (reduces network traffic)
unsavededits = 1;
unsavededits++;
}
hashtable<char *, enet_uint32> mapinfo, &resdata = mapinfo;
@@ -247,7 +247,7 @@ void delent()
{
case LIGHT: calclight(); break;
}
unsavededits = 1;
unsavededits++;
}
int findtype(char *what)
@@ -312,7 +312,7 @@ entity *newentity(int index, int x, int y, int z, char *what, int v1, int v2, in
case LIGHT: calclight(); break;
case SOUND: audiomgr.preloadmapsound(e); break;
}
unsavededits = 1;
unsavededits++;
return index<0 ? &ents.last() : &ents[index];
}
@@ -332,16 +332,17 @@ void clearents(char *name)
{
int type = findtype(name);
if(noteditmode("clearents") || multiplayer()) return;
bool found = false;
loopv(ents)
{
entity &e = ents[i];
if(e.type==type) e.type = NOTUSED;
unsavededits = 1;
if(e.type==type) { e.type = NOTUSED; found = true; }
}
switch(type)
{
case LIGHT: calclight(); break;
}
if(found) unsavededits++;
}
COMMAND(clearents, "s");
@@ -369,7 +370,7 @@ void scalelights(int f, int intens)
scalecomp(e.attr3, intens);
scalecomp(e.attr4, intens);
}
unsavededits = 1;
unsavededits++;
}
calclight();
}
@@ -752,7 +753,7 @@ void mapmrproper(bool manual)
conoutf("before: %d / %d / %d / %d / %d / %d / %d", sta[0], sta[1], sta[2], sta[3], sta[4], sta[5], sta[6]);
conoutf("idealized: %d / %d / %d / %d / %d / %d / %d", stb[0], stb[1], stb[2], stb[3], stb[4], stb[5], stb[6]);
conoutf("final count: %d / %d / %d / %d / %d / %d / %d", stc[0], stc[1], stc[2], stc[3], stc[4], stc[5], stc[6]);
unsavededits = 1;
unsavededits++;
}
}
COMMANDF(mapmrproper, "", () { mapmrproper(true); });