From 0685b45ce8d94efeca8c77bdbf823dd56654c944 Mon Sep 17 00:00:00 2001 From: nvhaizi1 Date: Tue, 24 May 2022 22:52:38 +0800 Subject: [PATCH] =?UTF-8?q?GetBusPosition=E5=87=BD=E6=95=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=A3=8E=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bus.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/bus.c b/src/bus.c index 19addc9..924d9ba 100644 --- a/src/bus.c +++ b/src/bus.c @@ -15,17 +15,16 @@ void RunBus(int direction) } int GetBusPosition() { - int a,b,c; - b=0; + int a, b, c; + b = 0; rail_node_t *p = rails; - a=the_bus->rail_node_pos->id;//指向站点的指针以及这个指针对应的站台id - while(p->id != a) - { - b+=p->next_node_distance; - p=p->next_node; + a = the_bus->rail_node_pos->id;//指向站点的指针以及这个指针对应的站台id + while (p->id != a){ + b += p->next_node_distance; + p = p->next_node; } - c=b+(the_bus->distance); - return c; + c = b + (the_bus->distance); + return c; } int JudgeOnStation() {