From 3d22103113e172931d36aa1c20ee67a58d6ca595 Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sun, 17 Jul 2022 21:10:56 -0700 Subject: [PATCH] oops --- src/Buffs.cpp | 2 +- src/Items.cpp | 2 +- src/PlayerManager.cpp | 10 ---------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Buffs.cpp b/src/Buffs.cpp index 430fab9..2369ddd 100644 --- a/src/Buffs.cpp +++ b/src/Buffs.cpp @@ -23,7 +23,7 @@ void Buff::onTick() { if(stack.durationTicks > 0) stack.durationTicks--; if(stack.durationTicks == 0) { it = stacks.erase(it); - stack.onExpire(self, &stack); + if(stack.onExpire != nullptr) stack.onExpire(self, &stack); } else it++; } } diff --git a/src/Items.cpp b/src/Items.cpp index 4eec2af..d2778f1 100644 --- a/src/Items.cpp +++ b/src/Items.cpp @@ -496,7 +496,7 @@ static void itemUseHandler(CNSocket* sock, CNPacketData* data) { eCSB, durationMilliseconds / MS_PER_PLAYER_TICK, sock, - BuffClass::CONSUMABLE, + BuffClass::CASH_ITEM, // or BuffClass::ITEM? Buffs::timeBuffUpdateAdd, nullptr, Buffs::timeBuffUpdateDelete, diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index 107d98a..5243183 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -71,16 +71,6 @@ void PlayerManager::removePlayer(CNSocket* key) { // if the player was in a lair, clean it up Chunking::destroyInstanceIfEmpty(fromInstance); - // remove player's buffs from the server - auto it = Eggs::EggBuffs.begin(); - while (it != Eggs::EggBuffs.end()) { - if (it->first.first == key) { - it = Eggs::EggBuffs.erase(it); - } - else - it++; - } - std::cout << players.size() << " players" << std::endl; }