From edc5b8ea1fe07c9df1c4eac004a258020ebfa4f9 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 20 Jul 2025 14:03:29 +0100 Subject: [PATCH] Fix #14464: Invalid string parameter in scenario editor when unable to build industry. (#14465) Resolved by removing the Build Industry command callback. This was used to display an error message in the scenario editor, however an error is already automatically displayed. --- src/industry_cmd.h | 2 -- src/industry_gui.cpp | 21 +-------------------- src/network/network_command.cpp | 1 - 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/industry_cmd.h b/src/industry_cmd.h index e848260181..f1d8b5f4dc 100644 --- a/src/industry_cmd.h +++ b/src/industry_cmd.h @@ -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_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 */ diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 6119c486dd..75313cb39b 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -257,25 +257,6 @@ void SortIndustryTypes() 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[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), @@ -745,7 +726,7 @@ public: AutoRestoreBackup backup_generating_world(_generating_world, true); AutoRestoreBackup backup_ignore_industry_restritions(_ignore_industry_restrictions, true); - Command::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, &CcBuildIndustry, tile, this->selected_type, layout_index, false, seed); + Command::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, tile, this->selected_type, layout_index, false, seed); } else { success = Command::Post(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY, tile, this->selected_type, layout_index, false, seed); } diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp index c3495b788b..d88c4e8754 100644 --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -79,7 +79,6 @@ static constexpr auto _callback_tuple = std::make_tuple( &CcCreateGroup, &CcFoundRandomTown, &CcRoadStop, - &CcBuildIndustry, &CcStartStopVehicle, &CcGame, &CcAddVehicleNewGroup