Fix various whitespace and style issues.

This commit is contained in:
Jonathan G Rennison
2015-08-26 22:49:08 +01:00
parent 218758fc86
commit ea5c33029b
2 changed files with 51 additions and 49 deletions

View File

@@ -124,7 +124,6 @@ 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) {
@@ -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;
} }

View File

@@ -361,7 +361,8 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
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) {
@@ -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();
} }
@@ -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;
} }
} }
@@ -1146,10 +1153,10 @@ 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);
@@ -1414,9 +1421,7 @@ public:
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;
} }