mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Remove unnecessary IO stream includes/uses
This commit is contained in:
parent
406afedfd3
commit
515f33b84d
@ -9,11 +9,9 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../rail_map.h"
|
||||
#include "../string_func.h"
|
||||
#include "dbg_helpers.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
/** Trackdir & TrackdirBits short names. */
|
||||
@ -62,10 +60,7 @@ std::string ValueStr(SignalType t)
|
||||
/** Translate TileIndex into string. */
|
||||
std::string TileStr(TileIndex tile)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << tile; // 0x%04X
|
||||
ss << " (" << TileX(tile) << ", " << TileY(tile) << ")";
|
||||
return ss.str();
|
||||
return stdstr_fmt("0x%04X (%u, %u)", tile, TileX(tile), TileY(tile));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,9 +36,6 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/** Method to open the OSK. */
|
||||
@ -341,29 +338,28 @@ public:
|
||||
}
|
||||
|
||||
/* Cargo acceptance is displayed in a extra multiline */
|
||||
std::stringstream line;
|
||||
line << GetString(STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED);
|
||||
std::string line = GetString(STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED);
|
||||
|
||||
bool found = false;
|
||||
for (const CargoSpec *cs : _sorted_cargo_specs) {
|
||||
CargoID cid = cs->Index();
|
||||
if (acceptance[cid] > 0) {
|
||||
/* Add a comma between each item. */
|
||||
if (found) line << ", ";
|
||||
if (found) line += ", ";
|
||||
found = true;
|
||||
|
||||
/* If the accepted value is less than 8, show it in 1/8:ths */
|
||||
if (acceptance[cid] < 8) {
|
||||
SetDParam(0, acceptance[cid]);
|
||||
SetDParam(1, cs->name);
|
||||
line << GetString(STR_LAND_AREA_INFORMATION_CARGO_EIGHTS);
|
||||
line += GetString(STR_LAND_AREA_INFORMATION_CARGO_EIGHTS);
|
||||
} else {
|
||||
line << GetString(cs->name);
|
||||
line += GetString(cs->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
this->cargo_acceptance = line.str();
|
||||
this->cargo_acceptance = std::move(line);
|
||||
} else {
|
||||
this->cargo_acceptance.clear();
|
||||
}
|
||||
|
@ -47,8 +47,6 @@
|
||||
# include "../3rdparty/nlohmann/json.hpp"
|
||||
# include <charconv>
|
||||
#endif
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <tuple>
|
||||
|
||||
#ifdef DEBUG_DUMP_COMMANDS
|
||||
@ -261,20 +259,19 @@ std::string GenerateCompanyPasswordHash(const std::string &password, const std::
|
||||
size_t password_length = password.size();
|
||||
size_t password_server_id_length = password_server_id.size();
|
||||
|
||||
std::ostringstream salted_password;
|
||||
std::string salted_password_string;
|
||||
/* Add the password with the server's ID and game seed as the salt. */
|
||||
for (uint i = 0; i < NETWORK_SERVER_ID_LENGTH - 1; i++) {
|
||||
char password_char = (i < password_length ? password[i] : 0);
|
||||
char server_id_char = (i < password_server_id_length ? password_server_id[i] : 0);
|
||||
char seed_char = password_game_seed >> (i % 32);
|
||||
salted_password << (char)(password_char ^ server_id_char ^ seed_char); // Cast needed, otherwise interpreted as integer to format
|
||||
salted_password_string += (char)(password_char ^ server_id_char ^ seed_char); // Cast needed, otherwise interpreted as integer to format
|
||||
}
|
||||
|
||||
Md5 checksum;
|
||||
MD5Hash digest;
|
||||
|
||||
/* Generate the MD5 hash */
|
||||
std::string salted_password_string = salted_password.str();
|
||||
checksum.Append(salted_password_string.data(), salted_password_string.size());
|
||||
checksum.Finish(digest);
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "../string_func.h"
|
||||
#include "../strings_func.h"
|
||||
#include "saveload_internal.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@ -66,8 +65,8 @@ std::string CopyFromOldName(StringID id)
|
||||
uint offs = _savegame_type == SGT_TTO ? LEN_OLD_STRINGS_TTO * GB(id, 0, 8) : LEN_OLD_STRINGS * GB(id, 0, 9);
|
||||
const char *strfrom = &_old_name_array[offs];
|
||||
|
||||
std::ostringstream tmp;
|
||||
std::ostreambuf_iterator<char> strto(tmp);
|
||||
std::string tmp;
|
||||
auto strto = std::back_inserter(tmp);
|
||||
for (; *strfrom != '\0'; strfrom++) {
|
||||
char32_t c = (uint8_t)*strfrom;
|
||||
|
||||
@ -87,7 +86,7 @@ std::string CopyFromOldName(StringID id)
|
||||
Utf8Encode(strto, c);
|
||||
}
|
||||
|
||||
return tmp.str();
|
||||
return tmp;
|
||||
} else {
|
||||
/* Name will already be in UTF-8. */
|
||||
return std::string(&_old_name_array[LEN_OLD_STRINGS * GB(id, 0, 9)]);
|
||||
|
@ -349,11 +349,11 @@ std::string StrMakeValid(std::string_view str, StringValidationSettings settings
|
||||
auto buf = str.data();
|
||||
auto last = buf + str.size() - 1;
|
||||
|
||||
std::ostringstream dst;
|
||||
std::ostreambuf_iterator<char> dst_iter(dst);
|
||||
std::string dst;
|
||||
auto dst_iter = std::back_inserter(dst);
|
||||
StrMakeValid(dst_iter, buf, last, settings);
|
||||
|
||||
return dst.str();
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,9 +34,6 @@
|
||||
#include "tbtr_template_vehicle.h"
|
||||
#include "tbtr_template_vehicle_func.h"
|
||||
#include "scope.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cctype>
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user