diff options
Diffstat (limited to 'src/newgrf_industrytiles.cpp')
-rw-r--r-- | src/newgrf_industrytiles.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index efaa5c3f6..522296530 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -308,17 +308,18 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind } if (callback_res == 0x400) return CommandCost(); - /* Copy some parameters from the registers to the error message text ref. stack */ - SwitchToErrorRefStack(); - StartTextRefStackUsage(4); - SwitchToNormalRefStack(); - + CommandCost res; switch (callback_res) { - case 0x401: return_cmd_error(STR_ERROR_SITE_UNSUITABLE); - case 0x402: return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_RAINFOREST); - case 0x403: return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_DESERT); - default: return_cmd_error(GetGRFStringID(its->grf_prop.grffile->grfid, 0xD000 + callback_res)); + case 0x401: res = CommandCost(STR_ERROR_SITE_UNSUITABLE); + case 0x402: res = CommandCost(STR_ERROR_CAN_ONLY_BE_BUILT_IN_RAINFOREST); + case 0x403: res = CommandCost(STR_ERROR_CAN_ONLY_BE_BUILT_IN_DESERT); + default: res = CommandCost(GetGRFStringID(its->grf_prop.grffile->grfid, 0xD000 + callback_res)); } + + /* Copy some parameters from the registers to the error message text ref. stack */ + res.UseTextRefStack(4); + + return res; } /* Simple wrapper for GetHouseCallback to keep the animation unified. */ |