File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -474,13 +474,17 @@ let handle_cycle v =
474
474
let main_player = Player. get_player v.players C. player in
475
475
let ui_msgs = Train_update. _update_all_trains v ~player: 0 in
476
476
(* TODO: ai_routines *)
477
- let try_create_priority () =
478
- match main_player.priority with
477
+ let try_create_priority = match main_player.priority with
479
478
| None when v.cycle mod C.Cycles. priority_delivery = 0 ->
480
- let priority = Priority_shipment. try_to_create v.random v.stations v.cycle in
481
- Player. update v.players C. player @@ Player. set_priority priority
482
- | _ -> ()
483
- in try_create_priority () ;
479
+ begin match Priority_shipment. try_to_create v.random v.stations v.cycle with
480
+ | Some pri as some_prio ->
481
+ Player. update v.players C. player @@ Player. set_priority some_prio;
482
+ [PriorityShipmentCreated {player= C. player; shipment= pri}]
483
+ | None -> []
484
+ end
485
+ | _ -> []
486
+ in
487
+ let ui_msgs = try_create_priority @ ui_msgs in
484
488
let update_station_supply_demand () =
485
489
if v.cycle mod C.Cycles. station_supply_demand = 0 then (
486
490
let difficulty = v.options.difficulty in
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ open! Containers
3
3
type t =
4
4
| Add500Cash
5
5
| CreatePriorityShipment
6
+ | CancelPriorityShipment
6
7
[@@ deriving show , yojson ]
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ let make_menu fonts =
14
14
[
15
15
make_entry " Money" @@ `MsgBox money_menu;
16
16
make_entry " Priority Shipment" @@ `Action (`Cheat (CreatePriorityShipment ));
17
+ make_entry " Cancel Priority" @@ `Action (`Cheat (CancelPriorityShipment ));
17
18
]
18
19
You can’t perform that action at this time.
0 commit comments