1138 } |
1138 } |
1139 } |
1139 } |
1140 return _price.remove_rail_station; |
1140 return _price.remove_rail_station; |
1141 } |
1141 } |
1142 |
1142 |
1143 // determine the number of platforms for the station |
|
1144 uint GetStationPlatforms(const Station *st, TileIndex tile) |
|
1145 { |
|
1146 TileIndex t; |
|
1147 TileIndexDiff delta; |
|
1148 Axis axis; |
|
1149 uint len; |
|
1150 assert(st->TileBelongsToRailStation(tile)); |
|
1151 |
|
1152 len = 0; |
|
1153 axis = GetRailStationAxis(tile); |
|
1154 delta = (axis == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); |
|
1155 |
|
1156 // find starting tile.. |
|
1157 t = tile; |
|
1158 do { |
|
1159 t -= delta; |
|
1160 len++; |
|
1161 } while (st->TileBelongsToRailStation(t) && GetRailStationAxis(t) == axis); |
|
1162 |
|
1163 // find ending tile |
|
1164 t = tile; |
|
1165 do { |
|
1166 t += delta; |
|
1167 len++; |
|
1168 } while (st->TileBelongsToRailStation(t) && GetRailStationAxis(t) == axis); |
|
1169 |
|
1170 return len - 1; |
|
1171 } |
|
1172 |
|
1173 /** Determines the REMAINING length of a platform, starting at (and including) |
|
1174 * the given tile. |
|
1175 * @param tile the tile from which to start searching. Must be a railway station tile |
|
1176 * @param dir The direction in which to search. |
|
1177 * @return The platform length |
|
1178 */ |
|
1179 uint GetPlatformLength(TileIndex tile, DiagDirection dir) |
|
1180 { |
|
1181 TileIndex start_tile = tile; |
|
1182 uint length = 0; |
|
1183 assert(IsRailwayStationTile(tile)); |
|
1184 assert(dir < DIAGDIR_END); |
|
1185 |
|
1186 do { |
|
1187 length ++; |
|
1188 tile += TileOffsByDiagDir(dir); |
|
1189 } while (IsCompatibleTrainStationTile(tile, start_tile)); |
|
1190 |
|
1191 return length; |
|
1192 } |
|
1193 |
|
1194 |
1143 |
1195 static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) |
1144 static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) |
1196 { |
1145 { |
1197 int w,h; |
1146 int w,h; |
1198 int32 cost = 0; |
1147 int32 cost = 0; |