Changeset - r14764:618888fa16c5
[Not reviewed]
master
0 1 0
alberth - 15 years ago 2010-03-07 12:20:17
alberth@openttd.org
(svn r19362) -Fix [FS#3667] (r19270): Failure to prospect an industry should not cause a crash.
1 file changed with 10 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -1824,19 +1824,17 @@ CommandCost CmdBuildIndustry(TileIndex t
 
		if (ret.Failed()) return ret;
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		assert(ind != NULL);
 
		if (_game_mode != GM_EDITOR) {
 
			SetDParam(0, indspec->name);
 
			if (indspec->new_industry_text > STR_LAST_STRINGID) {
 
				SetDParam(1, STR_TOWN_NAME);
 
				SetDParam(2, ind->town->index);
 
			} else {
 
				SetDParam(1, ind->town->index);
 
			}
 
			AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
 
			AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
 
	if ((flags & DC_EXEC) && ind != NULL && _game_mode != GM_EDITOR) {
 
		/* Created a new industry in-game, advertise the event. */
 
		SetDParam(0, indspec->name);
 
		if (indspec->new_industry_text > STR_LAST_STRINGID) {
 
			SetDParam(1, STR_TOWN_NAME);
 
			SetDParam(2, ind->town->index);
 
		} else {
 
			SetDParam(1, ind->town->index);
 
		}
 
		AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
 
		AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
 
	}
 

	
 
	return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
0 comments (0 inline, 0 general)