mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 13:36:36 +00:00
[Strings] Add more number formatters (#2873)
* [Strings] Add more number formatters # Notes - Adds `Strings::ToUnsignedInt` for `uint32` support. - Adds `Strings::ToBigInt` for `int64` support. - Adds `Strings::ToUnsignedBigInt` for `uint64` support. - Adds `Strings::ToFloat` for `float` support. - Replaces all `std::stoi` references with `Strings::ToInt`. - Replaces all `atoi` references with `Strings::ToInt`. - Replaces all `std::stoul` references with `Strings::ToUnsignedInt`. - Replaces all `atoul` references with `Strings::ToUnsignedInt`. - Replaces all `std::stoll` references with `Strings::ToBigInt`. - Replaces all `atoll` references with `Strings::ToBigInt`. - Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `atoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `std::stof` references with `Strings::ToFloat`. * [Strings] Add more number formatters - Adds `Strings::ToUnsignedInt` for `uint32` support. - Adds `Strings::ToBigInt` for `int64` support. - Adds `Strings::ToUnsignedBigInt` for `uint64` support. - Adds `Strings::ToFloat` for `float` support. - Replaces all `std::stoi` references with `Strings::ToInt`. - Replaces all `atoi` references with `Strings::ToInt`. - Replaces all `std::stoul` references with `Strings::ToUnsignedInt`. - Replaces all `atoul` references with `Strings::ToUnsignedInt`. - Replaces all `std::stoll` references with `Strings::ToBigInt`. - Replaces all `atoll` references with `Strings::ToBigInt`. - Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `atoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `std::stof` references with `Strings::ToFloat`. * Rebase cleanup * Changes/benchmarks/tests --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
|
||||
std::string character_name = (
|
||||
sep->IsNumber(1) ?
|
||||
database.GetCharNameByID(std::stoul(sep->arg[1])) :
|
||||
database.GetCharNameByID(Strings::ToUnsignedInt(sep->arg[1])) :
|
||||
sep->arg[1]
|
||||
);
|
||||
auto character_id = database.GetCharacterID(character_name.c_str());
|
||||
@@ -29,7 +29,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
|
||||
std::string zone_short_name = Strings::ToLower(
|
||||
sep->IsNumber(2) ?
|
||||
ZoneName(std::stoul(sep->arg[2]), true) :
|
||||
ZoneName(Strings::ToUnsignedInt(sep->arg[2]), true) :
|
||||
sep->arg[2]
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Zone ID {} could not be found.",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user