automatically fix world border violations

whenever the map is saved in edit mode
This commit is contained in:
ac-stef
2016-08-31 17:21:10 +02:00
parent 4b2767a96d
commit 75af444844
+15
View File
@@ -668,6 +668,21 @@ void save_world(char *mname, bool skipoptimise, bool addcomfort)
f->write(&tmp, sizeof(persistent_entity));
}
// fix world border
if(editmode)
{
int nonsolid = 0;
loop(y, ssize) loop(x, ssize)
{
if(OUTBORD(x, y))
{
sqr *s = S(x, y);
if(!SOLID(s)) { sqrdefault(s); s->type = SOLID; nonsolid++; }
}
else x = ssize - MINBORD - 1;
}
if(nonsolid) conoutf("\f3fixed %d non-solid world border cubes", nonsolid);
}
// write map geometry
vector<uchar> rawcubes;
rlencodecubes(rawcubes, world, cubicsize, skipoptimise); // if skipoptimize -> keep properties of solid cubes (forces format 10)