Update editor scripts to Gridarta r5480.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@10072 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
548577faef
commit
97ecd9cad0
|
|
@ -278,24 +278,28 @@ void convertMap(File mapFile, String mapPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapControl.getMapModel().beginTransaction("spell conversion");
|
|
||||||
try {
|
try {
|
||||||
Iterator it1 = mapControl.getAllSquares().iterator();
|
mapControl.getMapModel().beginTransaction("spell conversion");
|
||||||
while (it1.hasNext()) {
|
try {
|
||||||
MapSquare mapSquare = it1.next();
|
Iterator it1 = mapControl.getAllSquares().iterator();
|
||||||
Iterator it2 = mapSquare.iterator();
|
while (it1.hasNext()) {
|
||||||
while (it2.hasNext()) {
|
MapSquare mapSquare = it1.next();
|
||||||
GameObject gameObject = it2.next();
|
Iterator it2 = mapSquare.iterator();
|
||||||
convertGameObject(gameObject);
|
while (it2.hasNext()) {
|
||||||
|
GameObject gameObject = it2.next();
|
||||||
|
convertGameObject(gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
mapControl.getMapModel().endTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapControl.isModified()) {
|
||||||
|
countMapFiles++;
|
||||||
|
mapControl.save();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mapControl.getMapModel().endTransaction();
|
mapManager.release(mapControl);
|
||||||
}
|
|
||||||
|
|
||||||
if (mapControl.isModified()) {
|
|
||||||
countMapFiles++;
|
|
||||||
mapControl.save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,25 @@ void normalizeMap(File mapFile, String mapPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mapPath.startsWith("/styles")
|
try {
|
||||||
&& !mapPath.startsWith("/editor")) {
|
if (!mapPath.startsWith("/styles")
|
||||||
mapModel = map.getMapModel();
|
&& !mapPath.startsWith("/editor")) {
|
||||||
mapArchObject = mapModel.getMapArchObject();
|
mapModel = map.getMapModel();
|
||||||
int shrinkFlags = 0;
|
mapArchObject = mapModel.getMapArchObject();
|
||||||
if (mapArchObject.getTilePath(CommonConstants.NORTH).length() <= 0 && mapArchObject.getTilePath(CommonConstants.SOUTH).length() <= 0) {
|
int shrinkFlags = 0;
|
||||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_EAST;
|
if (mapArchObject.getTilePath(CommonConstants.NORTH).length() <= 0 && mapArchObject.getTilePath(CommonConstants.SOUTH).length() <= 0) {
|
||||||
|
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_EAST;
|
||||||
|
}
|
||||||
|
if (mapArchObject.getTilePath(CommonConstants.EAST).length() <= 0 && mapArchObject.getTilePath(CommonConstants.WEST).length() <= 0) {
|
||||||
|
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_SOUTH;
|
||||||
|
}
|
||||||
|
ShrinkMapSizeUtils.shrinkMap(mapModel, shrinkFlags);
|
||||||
}
|
}
|
||||||
if (mapArchObject.getTilePath(CommonConstants.EAST).length() <= 0 && mapArchObject.getTilePath(CommonConstants.WEST).length() <= 0) {
|
|
||||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_SOUTH;
|
|
||||||
}
|
|
||||||
ShrinkMapSizeUtils.shrinkMap(mapModel, shrinkFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
map.save();
|
map.save();
|
||||||
|
} finally {
|
||||||
|
mapManager.release(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseDirectory == null || baseDirectory.length() <= 0) {
|
if (baseDirectory == null || baseDirectory.length() <= 0) {
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,16 @@ void checkMap(File mapFile, String mapPath) {
|
||||||
log("- cannot load map file");
|
log("- cannot load map file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCollector errorCollector;
|
ErrorCollector errorCollector;
|
||||||
try {
|
try {
|
||||||
validators.validateAll(map.getMapModel());
|
try {
|
||||||
} finally {
|
validators.validateAll(map.getMapModel());
|
||||||
errorCollector = map.getMapModel().getErrors();
|
} finally {
|
||||||
if (map.nViews() <= 0) {
|
errorCollector = map.getMapModel().getErrors();
|
||||||
mapManager.closeLevel(map);
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
mapManager.release(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,7 @@ boolean updateMap(File mapFile, File pictureFile) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (map.nViews() <= 0) {
|
mapManager.release(map);
|
||||||
mapManager.closeLevel(map);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue