System.out.println("Before CTDM: " + tm.getTrainMotionModel());
    private void loadTrain(TrainModel tm, GameTime now, FreerailsPrincipal p,	    int trainIndex) {	/* get the details of the station the train is at */	Point point = new Point();	tm.getPosition().getHead(point);	FreerailsPrincipal sp = null;	NonNullElements j = new NonNullElements(KEY.PLAYERS, world,		Player.AUTHORITATIVE);	NonNullElements i = null;	boolean flag = false;	StationModel sm;	while (j.next()) {	    sp = ((Player) j.getElement()).getPrincipal();	    i = new NonNullElements(KEY.STATIONS, world, sp);	    while (i.next()) {		sm = (StationModel) i.getElement();		if (sm.getStationX() == point.x &&			sm.getStationY() == point.y) {		    flag = true;		    break;		}	    }	}	if (flag) {	    DropOffAndPickupCargoMoveGenerator dopucmg = new		DropOffAndPickupCargoMoveGenerator(p, trainIndex, sp,			i.getIndex(), world);	    Move m = dopucmg.generateMove();	    moveReceiver.processMove(m);	}	// set the trains new destination	System.out.println("Before CTDM: " + tm.getTrainMotionModel());	Move ctdm = ChangeTrainDestinationMove.generateMove(world,		new ObjectKey(KEY.TRAINS, p, trainIndex),		tm.getScheduleIterator().nextOrder(world));	moveReceiver.processMove(ctdm);	System.out.println("After CTDM: " + ((TrainModel) world.get(KEY.TRAINS, trainIndex, p)).getTrainMotionModel());	setState(trainIndex, p, TrainModel.STATE_RUNNABLE);	return;    }