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.
|
* Makes this order a Leave Station order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Order::UpdateJumpCounter(byte percent)
|
bool Order::UpdateJumpCounter(byte percent)
|
||||||
{
|
{
|
||||||
if(this->jump_counter >= 0) {
|
if (this->jump_counter >= 0) {
|
||||||
this->jump_counter += (percent - 100);
|
this->jump_counter += (percent - 100);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -961,9 +960,7 @@ static CargoID GetFirstValidCargo()
|
|||||||
if (CargoSpec::Get(i)->IsValid()) return i;
|
if (CargoSpec::Get(i)->IsValid()) return i;
|
||||||
}
|
}
|
||||||
/* No cargos defined -> 'Houston, we have a problem!' */
|
/* No cargos defined -> 'Houston, we have a problem!' */
|
||||||
assert(0);
|
NOT_REACHED();
|
||||||
/* Return something to avoid compiler warning */
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2014,7 +2011,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
|
|||||||
}
|
}
|
||||||
case OCV_PERCENT: {
|
case OCV_PERCENT: {
|
||||||
/* get a non-const reference to the current order */
|
/* 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);
|
skip_order = ord->UpdateJumpCounter((byte)value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -348,41 +348,42 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
|||||||
SetDParam(1, order->GetConditionSkipToOrder() + 1);
|
SetDParam(1, order->GetConditionSkipToOrder() + 1);
|
||||||
const OrderConditionVariable ocv = order->GetConditionVariable( );
|
const OrderConditionVariable ocv = order->GetConditionVariable( );
|
||||||
/* handle some non-ordinary cases seperately */
|
/* handle some non-ordinary cases seperately */
|
||||||
if ( ocv == OCV_UNCONDITIONALLY ) {
|
if (ocv == OCV_UNCONDITIONALLY) {
|
||||||
SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
|
SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
|
||||||
} else if ( ocv == OCV_PERCENT ) {
|
} else if (ocv == OCV_PERCENT) {
|
||||||
SetDParam( 0, STR_CONDITIONAL_PERCENT );
|
SetDParam(0, STR_CONDITIONAL_PERCENT);
|
||||||
SetDParam( 2, order->GetConditionValue( ) );
|
SetDParam(2, order->GetConditionValue());
|
||||||
} else if ( ocv == OCV_FREE_PLATFORMS ) {
|
} else if (ocv == OCV_FREE_PLATFORMS) {
|
||||||
SetDParam( 0, STR_CONDITIONAL_FREE_PLATFORMS );
|
SetDParam(0, STR_CONDITIONAL_FREE_PLATFORMS );
|
||||||
SetDParam( 2, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + order->GetConditionComparator() );
|
SetDParam(2, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + order->GetConditionComparator());
|
||||||
SetDParam( 3, order->GetConditionValue( ) );
|
SetDParam(3, order->GetConditionValue());
|
||||||
} else {
|
} else {
|
||||||
OrderConditionComparator occ = order->GetConditionComparator();
|
OrderConditionComparator occ = order->GetConditionComparator();
|
||||||
bool is_cargo = ocv == OCV_CARGO_ACCEPTANCE || ocv == OCV_CARGO_WAITING;
|
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(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(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();
|
uint value = order->GetConditionValue();
|
||||||
switch ( ocv ) {
|
switch (ocv) {
|
||||||
case OCV_CARGO_ACCEPTANCE:
|
case OCV_CARGO_ACCEPTANCE:
|
||||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_ACCEPTS + occ - OCC_IS_TRUE );
|
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_ACCEPTS + occ - OCC_IS_TRUE);
|
||||||
SetDParam( 4, CargoSpec::Get( value )->name );
|
SetDParam(4, CargoSpec::Get( value )->name );
|
||||||
break;
|
break;
|
||||||
case OCV_CARGO_WAITING:
|
case OCV_CARGO_WAITING:
|
||||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + occ - OCC_IS_TRUE );
|
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_HAS + occ - OCC_IS_TRUE);
|
||||||
SetDParam( 4, CargoSpec::Get( value )->name );
|
SetDParam(4, CargoSpec::Get( value )->name );
|
||||||
break;
|
break;
|
||||||
case OCV_REQUIRES_SERVICE:
|
case OCV_REQUIRES_SERVICE:
|
||||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ );
|
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
|
||||||
break;
|
break;
|
||||||
case OCV_MAX_SPEED:
|
case OCV_MAX_SPEED:
|
||||||
value = ConvertSpeedToDisplaySpeed( value );
|
value = ConvertSpeedToDisplaySpeed(value);
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
default:
|
default:
|
||||||
SetDParam( 3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ );
|
SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
|
||||||
SetDParam(4, value);
|
SetDParam(4, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timetable && order->wait_time > 0) {
|
if (timetable && order->wait_time > 0) {
|
||||||
@@ -391,8 +392,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
|||||||
} else {
|
} else {
|
||||||
SetDParam(5, STR_EMPTY);
|
SetDParam(5, STR_EMPTY);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
@@ -562,9 +564,9 @@ private:
|
|||||||
DP_ROW_LOAD = 0, ///< Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window.
|
DP_ROW_LOAD = 0, ///< Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window.
|
||||||
DP_ROW_DEPOT = 1, ///< Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
|
DP_ROW_DEPOT = 1, ///< Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
|
||||||
|
|
||||||
/* WID_O_SEL_COND_VALUE */
|
/* WID_O_SEL_COND_VALUE */
|
||||||
DP_COND_VALUE_NUMBER = 0, ///< Display number widget
|
DP_COND_VALUE_NUMBER = 0, ///< Display number widget
|
||||||
DP_COND_VALUE_CARGO = 1, ///< Display dropdown widget cargo types
|
DP_COND_VALUE_CARGO = 1, ///< Display dropdown widget cargo types
|
||||||
|
|
||||||
DP_ROW_CONDITIONAL = 2, ///< Display the conditional order buttons in the top row of the ship/airplane order window.
|
DP_ROW_CONDITIONAL = 2, ///< Display the conditional order buttons in the top row of the ship/airplane order window.
|
||||||
|
|
||||||
@@ -623,10 +625,15 @@ private:
|
|||||||
{
|
{
|
||||||
if (order == NULL) return _order_conditional_condition;
|
if (order == NULL) return _order_conditional_condition;
|
||||||
switch (order->GetConditionVariable()) {
|
switch (order->GetConditionVariable()) {
|
||||||
case OCV_FREE_PLATFORMS: //fall through
|
case OCV_FREE_PLATFORMS:
|
||||||
case OCV_CARGO_WAITING: return _order_conditional_condition_has; break;
|
case OCV_CARGO_WAITING:
|
||||||
case OCV_CARGO_ACCEPTANCE: return _order_conditional_condition_accepts; break;
|
return _order_conditional_condition_has;
|
||||||
default: return _order_conditional_condition; break;
|
|
||||||
|
case OCV_CARGO_ACCEPTANCE:
|
||||||
|
return _order_conditional_condition_accepts;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return _order_conditional_condition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,7 +947,7 @@ public:
|
|||||||
if (CargoSpec::Get(c)->IsValid()) {
|
if (CargoSpec::Get(c)->IsValid()) {
|
||||||
this->cargo_names_list[c] = CargoSpec::Get(c)->name;
|
this->cargo_names_list[c] = CargoSpec::Get(c)->name;
|
||||||
SetBit(this->cargo_bitmask, c);
|
SetBit(this->cargo_bitmask, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->cargo_bitmask = ~this->cargo_bitmask;
|
this->cargo_bitmask = ~this->cargo_bitmask;
|
||||||
this->cargo_names_list[NUM_CARGO] = INVALID_STRING_ID;
|
this->cargo_names_list[NUM_CARGO] = INVALID_STRING_ID;
|
||||||
@@ -1146,14 +1153,14 @@ public:
|
|||||||
train_row_sel->SetDisplayedPlane(DP_GROUNDVEHICLE_ROW_CONDITIONAL);
|
train_row_sel->SetDisplayedPlane(DP_GROUNDVEHICLE_ROW_CONDITIONAL);
|
||||||
}
|
}
|
||||||
OrderConditionVariable ocv = (order == NULL) ? OCV_LOAD_PERCENTAGE : order->GetConditionVariable();
|
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 ) {
|
if (is_cargo) {
|
||||||
this->GetWidget<NWidgetCore>(WID_O_COND_CARGO)->widget_data = cargo_names_list[order == NULL ? 0 : order->GetConditionValue()];
|
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);
|
this->GetWidget<NWidgetStacked>(WID_O_SEL_COND_VALUE)->SetDisplayedPlane(DP_COND_VALUE_CARGO);
|
||||||
} else {
|
} else {
|
||||||
this->GetWidget<NWidgetStacked>(WID_O_SEL_COND_VALUE)->SetDisplayedPlane(DP_COND_VALUE_NUMBER);
|
this->GetWidget<NWidgetStacked>(WID_O_SEL_COND_VALUE)->SetDisplayedPlane(DP_COND_VALUE_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the strings for the dropdown boxes. */
|
/* Set the strings for the dropdown boxes. */
|
||||||
this->GetWidget<NWidgetCore>(WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + (order == NULL ? 0 : ocv);
|
this->GetWidget<NWidgetCore>(WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + (order == NULL ? 0 : ocv);
|
||||||
@@ -1413,10 +1420,8 @@ public:
|
|||||||
case WID_O_COND_COMPARATOR: {
|
case WID_O_COND_COMPARATOR: {
|
||||||
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
||||||
OrderConditionVariable cond_var = o->GetConditionVariable();
|
OrderConditionVariable cond_var = o->GetConditionVariable();
|
||||||
ShowDropDownMenu(this, GetComparatorStrings( o ), o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0,
|
ShowDropDownMenu(this, GetComparatorStrings(o), o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0,
|
||||||
(cond_var == OCV_REQUIRES_SERVICE ||
|
(cond_var == OCV_REQUIRES_SERVICE || cond_var == OCV_CARGO_ACCEPTANCE || cond_var == OCV_CARGO_WAITING) ? 0x3F : 0xC0);
|
||||||
cond_var == OCV_CARGO_ACCEPTANCE ||
|
|
||||||
cond_var == OCV_CARGO_WAITING) ? 0x3F : 0xC0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1698,7 +1703,7 @@ static const NWidgetPart _nested_orders_train_widgets[] = {
|
|||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_COND_VALUE), SetMinimalSize(124, 12), SetFill(1, 0),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_COND_VALUE), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||||
SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0),
|
SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0),
|
||||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_CARGO), SetMinimalSize(124, 12), SetFill(1, 0),
|
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_CARGO), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||||
SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_CARGO_TOOLTIP), SetResize(1, 0),
|
SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_CARGO_TOOLTIP), SetResize(1, 0),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
Reference in New Issue
Block a user