mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +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:
+4
-4
@@ -33,7 +33,7 @@ uint32 Client::GetBotCreationLimit(uint8 class_id)
|
||||
|
||||
auto bucket_value = GetBucket(bucket_name);
|
||||
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
|
||||
bot_creation_limit = std::stoul(bucket_value);
|
||||
bot_creation_limit = Strings::ToUnsignedInt(bucket_value);
|
||||
}
|
||||
|
||||
return bot_creation_limit;
|
||||
@@ -57,7 +57,7 @@ int Client::GetBotRequiredLevel(uint8 class_id)
|
||||
|
||||
auto bucket_value = GetBucket(bucket_name);
|
||||
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
|
||||
bot_character_level = std::stoi(bucket_value);
|
||||
bot_character_level = Strings::ToInt(bucket_value);
|
||||
}
|
||||
|
||||
return bot_character_level;
|
||||
@@ -81,7 +81,7 @@ int Client::GetBotSpawnLimit(uint8 class_id)
|
||||
|
||||
auto bucket_value = GetBucket(bucket_name);
|
||||
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
|
||||
bot_spawn_limit = std::stoi(bucket_value);
|
||||
bot_spawn_limit = Strings::ToInt(bucket_value);
|
||||
return bot_spawn_limit;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ int Client::GetBotSpawnLimit(uint8 class_id)
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
bot_spawn_limit = std::stoi(row[0]);
|
||||
bot_spawn_limit = Strings::ToInt(row[0]);
|
||||
}
|
||||
|
||||
return bot_spawn_limit;
|
||||
|
||||
Reference in New Issue
Block a user