Corrected string to long conversion

For Windows, the definition for a long is 32 bits, not 64 bits like on other operating systems.  This caused an issue on Windows only where a number larger than 32 bits was attempted to be converted to a long, the WorldServer would crash.  This commit replaces all instances of `stol` with `stoull` to further define a long and reduce ambiguity of number length.
This commit is contained in:
EmosewaMC
2022-06-05 20:58:51 -07:00
parent 66215da37a
commit 33cc3a3dd9
5 changed files with 5 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity *self, Entity *sender, st
if (splitArguments.size() > 1) {
const auto eventName = splitArguments[0];
const auto player = EntityManager::Instance()->GetEntity(std::stol(splitArguments[1]));
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
if (player != nullptr) {
if (eventName == "updatePlayer") {

View File

@@ -99,7 +99,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity *self, Entity *player) {
void NjMonastryBossInstance::OnActivityTimerDone(Entity *self, const std::string &name) {
auto split = GeneralUtils::SplitString(name, TimerSplitChar);
auto timerName = split[0];
auto objectID = split.size() > 1 ? (LWOOBJID) std::stol(split[1]) : LWOOBJID_EMPTY;
auto objectID = split.size() > 1 ? (LWOOBJID) std::stoull(split[1]) : LWOOBJID_EMPTY;
if (timerName == WaitingForPlayersTimer) {
StartFight(self);

View File

@@ -55,7 +55,7 @@ bool SpawnPetBaseServer::CheckNumberOfPets(Entity *self, Entity* user) {
if (petID.empty())
continue;
const auto* spawnedPet = EntityManager::Instance()->GetEntity(std::stol(petID));
const auto* spawnedPet = EntityManager::Instance()->GetEntity(std::stoull(petID));
if (spawnedPet == nullptr)
continue;