修改了Get Bus Position函数
This commit is contained in:
parent
f6ceaa1c7e
commit
fc5cb2f664
15
src/bus.c
15
src/bus.c
|
@ -15,10 +15,17 @@ void RunBus(int direction)
|
||||||
}
|
}
|
||||||
int GetBusPosition()
|
int GetBusPosition()
|
||||||
{
|
{
|
||||||
int a,b;
|
int a,b,c;
|
||||||
a=the_bus->rail_node_pos->id;//指向站点的指针以及这个指针对应的站台id;
|
b=0;
|
||||||
b=a*(rails->last_node_distance)+abs(the_bus->distance);
|
rail_node_t *p = rails;
|
||||||
return b;
|
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;
|
||||||
}
|
}
|
||||||
int JudgeOnStation()
|
int JudgeOnStation()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user