mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-27 14:58:55 +01:00
data using a thread-safe collection. Some NPEs fixed. More data protection in tiled integration functions (better state checking, backup tiled-made file before saving ATCS-made data). jardesc file added for convenience.
46 lines
1.1 KiB
Java
46 lines
1.1 KiB
Java
package com.gpl.rpg.atcontentstudio.model.maps;
|
|
|
|
import java.awt.Image;
|
|
|
|
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
|
import com.gpl.rpg.atcontentstudio.model.gamedata.Droplist;
|
|
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
|
|
|
public class ContainerArea extends MapObject {
|
|
|
|
public Droplist droplist = null;
|
|
|
|
public ContainerArea(tiled.core.MapObject obj) {}
|
|
|
|
@Override
|
|
public void link() {
|
|
droplist = parentMap.getProject().getDroplist(name);
|
|
if (droplist != null) {
|
|
droplist.addBacklink(parentMap);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public Image getIcon() {
|
|
if (droplist != null) return DefaultIcons.getContainerIcon();
|
|
else return DefaultIcons.getNullifyIcon();
|
|
}
|
|
|
|
@Override
|
|
public void elementChanged(GameDataElement oldOne, GameDataElement newOne) {
|
|
if (oldOne == droplist) {
|
|
oldOne.removeBacklink(parentMap);
|
|
droplist = (Droplist) newOne;
|
|
if (newOne != null) newOne.addBacklink(parentMap);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void savePropertiesInTmxObject(tiled.core.MapObject tmxObject) {
|
|
if (droplist != null) {
|
|
tmxObject.setName(droplist.id);
|
|
}
|
|
}
|
|
|
|
}
|