mirror of https://github.com/OpenTTD/OpenTTD
Merge 2759bda53a
into a8650c6b06
commit
7e33068dc8
|
@ -27,6 +27,4 @@ DEF_CMD_TRAIT(CMD_INDUSTRY_SET_EXCLUSIVITY, CmdIndustrySetExclusivity, CommandFl
|
||||||
DEF_CMD_TRAIT(CMD_INDUSTRY_SET_TEXT, CmdIndustrySetText, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CMDT_OTHER_MANAGEMENT)
|
DEF_CMD_TRAIT(CMD_INDUSTRY_SET_TEXT, CmdIndustrySetText, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CMDT_OTHER_MANAGEMENT)
|
||||||
DEF_CMD_TRAIT(CMD_INDUSTRY_SET_PRODUCTION, CmdIndustrySetProduction, CommandFlag::Deity, CMDT_OTHER_MANAGEMENT)
|
DEF_CMD_TRAIT(CMD_INDUSTRY_SET_PRODUCTION, CmdIndustrySetProduction, CommandFlag::Deity, CMDT_OTHER_MANAGEMENT)
|
||||||
|
|
||||||
void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t);
|
|
||||||
|
|
||||||
#endif /* INDUSTRY_CMD_H */
|
#endif /* INDUSTRY_CMD_H */
|
||||||
|
|
|
@ -257,25 +257,6 @@ void SortIndustryTypes()
|
||||||
std::sort(_sorted_industry_types.begin(), _sorted_industry_types.end(), IndustryTypeNameSorter);
|
std::sort(_sorted_industry_types.begin(), _sorted_industry_types.end(), IndustryTypeNameSorter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Command callback. In case of failure to build an industry, show an error message.
|
|
||||||
* @param result Result of the command.
|
|
||||||
* @param tile Tile where the industry is placed.
|
|
||||||
* @param indtype Industry type.
|
|
||||||
*/
|
|
||||||
void CcBuildIndustry(Commands, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t)
|
|
||||||
{
|
|
||||||
if (result.Succeeded()) return;
|
|
||||||
|
|
||||||
if (indtype < NUM_INDUSTRYTYPES) {
|
|
||||||
const IndustrySpec *indsp = GetIndustrySpec(indtype);
|
|
||||||
if (indsp->enabled) {
|
|
||||||
ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_BUILD_HERE, indsp->name),
|
|
||||||
GetEncodedString(result.GetErrorMessage()), WL_INFO, TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr NWidgetPart _nested_build_industry_widgets[] = {
|
static constexpr NWidgetPart _nested_build_industry_widgets[] = {
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
||||||
|
@ -745,7 +726,7 @@ public:
|
||||||
AutoRestoreBackup backup_generating_world(_generating_world, true);
|
AutoRestoreBackup backup_generating_world(_generating_world, true);
|
||||||
AutoRestoreBackup backup_ignore_industry_restritions(_ignore_industry_restrictions, true);
|
AutoRestoreBackup backup_ignore_industry_restritions(_ignore_industry_restrictions, true);
|
||||||
|
|
||||||
Command<CMD_BUILD_INDUSTRY>::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, &CcBuildIndustry, tile, this->selected_type, layout_index, false, seed);
|
Command<CMD_BUILD_INDUSTRY>::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, tile, this->selected_type, layout_index, false, seed);
|
||||||
} else {
|
} else {
|
||||||
success = Command<CMD_BUILD_INDUSTRY>::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, tile, this->selected_type, layout_index, false, seed);
|
success = Command<CMD_BUILD_INDUSTRY>::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, tile, this->selected_type, layout_index, false, seed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ static constexpr auto _callback_tuple = std::make_tuple(
|
||||||
&CcCreateGroup,
|
&CcCreateGroup,
|
||||||
&CcFoundRandomTown,
|
&CcFoundRandomTown,
|
||||||
&CcRoadStop,
|
&CcRoadStop,
|
||||||
&CcBuildIndustry,
|
|
||||||
&CcStartStopVehicle,
|
&CcStartStopVehicle,
|
||||||
&CcGame,
|
&CcGame,
|
||||||
&CcAddVehicleNewGroup
|
&CcAddVehicleNewGroup
|
||||||
|
|
Loading…
Reference in New Issue