コード例 #1
0
/*!
  \param[in] pred The node preceding this node (in the path).
  \param[in] cargoLimit The cargo limit of the vehicle.
  */
void
Vehicle_node::evaluate(const Vehicle_node &pred, double cargoLimit) {
    /* time */
    m_travel_time    = pred.travel_time_to(*this);
    m_arrival_time   = pred.departure_time() + travel_time();
    m_wait_time      = is_early_arrival(arrival_time()) ?
                       opens() - m_arrival_time :
                       0;
    m_departure_time = arrival_time() + wait_time() + service_time();

    /* time aggregates */
    m_tot_travel_time = pred.total_travel_time() + travel_time();
    m_tot_wait_time    = pred.total_wait_time()    + wait_time();
    m_tot_service_time = pred.total_service_time() + service_time();

    /* cargo aggregates */
    if (is_dump() &&  pred.cargo() >= 0) {
        m_demand = -pred.cargo();
    }
    m_cargo = pred.cargo() + demand();

    /* cargo aggregates */

    m_twvTot = has_twv() ? pred.twvTot() + 1 : pred.twvTot();
    m_cvTot = has_cv(cargoLimit) ? pred.cvTot() + 1 : pred.cvTot();
    m_delta_time = departure_time() - pred.departure_time();
}
コード例 #2
0
void action_t::schedule_travel()
{
  time_to_travel = travel_time();

  if ( time_to_travel == 0 ) return;

  if ( sim -> log )
  {
    log_t::output( sim, "%s schedules travel for %s", player -> name(), name() );
  }

  new ( sim ) action_travel_event_t( sim, this, time_to_travel );
}
コード例 #3
0
float sort_by_travel_time_to_target(void *p){
	pas_asset asset = *((pas_asset*)p);
	return travel_time(asset.base_loc, _pas_target, asset.op_speed);
}