use of main.game.logic.dungeon.editor.gui.LE_MapViewComp in project Eidolons by IDemiurge.
the class Level method removeObj.
public void removeObj(DC_Obj obj) {
Chronos.mark("removing " + obj);
Unit unit = null;
if (obj instanceof Unit) {
unit = (Unit) obj;
}
if (obj instanceof Entrance) {
if (location.getMainEntrance() != null) {
location.setMainEntrance(null);
location.getPlan().setEntranceLayout(null);
} else if (location.getMainExit() == null) {
location.setMainExit(null);
location.getPlan().setExitLayout(null);
}
location.getEntrances().remove(obj);
}
// TODO getOrCreate Top object!
// ++ ZOrder...
Coordinates coordinates = obj.getCoordinates();
LevelEditor.getSimulation().remove(obj);
// TODO ???
// obj = dungeon.getMinimap().getGrid().getTopObj(coordinates);
// if (obj != null)
// if (!unit.isOverlaying())TODO
MapBlock b = LevelEditor.getMapMaster().getBlock();
if (b == null) {
b = getBlockForCoordinate(coordinates, false);
}
if (b != null) {
boolean result = !b.removeObject(obj, coordinates);
if (result) {
if (unit.isLandscape()) {
b.addCoordinate(obj.getCoordinates());
}
}
} else {
b = LevelEditor.getMainPanel().getPlanPanel().getSelectedBlock();
if (b == null) {
b = getBlockForCoordinate(coordinates, true);
} else if (!CoordinatesMaster.isAdjacent(b.getCoordinates(), coordinates)) {
b = getBlockForCoordinate(coordinates, true);
}
if (b != null) {
if (!unit.isOverlaying()) {
b.addCoordinate(obj.getCoordinates());
}
}
}
if (unit != null) {
if (!unit.isOverlaying()) // if (LevelEditor.isMinimapMode())
{
if (LE_MapViewComp.isMinimapMode()) {
LevelEditor.getMainPanel().getMiniGrid().refreshComp(null, obj.getCoordinates());
} else {
LE_MapViewComp comp = LevelEditor.getMainPanel().getMapViewComp();
comp.getGrid().getCompForObject(obj).refresh();
comp.getGrid().refresh();
comp.getGrid().getCompForObject(obj).refresh();
comp.getGrid().getPanel().repaint();
}
}
}
// TODO ADD COORDINATE!
Chronos.logTimeElapsedForMark("removing " + obj);
}
Aggregations