// Artillery
final ArrayList<ArtilleryAttackAction> artilleryAttacks = getArtilleryAttacksAtLocation(mcoords);
stringsSize += artilleryAttacks.size();
// Artillery fire adjustment
final Mounted curWeapon = getSelectedArtilleryWeapon();
if (curWeapon != null) {
stringsSize++;
}
/*
* Eventaul replacemtn for the artilery popup.
*
final Collection<SpecialHexDisplay> specials = game.getBoard().getSpecialHexDisplay(mcoords);
if(specials != null)
stringsSize += specials.size();
// if the size is zip, you must a'quit
if (stringsSize == 0) {
return null;
}*/
// now we can allocate an array of strings
String[] strings = new String[stringsSize];
int stringsIndex = 0;
// are we on a hex?
if (mhex != null) {
strings[stringsIndex] = Messages.getString("BoardView1.Hex") + mcoords.getBoardNum() //$NON-NLS-1$
+ Messages.getString("BoardView1.level") + mhex.getElevation(); //$NON-NLS-1$
stringsIndex += 1;
//cycle through the terrains and report types found
//this will skip buildings and other constructed units
for(int i=0;i < Terrains.SIZE; i++) {
if(mhex.containsTerrain(i)) {
int tf = mhex.getTerrain(i).getTerrainFactor();
int ttl = mhex.getTerrain(i).getLevel();
String name = Terrains.getDisplayName(i, ttl);
if(tf > 0) {
name = name + " (" + tf + ")";
}
if(null != name) {
strings[stringsIndex] = name;
stringsIndex += 1;
}
}
}
// Do we have a building?
if (mhex.containsTerrain(Terrains.FUEL_TANK)) {
// Get the building.
Building bldg = game.getBoard().getBuildingAt(mcoords);
StringBuffer buf = new StringBuffer(Messages
.getString("BoardView1.Height")); //$NON-NLS-1$
// Each hex of a building has its own elevation.
buf.append(mhex.terrainLevel(Terrains.FUEL_TANK_ELEV));
buf.append(" "); //$NON-NLS-1$
buf.append(bldg.toString());
buf.append(Messages.getString("BoardView1.CF")); //$NON-NLS-1$
buf.append(bldg.getCurrentCF(mcoords));
strings[stringsIndex] = buf.toString();
stringsIndex += 1;
}
if (mhex.containsTerrain(Terrains.BUILDING)) {
// Get the building.
Building bldg = game.getBoard().getBuildingAt(mcoords);
StringBuffer buf = new StringBuffer(Messages
.getString("BoardView1.Height")); //$NON-NLS-1$
// Each hex of a building has its own elevation.
buf.append(mhex.terrainLevel(Terrains.BLDG_ELEV));
buf.append(" "); //$NON-NLS-1$
buf.append(bldg.toString());
buf.append(Messages.getString("BoardView1.CF")); //$NON-NLS-1$
buf.append(bldg.getCurrentCF(mcoords));
strings[stringsIndex] = buf.toString();
stringsIndex += 1;
}
// Do we have a bridge?
if (mhex.containsTerrain(Terrains.BRIDGE)) {
// Get the building.
Building bldg = game.getBoard().getBuildingAt(mcoords);
StringBuffer buf = new StringBuffer(Messages
.getString("BoardView1.Height")); //$NON-NLS-1$
// Each hex of a building has its own elevation.
buf.append(mhex.terrainLevel(Terrains.BRIDGE_ELEV));
buf.append(" "); //$NON-NLS-1$
buf.append(bldg.toString());
buf.append(Messages.getString("BoardView1.CF")); //$NON-NLS-1$
buf.append(bldg.getCurrentCF(mcoords));
strings[stringsIndex] = buf.toString();
stringsIndex += 1;
}
if (game.containsMinefield(mcoords)) {
Vector<Minefield> minefields = game.getMinefields(mcoords);
for (int i = 0; i < minefields.size(); i++) {
Minefield mf = minefields.elementAt(i);
String owner = " (" + game.getPlayer(mf.getPlayerId()).getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
switch (mf.getType()) {
case (Minefield.TYPE_CONVENTIONAL):
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")" + " " + owner; //$NON-NLS-1$ //$NON-NLS-2$
break;
case (Minefield.TYPE_COMMAND_DETONATED):
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")"+ " " + owner; //$NON-NLS-1$ //$NON-NLS-2$
break;
case (Minefield.TYPE_VIBRABOMB):
if (mf.getPlayerId() == localPlayer.getId()) {
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")" + "(" + mf.getSetting() + ") " + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")" + " " + owner; //$NON-NLS-1$ //$NON-NLS-2$
}
break;
case (Minefield.TYPE_ACTIVE):
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")" + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
break;
case (Minefield.TYPE_INFERNO):
strings[stringsIndex] = mf.getName()
+ Messages
.getString("BoardView1.minefield") + "(" + mf.getDensity() + ")" + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
break;
}
stringsIndex++;
}
}
}
// check if it's on any entities
for (EntitySprite eSprite : entitySprites) {
if (eSprite.isInside(point)) {
final String[] entityStrings = eSprite.getTooltip();
System.arraycopy(entityStrings, 0, strings, stringsIndex,
entityStrings.length);
stringsIndex += entityStrings.length;
}
}
// check if it's on any attacks
for (AttackSprite aSprite : attackSprites) {
if (aSprite.isInside(point)) {
final String[] attackStrings = aSprite.getTooltip();
System.arraycopy(attackStrings, 0, strings, stringsIndex,
attackStrings.length);
stringsIndex += 1 + aSprite.weaponDescs.size();
}
}
// check artillery attacks
for (ArtilleryAttackAction aaa : artilleryAttacks) {
final Entity ae = game.getEntity(aaa.getEntityId());
String s = null;
if (ae != null) {
if (aaa.getWeaponId() > -1) {
Mounted weap = ae.getEquipment(aaa.getWeaponId());
s = weap.getName();
if (aaa.getAmmoId() > -1) {
Mounted ammo = ae.getEquipment(aaa.getAmmoId());
s += "(" + ammo.getName() + ")";
}
}
}
if (s == null) {
s = Messages.getString("BoardView1.Artillery");