From 4d956ceb41c65c535015c50999a8e49990e36495 Mon Sep 17 00:00:00 2001 From: jackfiled Date: Fri, 3 Jun 2022 14:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=BA=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E5=8F=82=E6=95=B0=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E7=9C=81=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bus_io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bus_io.c b/src/bus_io.c index 2c98076..0375dc8 100644 --- a/src/bus_io.c +++ b/src/bus_io.c @@ -137,14 +137,22 @@ rail_node_t *ReadConfigFile() } - if (distance != 0 && total_station != 0) + // 处理参数去缺省值的情况 + if (distance == 0) { - return CreateRails(distance, total_station); + distance = 2; } - else + if (total_station == 0) { - return NULL; + total_station = 5; } + if(chosen_strategy == -1) + { + chosen_strategy = BUS_FCFS; + } + + rail_node_t *head = CreateRails(distance, total_station); + return head; } void PrintState()