if (tp == null) {  return TrainModel.STATE_RUNNABLE; }
    private int setPathToDestination(ObjectKey trainKey, TrainModel tm) {	GameTime t = (GameTime) world.get(ITEM.TIME, Player.AUTHORITATIVE);	Integer timeOfLastAttempt = (Integer) lostTrains.get(trainKey);	if (timeOfLastAttempt != null) {	    GameCalendar gc = (GameCalendar) world.get(ITEM.CALENDAR,		    Player.AUTHORITATIVE);	    if (timeOfLastAttempt.intValue() + gc.getTicksPerDay() 		    > t.getTime())		return tm.getState();	}	final Point head = new Point();		Point stationCoords = getCurrentDestination(tm);	if (stationCoords == null) {	    /* no orders */	    ChangeTrainMove ctm = ChangeTrainMove.generateMove(trainKey.index,		    trainKey.principal, tm, (TrainPath) null, null, t);	    moveReceiver.processMove(ctm);	    return TrainModel.STATE_STOPPED;	}	tm.getPosition(t).getHead(head);	TrainPath tp = pathFinder.findPath(stationCoords, head);	TrainPathFunction tpf = buildPathFunction(tp, tm,		tm.getTrainMotionModel().isOutOfWater());	ChangeTrainMove ctm;	if (tpf == null) {	    // train can't climb hill	    // train is already lost, so no new move required	    lostTrains.put(trainKey, new Integer(t.getTime()));	    return TrainModel.STATE_RUNNABLE;	} else {	    ctm = ChangeTrainMove.generateMove(trainKey.index,		    trainKey.principal, tm, tp, tpf, t);	    lostTrains.remove(trainKey);	}	moveReceiver.processMove(ctm);	return TrainModel.STATE_RUNNABLE;    }