@@ -109,25 +109,25 @@ RoadStop* GetPrimaryRoadStop(const Stati
RoadStop* GetRoadStopByTile(TileIndex tile, RoadStopType type)
{
const Station* st = GetStation(_m[tile].m2);
RoadStop* rs;
for (rs = GetPrimaryRoadStop(st, type); rs->xy != tile; rs = rs->next) {
assert(rs->next != NULL);
}
return rs;
static uint GetNumRoadStops(const Station* st, RoadStopType type)
uint GetNumRoadStops(const Station* st, RoadStopType type)
uint num = 0;
const RoadStop *rs;
assert(st != NULL);
for (rs = GetPrimaryRoadStop(st, type); rs != NULL; rs = rs->next) num++;
return num;
RoadStop *AllocateRoadStop(void)
@@ -1422,25 +1422,25 @@ static int32 RemoveRoadStop(Station *st,
assert(cur_stop != NULL);
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
if (flags & DC_EXEC) {
uint i;
DoClearSquare(tile);
/* Clear all vehicles destined for this station */
for (i = 0; i != NUM_SLOTS; i++) {
if (cur_stop->slot[i] != INVALID_VEHICLE) {
Vehicle *v = GetVehicle(cur_stop->slot[i]);
ClearSlot(v, v->u.road.slot);
ClearSlot(v);
cur_stop->used = false;
if (cur_stop->prev != NULL) cur_stop->prev->next = cur_stop->next;
if (cur_stop->next != NULL) cur_stop->next->prev = cur_stop->prev;
//we only had one stop left
if (cur_stop->next == NULL && cur_stop->prev == NULL) {
//so we remove ALL stops
*primary_stop = NULL;
st->facilities &= (is_truck) ? ~FACIL_TRUCK_STOP : ~FACIL_BUS_STOP;