mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +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:
+5
-5
@@ -392,7 +392,7 @@ bool ZoneDatabase::LoadTributes() {
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
uint32 id = atoul(row[0]);
|
||||
uint32 id = Strings::ToUnsignedInt(row[0]);
|
||||
tributeData.name = row[1];
|
||||
tributeData.description = row[2];
|
||||
tributeData.unknown = strtoul(row[3], nullptr, 10);
|
||||
@@ -410,7 +410,7 @@ bool ZoneDatabase::LoadTributes() {
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
uint32 id = atoul(row[0]);
|
||||
uint32 id = Strings::ToUnsignedInt(row[0]);
|
||||
|
||||
if (tribute_list.count(id) != 1) {
|
||||
LogError("Error in LoadTributes: unknown tribute [{}] in tribute_levels", (unsigned long) id);
|
||||
@@ -426,9 +426,9 @@ bool ZoneDatabase::LoadTributes() {
|
||||
|
||||
TributeLevel_Struct &s = cur.tiers[cur.tier_count];
|
||||
|
||||
s.level = atoul(row[1]);
|
||||
s.cost = atoul(row[2]);
|
||||
s.tribute_item_id = atoul(row[3]);
|
||||
s.level = Strings::ToUnsignedInt(row[1]);
|
||||
s.cost = Strings::ToUnsignedInt(row[2]);
|
||||
s.tribute_item_id = Strings::ToUnsignedInt(row[3]);
|
||||
cur.tier_count++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user