mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +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:
@@ -79,7 +79,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string character_name = sep->arg[3];
|
||||
uint16 instance_id = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||
uint16 instance_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
uint32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
if (instance_id <= 0 || character_id <= 0) {
|
||||
c->Message(Chat::White, "You must enter a valid Instance ID and player name.");
|
||||
@@ -146,11 +146,11 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
uint32 version = std::stoul(sep->arg[3]);
|
||||
uint32 duration = std::stoul(sep->arg[4]);
|
||||
uint32 version = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
uint32 duration = Strings::ToUnsignedInt(sep->arg[4]);
|
||||
std::string zone_short_name = ZoneName(zone_id);
|
||||
if (zone_short_name.empty()) {
|
||||
c->Message(
|
||||
@@ -210,7 +210,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint16 instance_id = std::stoul(sep->arg[2]);
|
||||
uint16 instance_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (!database.CheckInstanceExists(instance_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -269,7 +269,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string character_name = sep->arg[3];
|
||||
uint16 instance_id = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||
uint16 instance_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
uint32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
if (instance_id <= 0 || character_id <= 0) {
|
||||
c->Message(Chat::White, "You must enter a valid Instance ID and player name.");
|
||||
|
||||
Reference in New Issue
Block a user