This commit is contained in:
gsemaj 2022-07-17 21:10:56 -07:00
parent 34669eb7b9
commit 15b6cd2fb4
3 changed files with 2 additions and 12 deletions

View File

@ -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++;
}
}

View File

@ -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,

View File

@ -66,16 +66,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;
}