forked from mirror/OpenTTD
Codechange: add non-nullptr asserts in cases where it should never be nullptr
Though where similar calls are checked for nullptr as in those instances of the use of that function it can actually return nullptr. In other words, write down the assumption that the function never returns nullptr in an assert.
This commit is contained in:
@@ -1223,6 +1223,7 @@ public:
|
||||
this->OrderClick_Nonstop(-1);
|
||||
} else {
|
||||
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
assert(o != nullptr);
|
||||
ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), WID_O_NON_STOP, 0,
|
||||
o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
|
||||
}
|
||||
@@ -1299,12 +1300,14 @@ public:
|
||||
|
||||
case WID_O_COND_COMPARATOR: {
|
||||
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
assert(o != nullptr);
|
||||
ShowDropDownMenu(this, _order_conditional_condition, o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0, (o->GetConditionVariable() == OCV_REQUIRES_SERVICE) ? 0x3F : 0xC0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_O_COND_VALUE: {
|
||||
const Order *order = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
assert(order != nullptr);
|
||||
uint value = order->GetConditionValue();
|
||||
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
|
||||
SetDParam(0, value);
|
||||
|
Reference in New Issue
Block a user