Codechange: do not keep local variable for temporary string parameters

This commit is contained in:
Rubidium
2023-06-27 17:24:43 +02:00
committed by rubidium42
parent e04d43f396
commit af9b9327af
5 changed files with 8 additions and 18 deletions

View File

@@ -208,12 +208,11 @@ public:
/* Location */
std::stringstream tile_ss;
tile_ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << tile; // 0x%.4X
std::string tile_str = tile_ss.str(); // Can't pass it directly to SetDParamStr as the string is only a temporary and would be destructed before the GetString call.
SetDParam(0, TileX(tile));
SetDParam(1, TileY(tile));
SetDParam(2, GetTileZ(tile));
SetDParamStr(3, tile_str);
SetDParamStr(3, tile_ss.str());
this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LANDINFO_COORDS));
/* Local authority */