mirror of https://github.com/OpenTTD/OpenTTD
(svn r19362) -Fix [FS#3667] (r19270): Failure to prospect an industry should not cause a crash.
parent
8d033e964e
commit
384e870be2
|
@ -1824,9 +1824,8 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if ((flags & DC_EXEC) && ind != NULL && _game_mode != GM_EDITOR) {
|
||||||
assert(ind != NULL);
|
/* Created a new industry in-game, advertise the event. */
|
||||||
if (_game_mode != GM_EDITOR) {
|
|
||||||
SetDParam(0, indspec->name);
|
SetDParam(0, indspec->name);
|
||||||
if (indspec->new_industry_text > STR_LAST_STRINGID) {
|
if (indspec->new_industry_text > STR_LAST_STRINGID) {
|
||||||
SetDParam(1, STR_TOWN_NAME);
|
SetDParam(1, STR_TOWN_NAME);
|
||||||
|
@ -1837,7 +1836,6 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
|
AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
|
||||||
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
|
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
|
return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue