mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-23 11:50:04 +00:00
Make sure the current race is cleared when leaving an IZ
This commit is contained in:
parent
07a930fe1c
commit
55431362a7
@ -8,6 +8,7 @@
|
||||
#include "TableData.hpp"
|
||||
#include "ChatManager.hpp"
|
||||
#include "GroupManager.hpp"
|
||||
#include "RacingManager.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
@ -611,8 +612,13 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
|
||||
plr->instanceID = INSTANCE_OVERWORLD;
|
||||
MissionManager::failInstancedMissions(sock); // fail any instanced missions
|
||||
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_WARP_USE_NPC_SUCC, sizeof(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC));
|
||||
|
||||
ChunkManager::updatePlayerChunk(sock, plr->chunkPos, std::make_tuple(0, 0, 0)); // force player to reload chunks
|
||||
PlayerManager::updatePlayerPosition(sock, resp.iX, resp.iY, resp.iZ, INSTANCE_OVERWORLD, plr->angle);
|
||||
|
||||
// remove the player's ongoing race, if any
|
||||
if (RacingManager::EPRaces.find(sock) != RacingManager::EPRaces.end())
|
||||
RacingManager::EPRaces.erase(sock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,10 @@ void PlayerManager::removePlayer(CNSocket* key) {
|
||||
it++;
|
||||
}
|
||||
|
||||
// remove the player's ongoing race, if any
|
||||
if (RacingManager::EPRaces.find(key) != RacingManager::EPRaces.end())
|
||||
RacingManager::EPRaces.erase(key);
|
||||
|
||||
std::cout << players.size() << " players" << std::endl;
|
||||
}
|
||||
|
||||
@ -171,6 +175,10 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I
|
||||
// post-warp: check if the source instance has no more players in it and delete it if so
|
||||
ChunkManager::destroyInstanceIfEmpty(fromInstance);
|
||||
|
||||
// clean up EPRaces if we were likely in an IZ
|
||||
if (fromInstance != INSTANCE_OVERWORLD
|
||||
&& RacingManager::EPRaces.find(sock) != RacingManager::EPRaces.end())
|
||||
RacingManager::EPRaces.erase(sock);
|
||||
}
|
||||
|
||||
void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z) {
|
||||
|
Loading…
Reference in New Issue
Block a user