Changeset - r21599:c1d5ead939be
[Not reviewed]
master
0 4 0
alberth - 10 years ago 2014-08-13 19:31:45
alberth@openttd.org
(svn r26729) -Feature: Warn about missing industries after generating a map.
4 files changed with 27 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -40,6 +40,7 @@
 
#include "core/backup_type.hpp"
 
#include "object_base.h"
 
#include "game/game.hpp"
 
#include "error.h"
 

	
 
#include "table/strings.h"
 
#include "table/industry_land.h"
 
@@ -2741,6 +2742,26 @@ void InitializeIndustries()
 
	_industry_builder.Reset();
 
}
 

	
 
/** Verify whether the generated industries are complete, and warn the user if not. */
 
void CheckIndustries()
 
{
 
	int count = 0;
 
	for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
 
		if (Industry::GetIndustryTypeCount(it) > 0) continue; // Types of existing industries can be skipped.
 

	
 
		bool force_at_least_one;
 
		uint32 chance = GetScaledIndustryGenerationProbability(it, &force_at_least_one);
 
		if (chance == 0 || !force_at_least_one) continue; // Types that are not available can be skipped.
 

	
 
		const IndustrySpec *is = GetIndustrySpec(it);
 
		SetDParam(0, is->name);
 
		ShowErrorMessage(STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES, STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION, WL_WARNING);
 

	
 
		count++;
 
		if (count >= 3) break; // Don't swamp the user with errors.
 
	}
 
}
 

	
 
/**
 
 * Is an industry with the spec a raw industry?
 
 * @return true if it should be handled as a raw industry
src/industry_type.h
Show inline comments
 
@@ -37,4 +37,6 @@ static const IndustryGfx  INVALID_INDUST
 

	
 
static const int INDUSTRY_COMPLETED = 3; ///< final stage of industry construction.
 

	
 
void CheckIndustries();
 

	
 
#endif /* INDUSTRY_TYPE_H */
src/lang/english.txt
Show inline comments
 
@@ -4143,6 +4143,9 @@ STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED    
 
STR_ERROR_CAN_ONLY_BE_BUILT_ABOVE_SNOW_LINE                     :{WHITE}... can only be built above the snow-line
 
STR_ERROR_CAN_ONLY_BE_BUILT_BELOW_SNOW_LINE                     :{WHITE}... can only be built below the snow-line
 

	
 
STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES                     :{WHITE}There were no suitable places for '{STRING}' industries
 
STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION         :{WHITE}Change the map generation parameters to get a better map
 

	
 
# Station construction related errors
 
STR_ERROR_CAN_T_BUILD_RAILROAD_STATION                          :{WHITE}Can't build railway station here...
 
STR_ERROR_CAN_T_BUILD_BUS_STATION                               :{WHITE}Can't build bus station...
src/openttd.cpp
Show inline comments
 
@@ -958,6 +958,7 @@ static void MakeNewGameDone()
 
	if (_settings_client.gui.pause_on_newgame) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
 

	
 
	CheckEngines();
 
	CheckIndustries();
 
	MarkWholeScreenDirty();
 
}
 

	
0 comments (0 inline, 0 general)