Switched MobManager::step() to the timer.

It doesn't really need to run on every shard step. This makes it a lot
less hot.
This commit is contained in:
dongresource 2020-09-22 21:31:08 +02:00
parent ba5998d53a
commit 95a79ec815
3 changed files with 4 additions and 4 deletions

View File

@ -87,6 +87,4 @@ void CNShardServer::onStep() {
event.scheduledEvent = currTime + event.delta;
}
}
MobManager::step(currTime);
}

View File

@ -9,6 +9,8 @@
std::map<int32_t, Mob*> MobManager::Mobs;
void MobManager::init() {
REGISTER_SHARD_TIMER(step, 200);
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_ATTACK_NPCs, pcAttackNpcs);
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_COMBAT_BEGIN, combatBegin);
@ -207,7 +209,7 @@ void MobManager::roamingStep(Mob *mob, time_t currTime) {
}
}
void MobManager::step(time_t currTime) {
void MobManager::step(CNServer *serv, time_t currTime) {
for (auto& pair : Mobs) {
int x = pair.second->appearanceData.iX;
int y = pair.second->appearanceData.iY;

View File

@ -56,7 +56,7 @@ namespace MobManager {
extern std::map<int32_t, Mob*> Mobs;
void init();
void step(time_t);
void step(CNServer*, time_t);
void deadStep(Mob*, time_t);
void roamingStep(Mob*, time_t);