this.doEntityFallsInto( entity, coords, coords, psr );
doEntityFallsInto( entity, coords, coords, psr );
    public void collapseBuilding( Building bldg, Hashtable positionMap ) {        // Loop through the hexes in the building, and apply        // damage to all entities inside or on top of the building.        Report r;        final int phaseCF = bldg.getPhaseCF();        Enumeration bldgCoords = bldg.getCoords();        while ( bldgCoords.hasMoreElements() ) {            final Coords coords = (Coords) bldgCoords.nextElement();            // Get the Vector of Entities at these coordinates.            final Vector vector = (Vector) positionMap.get( coords );            // Are there any Entities at these coords?            if ( vector != null ) {                // How many levels does this building have in this hex?                final IHex curHex = game.getBoard().getHex( coords );                final int hexElev = curHex.surface();                final int bridgeEl = curHex.terrainLevel(Terrains.BRIDGE_ELEV);                final int numFloors = Math.max(bridgeEl, curHex.terrainLevel( Terrains.BLDG_ELEV ));                // Sort in elevation order                Collections.sort(vector, new Comparator<Entity>() {                    public int compare(Entity a, Entity b) {                        if(a.getElevation() > b.getElevation())                            return -1;                        else if(a.getElevation() > b.getElevation())                            return 1;                        return 0;                    }                });                // Walk through the entities in this position.                Enumeration entities = vector.elements();                while ( entities.hasMoreElements() ) {                    final Entity entity = (Entity) entities.nextElement();                    //final int entityElev = entity.elevationOccupied( curHex );                    int floor = entity.getElevation();                    // Ignore units above the building / bridge.                    if ( floor > numFloors) {                        continue;                    }                    // Treat units on the roof like                    // they were in the top floor.                    if ( floor == numFloors ) {                        floor--;                    }                    // Calculate collapse damage for this entity.                    int damage = (int) Math.ceil                        ( phaseCF * (numFloors-floor) / 10.0 );                    // Infantry suffer triple damage.                    if ( entity instanceof Infantry ) {                        damage *= 3;                    }                    // Apply collapse damage the entity.                    // ASSUMPTION: use 5 point clusters.                    r = new Report(6455);                    r.indent();                    r.subject = entity.getId();                    r.add(entity.getDisplayName());                    r.add(damage);                    addReport(r);                    int remaining = damage;                    int cluster = damage;                    if ( entity instanceof BattleArmor ||                         entity instanceof Mech ||                         entity instanceof Tank ) {                        cluster = 5;                    }                    while ( remaining > 0 ) {                        int next = Math.min( cluster, remaining );                        // In www.classicbattletech.com/PDF/AskPMForumArchiveandFAQ.pdf,                        // pg. 18, Randall Bills says that all damage from a                        // collapsing building is applied to the front.                        HitData hit = entity.rollHitLocation                            (ToHitData.HIT_NORMAL, ToHitData.SIDE_FRONT );                        addReport( damageEntity(entity, hit, next) );                        remaining -= next;                    }                    addReport(new Report(1210));                    // TODO: Why are dead entities showing up on firing phase?                    // Do we need to handle falling Meks?                    // BMRr, pg. 53 only mentions falling BattleMechs;                    // Tanks can't be above the floor and I guess that                    // infantry don't suffer falling damage.                    // TODO: implement basements, then fall into it.                    // ASSUMPTION: we'll let the Mech fall twice: once                    // during damageEntity() above and once here.                    floor = entity.getElevation();                    if ( floor > 0 || floor == bridgeEl) {                        // ASSUMPTION: PSR to avoid pilot damage                        // should use mods for entity damage and                        // 20+ points of collapse damage (if any).                        PilotingRollData psr = entity.getBasePilotingRoll();                        entity.addPilotingModifierForTerrain(psr, coords);                        if ( damage >= 20 ) {                            psr.addModifier( 1, "20+ damage" );                        }                        this.doEntityFallsInto( entity, coords, coords, psr );                    }                    // Update this entity.                    // ASSUMPTION: this is the correct thing to do.                    this.entityUpdate( entity.getId() );                } // Handle the next entity.            } // End have-entities-here.        } // Handle the next hex of the building.        // Update the building.        bldg.setCurrentCF( 0 );        bldg.setPhaseCF( 0 );        send( createCollapseBuildingPacket(bldg) );        game.getBoard().collapseBuilding( bldg );    } // End private void collapseBuilding( Building )