修改JudgeOnStation函数

This commit is contained in:
nvhaizi1 2022-05-24 18:24:39 +08:00
parent 1e1aaeece4
commit f6ceaa1c7e

View File

@ -22,11 +22,19 @@ int GetBusPosition()
} }
int JudgeOnStation() int JudgeOnStation()
{ {
if(abs(the_bus->distance) == rails->last_node_distance) if(abs(the_bus->distance) == rails->last_node_distance)//表示逆时针
{ {
the_bus->distance=0;
the_bus->rail_node_pos=rails->last_node;//逆时针往上一个
return BUS_TRUE; return BUS_TRUE;
} }
else else if(abs(the_bus->distance) == rails->next_node_distance)//表示顺时针
{
the_bus->distance=0;
the_bus->rail_node_pos=rails->next_node;//顺时针往下一个
return BUS_TRUE;
}
else
{ {
return BUS_FAlSE; return BUS_FAlSE;
} }