mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 04:16:46 +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:
@@ -12,8 +12,8 @@ void command_removeitem(Client *c, const Seperator *sep)
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto item_id = std::stoi(sep->arg[1]);
|
||||
|
||||
auto item_id = Strings::ToInt(sep->arg[1]);
|
||||
if (!database.GetItem(item_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -24,9 +24,9 @@ void command_removeitem(Client *c, const Seperator *sep)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto item_link = database.CreateItemLink(item_id);
|
||||
auto amount = sep->IsNumber(2) ? std::stoul(sep->arg[2]) : 1;
|
||||
auto amount = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : 1;
|
||||
auto item_count = target->CountItem(item_id);
|
||||
if (item_count) {
|
||||
if (item_count >= amount) {
|
||||
|
||||
Reference in New Issue
Block a user