mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 20:09:14 +01:00
Ask the cell itself whether its command is still pending, guard the order table
The spent command was tracked in a table flag, which is lost whenever the speed table is rebuilt - the cell would go back to being a stop point. The memcell already knows: StopCommandSent() drops the pending flag and keeps the text, so the event now answers is_command_spent() and the table point follows it. OrderNextGet() read one past the end of OrderList when the current order sat in the last slot; it now reports Wait_for_orders there, which is what OrderNext() wraps to anyway.
This commit is contained in:
@@ -696,9 +696,10 @@ private:
|
||||
};
|
||||
|
||||
inline TOrders TController::OrderCurrentGet() const {
|
||||
return OrderList[ OrderPos ];
|
||||
return OrderList[ std::clamp( OrderPos, 0, maxorders - 1 ) ];
|
||||
}
|
||||
|
||||
inline TOrders TController::OrderNextGet() const {
|
||||
return OrderList[ OrderPos + 1 ];
|
||||
// the last slot has no successor; OrderNext() wraps to zero there anyway
|
||||
return ( OrderPos + 1 < maxorders ? OrderList[ OrderPos + 1 ] : Wait_for_orders );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user