if (data.getSpecialActions() != null) {
// There id some special action to show
int col = 0;
int row = 0;
for (String name : data.getSpecialActions()) {
final ColonyAction sa = SpecialActionManager.get(
GameData.getSelectedColony(), name);
ImageButton btn = this.buildingButtons[col][row];
btn.setImageRef(sa.getGfxKey());
btn.setActionHandler(new ActionHandler() {
@Override
public void run() {
if (ResourceHelper.enoughResourcesFor(sa
.getCostMap())) {
sa.setLinkedBuilding(SectorState.this.selectedBuilding);
final Colony cc = GameData.getSelectedColony();
for (Resource r : Resource.values()) {
BigDecimal d = sa.getCostMap().get(r);
if (d == null) {
continue;
}
cc.updateResource(r, d.negate());
}
GameData.getSelectedColony().addSpecialAction(
sa);
} else {
// TODO Play error sound
}
}
});
btn.show();
if (getSelectedBuildingAction() == null) {
btn.enable();
} else {
btn.disable();
}
if (btn.isHovered()) {
showUpgradeCost(sa.getCostMap(), g, btn);
}
col++;
if (col == 3) {
col = 0;
row++;