Entity e = game.getEntity(pkt.getIntValue(0)); Coords c = (Coords)pkt.getObject(1); int nFacing = pkt.getIntValue(2);   int loadedCount = pkt.getIntValue(3); int loadedId = -1; Entity loaded = null; for ( int loop = 0; loop < loadedCount; loop++ ){ loadedId = pkt.getIntValue( 4 + loop ); loaded = game.getEntity( loadedId ); if ( loaded == null || loaded.getPosition() != null || loaded.getTransportId() != Entity.NONE ) {  System.err.println( e.getShortName() + " can not load entity #" + loadedId ); break; } else {  this.loadUnit( e, loaded ); } }  if (game.board.isLegalDeployment(c, e.getOwner())) { e.setPosition(c); e.setFacing(nFacing); e.setSecondaryFacing(nFacing); e.setDone(true); entityUpdate(e.getId()); } else { System.err.println("Received invalid deployment for " + e.getShortName());
if (game.getPhase() != Game.PHASE_DEPLOYMENT) { System.err.println("error: server got deployment packet in wrong phase");
    private void receiveDeployment(Packet pkt) {        if (game.phase != game.PHASE_DEPLOYMENT) {            return;        }                Entity e = game.getEntity(pkt.getIntValue(0));        Coords c = (Coords)pkt.getObject(1);        int nFacing = pkt.getIntValue(2);        // Handle units that deploy loaded with other units.        int loadedCount = pkt.getIntValue(3);        int loadedId = -1;        Entity loaded = null;        for ( int loop = 0; loop < loadedCount; loop++ ){            loadedId = pkt.getIntValue( 4 + loop );            loaded = game.getEntity( loadedId );            if ( loaded == null || loaded.getPosition() != null ||                 loaded.getTransportId() != Entity.NONE ) {                // Something is fishy in Denmark.                System.err.println( e.getShortName() + " can not load entity #" +                                    loadedId );                break;            }            else {                // Have the deployed unit load the indicated unit.                this.loadUnit( e, loaded );            }        }        if (game.board.isLegalDeployment(c, e.getOwner())) {            e.setPosition(c);            e.setFacing(nFacing);            e.setSecondaryFacing(nFacing);            e.setDone(true);            entityUpdate(e.getId());        }        else {            System.err.println("Received invalid deployment for " + e.getShortName());        }        	boolean infMoveMulti = game.getOptions().booleanOption("inf_move_multi");	// Is the entity Infantry?	if ( e instanceof Infantry ) {	    // Increment the counter.	    turnInfMoved++;	    // Record the player moving the infantry.	    turnLastPlayerId = e.getOwnerId();	    // Do infantry move in blocks?	    if ( infMoveMulti ) {		// Are we at the end of a block?		if ( Game.INF_MOVE_MULTI == turnInfMoved ||		     !game.hasInfantry(turnLastPlayerId) ) {		    // Yup.  Reset the counter.		    turnInfMoved = 0;		}		else {		    // Nope.  Decrement the turn index.		    turnIndex--;		}	    } // End inf_move_multi	} // End entity-is-infantry    }