mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 22:01:30 +00:00
* [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>
64 lines
1.2 KiB
C++
Executable File
64 lines
1.2 KiB
C++
Executable File
#include "../client.h"
|
|
|
|
void command_zheader(Client *c, const Seperator *sep)
|
|
{
|
|
int arguments = sep->argnum;
|
|
if (!arguments) {
|
|
c->Message(Chat::White, "Usage: #zheader [Zone ID|Zone Short Name] [Version]");
|
|
return;
|
|
}
|
|
|
|
auto zone_id = (
|
|
sep->IsNumber(2) ?
|
|
Strings::ToUnsignedInt(sep->arg[2]) :
|
|
ZoneID(sep->arg[2])
|
|
);
|
|
if (!zone_id) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Zone ID {} could not be found.",
|
|
zone_id
|
|
).c_str()
|
|
);
|
|
return;
|
|
}
|
|
|
|
auto zone_short_name = ZoneName(zone_id);
|
|
auto zone_long_name = ZoneLongName(zone_id);
|
|
auto version = (
|
|
sep->IsNumber(3) ?
|
|
Strings::ToUnsignedInt(sep->arg[3]) :
|
|
0
|
|
);
|
|
|
|
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
|
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
|
entity_list.QueueClients(c, outapp);
|
|
safe_delete(outapp);
|
|
|
|
zone_store.LoadZones(content_db);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Zone Header Load {} | Zone: {} ({}){}",
|
|
(
|
|
zone->LoadZoneCFG(zone_short_name, version) ?
|
|
"Succeeded" :
|
|
"Failed"
|
|
),
|
|
zone_long_name,
|
|
zone_short_name,
|
|
(
|
|
version ?
|
|
fmt::format(
|
|
" Version: {}",
|
|
version
|
|
) :
|
|
""
|
|
)
|
|
).c_str()
|
|
);
|
|
}
|