null, false);
null, false, true, true);
    public void buildTrain(int engineTypeNumber, int[] wagons, Point p,	    FreerailsPrincipal tp) {        FreerailsTile tile = (FreerailsTile)world.getTile(p.x, p.y);        if (null != tile.getTrackTile()) {            //Add train to train list.            CargoBundle cb = new CargoBundleImpl();            int cargoBundleNumber = world.size(KEY.CARGO_BUNDLES);            Move addCargoBundleMove = new AddCargoBundleMove(cargoBundleNumber,                    cb);            int scheduleNumber = world.size(KEY.TRAIN_SCHEDULES);	    GameTime now = (GameTime) world.get(ITEM.TIME,		    Player.AUTHORITATIVE);            TrainModel train = new TrainModel(engineTypeNumber, wagons,                    cargoBundleNumber, now);            EngineType engineType = (EngineType)world.get(KEY.ENGINE_TYPES,                    engineTypeNumber);            int trainNumber = world.size(KEY.TRAINS, tp);            WorldIterator wi = new NonNullElements(KEY.STATIONS, world, tp);            MutableSchedule s = new MutableSchedule();	    /*	     * Add upto 4 stations to the schedule. Stations are selected from	     * those owned by the train owner.	     */            while (wi.next() && s.getNumOrders() < 5) {                TrainOrdersModel orders = new TrainOrdersModel		    (new ObjectKey(KEY.STATIONS, tp, wi.getIndex()),                        null, false);                s.addOrder(orders);            }	    train = new TrainModel(train, new ScheduleIterator(scheduleNumber,			0));            ImmutableSchedule is = s.toImmutableSchedule();	    AddTrainMove addTrainMove = AddTrainMove.generateMove(world,		    trainNumber,		    train, engineType.getPrice(), is, tp);            Move compositeMove = new CompositeMove(new Move[] {                        addCargoBundleMove, addTrainMove });            moveReceiver.processMove(compositeMove);        } else {            throw new IllegalArgumentException("No track here (" + p.x + ", " +                p.y + ") so cannot build train");        }    }