1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

(svn r25560) [1.3] -Backport from trunk:

- Fix: [Squirrel] Infinite recursion loop in freeing data via a looping set of references [FS#5568] (r25558)
- Fix: One could build bridges over owned land of another company [FS#5524] (r25557)
- Fix: [Script] Texts from scripts were not validated before they were shown, causing an assertion to trigger [FS#5632] (r25555)
- Fix: Provide a warning when no vehicles are available, and tell what to do in that case [FS#5530] (r25553)
This commit is contained in:
rubidium
2013-07-04 21:20:05 +00:00
parent 526fb6fa21
commit b0486a940d
11 changed files with 58 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
#include "company_base.h"
#include "vehicle_func.h"
#include "articulated_vehicles.h"
#include "error.h"
#include "table/strings.h"
#include "table/engines.h"
@@ -1098,3 +1099,25 @@ bool IsEngineRefittable(EngineID engine)
CargoID default_cargo = e->GetDefaultCargoType();
return default_cargo != CT_INVALID && ei->refit_mask != 1U << default_cargo;
}
/**
* Check for engines that have an appropriate availability.
*/
void CheckEngines()
{
const Engine *e;
Date min_date = INT32_MAX;
FOR_ALL_ENGINES(e) {
if (!e->IsEnabled()) continue;
/* We have an available engine... yay! */
if (e->flags & ENGINE_AVAILABLE && e->company_avail != 0) return;
/* Okay, try to find the earliest date. */
min_date = min(min_date, e->info.base_intro);
}
SetDParam(0, min_date);
ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE, STR_ERROR_NO_VEHICLES_AVAILABLE_EXPLANATION, WL_WARNING);
}