* Set the size of the blocks in the window so we can be sure that they are big enough for the vehicle sprites in the current game. * @note Calling this function once for each game is enough. */
| 217 | * @note Calling this function once for each game is enough. |
| 218 | */ |
| 219 | void InitDepotWindowBlockSizes() |
| 220 | { |
| 221 | for (VehicleType vt = VEH_BEGIN; vt < VEH_COMPANY_END; vt++) { |
| 222 | InitBlocksizeForVehicles(vt, EIT_IN_DEPOT); |
| 223 | InitBlocksizeForVehicles(vt, EIT_PURCHASE); |
| 224 | } |
| 225 | |
| 226 | _consistent_train_width = TRAININFO_DEFAULT_VEHICLE_WIDTH; |
| 227 | bool first = true; |
| 228 | for (const Engine *e : Engine::IterateType(VEH_TRAIN)) { |
| 229 | if (!e->IsEnabled()) continue; |
| 230 | |
| 231 | uint w = TRAININFO_DEFAULT_VEHICLE_WIDTH; |
| 232 | if (e->GetGRF() != nullptr && IsCustomVehicleSpriteNum(e->VehInfo<RailVehicleInfo>().image_index)) { |
| 233 | w = e->GetGRF()->traininfo_vehicle_width; |
| 234 | if (w != VEHICLEINFO_FULL_VEHICLE_WIDTH) { |
| 235 | /* Hopeless. |
| 236 | * This is a NewGRF vehicle that uses TRAININFO_DEFAULT_VEHICLE_WIDTH. |
| 237 | * If the vehicles are shorter than 8/8 we have fractional lengths, which are not consistent after rounding. |
| 238 | */ |
| 239 | _consistent_train_width = 0; |
| 240 | break; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | if (first) { |
| 245 | _consistent_train_width = w; |
| 246 | first = false; |
| 247 | } else if (w != _consistent_train_width) { |
| 248 | _consistent_train_width = 0; |
| 249 | break; |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | static void DepotSellAllConfirmationCallback(Window *w, bool confirmed); |
| 255 | const Sprite *GetAircraftSprite(EngineID engine); |
no test coverage detected