mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r20737) -Codechange: Introduce a function for advertising opening of a new industry.
This commit is contained in:
parent
fcf92a20e2
commit
21a80e0a0e
@ -1890,6 +1890,24 @@ static const byte _numof_industry_table[] = {
|
|||||||
80, // high
|
80, // high
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advertise about a new industry opening.
|
||||||
|
* @param ind Industry being opened.
|
||||||
|
*/
|
||||||
|
static void AdvertiseIndustryOpening(Industry *ind)
|
||||||
|
{
|
||||||
|
const IndustrySpec *ind_spc = GetIndustrySpec(ind->type);
|
||||||
|
SetDParam(0, ind_spc->name);
|
||||||
|
if (ind_spc->new_industry_text > STR_LAST_STRINGID) {
|
||||||
|
SetDParam(1, STR_TOWN_NAME);
|
||||||
|
SetDParam(2, ind->town->index);
|
||||||
|
} else {
|
||||||
|
SetDParam(1, ind->town->index);
|
||||||
|
}
|
||||||
|
AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
|
||||||
|
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to place the industry in the game.
|
* Try to place the industry in the game.
|
||||||
* Since there is no feedback why placement fails, there is no other option
|
* Since there is no feedback why placement fails, there is no other option
|
||||||
@ -2041,16 +2059,7 @@ static void MaybeNewIndustry()
|
|||||||
Industry *ind = PlaceIndustry(cumulative_probs[j].ind, false);
|
Industry *ind = PlaceIndustry(cumulative_probs[j].ind, false);
|
||||||
if (ind == NULL) return;
|
if (ind == NULL) return;
|
||||||
|
|
||||||
const IndustrySpec *ind_spc = GetIndustrySpec(cumulative_probs[j].ind);
|
AdvertiseIndustryOpening(ind);
|
||||||
SetDParam(0, ind_spc->name);
|
|
||||||
if (ind_spc->new_industry_text > STR_LAST_STRINGID) {
|
|
||||||
SetDParam(1, STR_TOWN_NAME);
|
|
||||||
SetDParam(2, ind->town->index);
|
|
||||||
} else {
|
|
||||||
SetDParam(1, ind->town->index);
|
|
||||||
}
|
|
||||||
AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
|
|
||||||
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user