if (clientgui != null) {  final Entity selectedEntity = clientgui.mechD.getCurrentEntity(); if(selectedWeapon != null && selectedEntity != null) {  int amod = 0;  if(selectedEntity.getOwner().getArtyAutoHitHexes().contains(mcoords)) { amod = TargetRoll.AUTOMATIC_SUCCESS; } else { amod = selectedEntity.aTracker.getModifier(selectedWeapon, mcoords); }  if(amod==TargetRoll.AUTOMATIC_SUCCESS) { strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAutohit"); } else { strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAdjustment", new Object[] { new Integer(amod) } ); }
if(curWeapon != null && selectedEntity != null) {  int amod = 0;  if(selectedEntity.getOwner().getArtyAutoHitHexes().contains(mcoords)) { amod = TargetRoll.AUTOMATIC_SUCCESS; } else { amod = selectedEntity.aTracker.getModifier(curWeapon, mcoords); }  if(amod==TargetRoll.AUTOMATIC_SUCCESS) { strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAutohit"); } else { strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAdjustment", new Object[] { new Integer(amod) } );
    private String[] getTipText(Point point) {        int stringsSize = 0;        IHex mhex = null;        // first, we have to determine how much text we are going to have        // are we on a hex?        final Coords mcoords = getCoordsAt(point);        if (GUIPreferences.getInstance().getShowMapHexPopup() && game.getBoard().contains(mcoords)) {            mhex = game.getBoard().getHex(mcoords);            stringsSize += 1;        }        // check if it's on any entities        for (Iterator i = entitySprites.iterator(); i.hasNext();) {            final EntitySprite eSprite = (EntitySprite)i.next();            if (eSprite.isInside(point)) {                stringsSize += 3;            }        }        // check if it's on any attacks        for (Iterator i = attackSprites.iterator(); i.hasNext();) {            final AttackSprite aSprite = (AttackSprite)i.next();            if (aSprite.isInside(point)) {                stringsSize += 1 + aSprite.weaponDescs.size();            }        }        // If the hex contains a building or rubble, make more space.        if ( mhex != null &&             (mhex.containsTerrain(Terrains.RUBBLE) ||              mhex.containsTerrain(Terrains.BUILDING)) ) {            stringsSize += 1;        }        stringsSize += game.getNbrMinefields(mcoords);                // Artillery        final Vector artilleryAttacks = getArtilleryAttacksAtLocation(mcoords);        stringsSize += artilleryAttacks.size();        // Artillery fire adjustment        final Mounted selectedWeapon = getSelectedArtilleryWeapon();        if(selectedWeapon != null)            stringsSize++;        // 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;            // Do we have rubble?            if ( mhex.containsTerrain(Terrains.RUBBLE) ) {                strings[stringsIndex] = Messages.getString("BoardView1.Rubble"); //$NON-NLS-1$                stringsIndex += 1;            }            // Do we have a building?            else 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() );                strings[stringsIndex] = buf.toString();                stringsIndex += 1;            }            if (game.containsMinefield(mcoords)) {                java.util.Vector minefields = game.getMinefields(mcoords);                for (int i = 0; i < minefields.size(); i++){                    Minefield mf = (Minefield) 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") +" " + owner; //$NON-NLS-1$ //$NON-NLS-2$                        break;                    case (Minefield.TYPE_THUNDER) :                        strings[stringsIndex] = mf.getName()+Messages.getString("BoardView1.minefield")+"(" + mf.getDamage() + ")" + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$                        break;                    case (Minefield.TYPE_COMMAND_DETONATED) :                        strings[stringsIndex] = mf.getName()+Messages.getString("BoardView1.minefield") +" " + 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.getSetting() + ") " + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$                        } else {                            strings[stringsIndex] = mf.getName()+Messages.getString("BoardView1.minefield") + " " + owner; //$NON-NLS-1$ //$NON-NLS-2$                        }                        break;                    case (Minefield.TYPE_THUNDER_ACTIVE) :                        strings[stringsIndex] = mf.getName()+Messages.getString("BoardView1.minefield")+"(" + mf.getDamage() + ")" + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$                        break;                    case (Minefield.TYPE_THUNDER_INFERNO) :                        strings[stringsIndex] = mf.getName()+Messages.getString("BoardView1.minefield")+"(" + mf.getDamage() + ")" + owner; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$                        break;                    }                    stringsIndex++;                }            }        }        // check if it's on any entities        for (Iterator i = entitySprites.iterator(); i.hasNext();) {            final EntitySprite eSprite = (EntitySprite)i.next();            if (eSprite.isInside(point)) {                final String[] entityStrings = eSprite.getTooltip();                java.lang.System.arraycopy(entityStrings, 0, strings, stringsIndex, entityStrings.length);                stringsIndex += entityStrings.length;            }        }        // check if it's on any attacks        for (Iterator i = attackSprites.iterator(); i.hasNext();) {            final AttackSprite aSprite = (AttackSprite)i.next();            if (aSprite.isInside(point)) {                final String[] attackStrings = aSprite.getTooltip();                java.lang.System.arraycopy(attackStrings, 0, strings, stringsIndex, attackStrings.length);                stringsIndex += 1 + aSprite.weaponDescs.size();            }        }                // check artillery attacks        for(Iterator i = artilleryAttacks.iterator(); i.hasNext();) {            final ArtilleryAttackAction aaa = (ArtilleryAttackAction)i.next();            final WeaponResult wr = aaa.getWR();            final Entity ae = game.getEntity(wr.waa.getEntityId());            String s = null;            if(ae != null) {                if(wr.waa.getWeaponId() > -1) {                    Mounted weap = ae.getEquipment(wr.waa.getWeaponId());                    s = weap.getName();                    if(wr.waa.getAmmoId() > -1) {                        Mounted ammo = ae.getEquipment(wr.waa.getAmmoId());                        s += "(" + ammo.getName() + ")";                    }                }            }            if(s == null) {                s = Messages.getString("BoardView1.Artillery");            }            strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAttack",                     new Object[] { s, new Integer(aaa.turnsTilHit), wr.toHit.getValueAsString() } );        }        //TODO please eliminate the usage of the clientgui        if (clientgui != null) {            //check artillery fire adjustment            final Entity selectedEntity = clientgui.mechD.getCurrentEntity();            if(selectedWeapon != null && selectedEntity != null) {                //process targetted hexes                int amod = 0;                //Check the predesignated hexes                if(selectedEntity.getOwner().getArtyAutoHitHexes().contains(mcoords)) {                    amod = TargetRoll.AUTOMATIC_SUCCESS;                }                else {                    amod = selectedEntity.aTracker.getModifier(selectedWeapon, mcoords);                }                                if(amod==TargetRoll.AUTOMATIC_SUCCESS) {                    strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAutohit");                } else {                    strings[stringsIndex++] = Messages.getString("BoardView1.ArtilleryAdjustment", new Object[] { new Integer(amod) } );                }            }        }        return strings;    }