修复了到站判断错误,下一站错误指定的问题
This commit is contained in:
parent
6d6ed8e48b
commit
2d9ca19cd5
12
src/bus.c
12
src/bus.c
|
@ -33,16 +33,20 @@ int GetBusPosition()
|
||||||
|
|
||||||
int JudgeOnStation()
|
int JudgeOnStation()
|
||||||
{
|
{
|
||||||
if (abs(the_bus->distance) == rails->last_node_distance)//表示逆时针
|
if (the_bus->distance == - the_bus->rail_node_pos->last_node_distance)//表示逆时针
|
||||||
{
|
{
|
||||||
the_bus->distance = 0;
|
the_bus->distance = 0;
|
||||||
the_bus->rail_node_pos = rails->last_node;//逆时针往上一个
|
the_bus->rail_node_pos = the_bus->rail_node_pos->last_node;//逆时针往上一个
|
||||||
return BUS_TRUE;
|
return BUS_TRUE;
|
||||||
}
|
}
|
||||||
else if (abs(the_bus->distance) == rails->next_node_distance)//表示顺时针
|
else if (the_bus->distance == the_bus->rail_node_pos->next_node_distance)//表示顺时针
|
||||||
{
|
{
|
||||||
the_bus->distance = 0;
|
the_bus->distance = 0;
|
||||||
the_bus->rail_node_pos = rails->next_node;//顺时针往下一个
|
the_bus->rail_node_pos = the_bus->rail_node_pos->next_node;//顺时针往下一个
|
||||||
|
return BUS_TRUE;
|
||||||
|
}
|
||||||
|
else if(the_bus->distance == 0) //在站点上原地不动
|
||||||
|
{
|
||||||
return BUS_TRUE;
|
return BUS_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user