Changeset - r21575:52da6ae0d4f8
[Not reviewed]
master
0 1 0
rubidium - 10 years ago 2014-07-21 18:03:05
rubidium@openttd.org
(svn r26699) -Fix-ish: do not crash when trying to show an error about vehicle in a NewGRF and the NewGRF was not loaded at all
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -232,12 +232,15 @@ uint Vehicle::Crash(bool flooded)
 
 */
 
void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRFBugs bug_type, bool critical)
 
{
 
	const Engine *e = Engine::Get(engine);
 
	GRFConfig *grfconfig = GetGRFConfig(e->GetGRFID());
 

	
 
	/* Missing GRF. Nothing useful can be done in this situation. */
 
	if (grfconfig == NULL) return;
 

	
 
	if (!HasBit(grfconfig->grf_bugs, bug_type)) {
 
		SetBit(grfconfig->grf_bugs, bug_type);
 
		SetDParamStr(0, grfconfig->GetName());
 
		SetDParam(1, engine);
 
		ShowErrorMessage(part1, part2, WL_CRITICAL);
 
		if (!_networking) DoCommand(0, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, 1, DC_EXEC, CMD_PAUSE);
0 comments (0 inline, 0 general)