Skip to content

Commit b6b6076

Browse files
committed
Fix some priority types
1 parent 8c686ec commit b6b6076

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/rails_lib/backend/backend_low.ml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,17 @@ let handle_cycle v =
474474
let main_player = Player.get_player v.players C.player in
475475
let ui_msgs = Train_update._update_all_trains v ~player:0 in
476476
(* TODO: ai_routines *)
477-
let try_create_priority () =
478-
match main_player.priority with
477+
let try_create_priority = match main_player.priority with
479478
| 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
484488
let update_station_supply_demand () =
485489
if v.cycle mod C.Cycles.station_supply_demand = 0 then (
486490
let difficulty = v.options.difficulty in

src/rails_lib/backend/cheat_d.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ open! Containers
33
type t =
44
| Add500Cash
55
| CreatePriorityShipment
6+
| CancelPriorityShipment
67
[@@deriving show, yojson]

src/rails_lib/ui/cheats.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ let make_menu fonts =
1414
[
1515
make_entry "Money" @@ `MsgBox money_menu;
1616
make_entry "Priority Shipment" @@ `Action(`Cheat(CreatePriorityShipment));
17+
make_entry "Cancel Priority" @@ `Action(`Cheat(CancelPriorityShipment));
1718
]
1819

0 commit comments

Comments
 (0)