Fix various whitespace and style issues.
This commit is contained in:
@@ -124,10 +124,9 @@ void Order::MakeLoading(bool ordered)
|
||||
/**
|
||||
* Makes this order a Leave Station order.
|
||||
*/
|
||||
|
||||
bool Order::UpdateJumpCounter(byte percent)
|
||||
{
|
||||
if(this->jump_counter >= 0) {
|
||||
if (this->jump_counter >= 0) {
|
||||
this->jump_counter += (percent - 100);
|
||||
return true;
|
||||
}
|
||||
@@ -961,9 +960,7 @@ static CargoID GetFirstValidCargo()
|
||||
if (CargoSpec::Get(i)->IsValid()) return i;
|
||||
}
|
||||
/* No cargos defined -> 'Houston, we have a problem!' */
|
||||
assert(0);
|
||||
/* Return something to avoid compiler warning */
|
||||
return 0;
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2014,7 +2011,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
|
||||
}
|
||||
case OCV_PERCENT: {
|
||||
/* get a non-const reference to the current order */
|
||||
Order *ord = (Order *)order;
|
||||
Order *ord = const_cast<Order *>(order);
|
||||
skip_order = ord->UpdateJumpCounter((byte)value);
|
||||
break;
|
||||
}
|
||||
|
@@ -348,39 +348,40 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
SetDParam(1, order->GetConditionSkipToOrder() + 1);
|
||||
const OrderConditionVariable ocv = order->GetConditionVariable( );
|
||||
/* handle some non-ordinary cases seperately */
|
||||
if ( ocv == OCV_UNCONDITIONALLY ) {
|
||||
if (ocv == OCV_UNCONDITIONALLY) {
|
||||
SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
|
||||
} else if ( ocv == OCV_PERCENT ) {
|
||||
SetDParam( 0, STR_CONDITIONAL_PERCENT );
|
||||
SetDParam( 2, order->GetConditionValue( ) );
|
||||
} else if ( ocv == OCV_FREE_PLATFORMS ) {
|
||||
SetDParam( 0, STR_CONDITIONAL_FREE_PLATFORMS );
|
||||
SetDParam( 2, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + order->GetConditionComparator() );
|
||||
SetDParam( 3, order->GetConditionValue( ) );
|
||||
} else if (ocv == OCV_PERCENT) {
|
||||
SetDParam(0, STR_CONDITIONAL_PERCENT);
|
||||
SetDParam(2, order->GetConditionValue());
|
||||
} else if (ocv == OCV_FREE_PLATFORMS) {
|
||||
SetDParam(0, STR_CONDITIONAL_FREE_PLATFORMS );
|
||||
SetDParam(2, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + order->GetConditionComparator());
|
||||
SetDParam(3, order->GetConditionValue());
|
||||
} else {
|
||||
OrderConditionComparator occ = order->GetConditionComparator();
|
||||
bool is_cargo = ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING;
|
||||
SetDParam( 0, is_cargo ? STR_ORDER_CONDITIONAL_CARGO : (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_ORDER_CONDITIONAL_TRUE_FALSE : STR_ORDER_CONDITIONAL_NUM );
|
||||
SetDParam( 2, (ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING || ocv == OCV_FREE_PLATFORMS) ? STR_ORDER_CONDITIONAL_NEXT_STATION : STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv );
|
||||
SetDParam(0, is_cargo ? STR_ORDER_CONDITIONAL_CARGO : (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_ORDER_CONDITIONAL_TRUE_FALSE : STR_ORDER_CONDITIONAL_NUM);
|
||||
SetDParam(2, (ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING || ocv == OCV_FREE_PLATFORMS)
|
||||
? STR_ORDER_CONDITIONAL_NEXT_STATION : STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv);
|
||||
|
||||
uint value = order->GetConditionValue();
|
||||
switch ( ocv ) {
|
||||
switch (ocv) {
|
||||
case OCV_CARGO_ACCEPTANCE:
|
||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_ACCEPTS + occ - OCC_IS_TRUE );
|
||||
SetDParam( 4, CargoSpec::Get( value )->name );
|
||||
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_ACCEPTS + occ - OCC_IS_TRUE);
|
||||
SetDParam(4, CargoSpec::Get( value )->name );
|
||||
break;
|
||||
case OCV_CARGO_WAITING:
|
||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + occ - OCC_IS_TRUE );
|
||||
SetDParam( 4, CargoSpec::Get( value )->name );
|
||||
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + occ - OCC_IS_TRUE);
|
||||
SetDParam(4, CargoSpec::Get( value )->name );
|
||||
break;
|
||||
case OCV_REQUIRES_SERVICE:
|
||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ );
|
||||
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
|
||||
break;
|
||||
case OCV_MAX_SPEED:
|
||||
value = ConvertSpeedToDisplaySpeed( value );
|
||||
value = ConvertSpeedToDisplaySpeed(value);
|
||||
/* FALL THROUGH */
|
||||
default:
|
||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ );
|
||||
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
|
||||
SetDParam(4, value);
|
||||
}
|
||||
}
|
||||
@@ -391,8 +392,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
} else {
|
||||
SetDParam(5, STR_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
@@ -623,10 +625,15 @@ private:
|
||||
{
|
||||
if (order == NULL) return _order_conditional_condition;
|
||||
switch (order->GetConditionVariable()) {
|
||||
case OCV_FREE_PLATFORMS: //fall through
|
||||
case OCV_CARGO_WAITING: return _order_conditional_condition_has; break;
|
||||
case OCV_CARGO_ACCEPTANCE: return _order_conditional_condition_accepts; break;
|
||||
default: return _order_conditional_condition; break;
|
||||
case OCV_FREE_PLATFORMS:
|
||||
case OCV_CARGO_WAITING:
|
||||
return _order_conditional_condition_has;
|
||||
|
||||
case OCV_CARGO_ACCEPTANCE:
|
||||
return _order_conditional_condition_accepts;
|
||||
|
||||
default:
|
||||
return _order_conditional_condition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,10 +1153,10 @@ public:
|
||||
train_row_sel->SetDisplayedPlane(DP_GROUNDVEHICLE_ROW_CONDITIONAL);
|
||||
}
|
||||
OrderConditionVariable ocv = (order == NULL) ? OCV_LOAD_PERCENTAGE : order->GetConditionVariable();
|
||||
bool is_cargo = ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING;
|
||||
bool is_cargo = (ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING);
|
||||
|
||||
if ( is_cargo ) {
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_CARGO)->widget_data = cargo_names_list[order == NULL ? 0 : order->GetConditionValue()];
|
||||
if (is_cargo) {
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_CARGO)->widget_data = cargo_names_list[(order == NULL) ? 0 : order->GetConditionValue()];
|
||||
this->GetWidget<NWidgetStacked>(WID_O_SEL_COND_VALUE)->SetDisplayedPlane(DP_COND_VALUE_CARGO);
|
||||
} else {
|
||||
this->GetWidget<NWidgetStacked>(WID_O_SEL_COND_VALUE)->SetDisplayedPlane(DP_COND_VALUE_NUMBER);
|
||||
@@ -1413,10 +1420,8 @@ public:
|
||||
case WID_O_COND_COMPARATOR: {
|
||||
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
OrderConditionVariable cond_var = o->GetConditionVariable();
|
||||
ShowDropDownMenu(this, GetComparatorStrings( o ), o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0,
|
||||
(cond_var == OCV_REQUIRES_SERVICE ||
|
||||
cond_var == OCV_CARGO_ACCEPTANCE ||
|
||||
cond_var == OCV_CARGO_WAITING) ? 0x3F : 0xC0);
|
||||
ShowDropDownMenu(this, GetComparatorStrings(o), o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0,
|
||||
(cond_var == OCV_REQUIRES_SERVICE || cond_var == OCV_CARGO_ACCEPTANCE || cond_var == OCV_CARGO_WAITING) ? 0x3F : 0xC0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user