mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-02 19:21:38 +00:00
[Client] Prevent permanent deletion of player markers on cell changes
This commit is contained in:
parent
48ebdb38c7
commit
57f84914c3
6 changed files with 37 additions and 22 deletions
|
@ -458,15 +458,6 @@ namespace MWGui
|
|||
|
||||
updateMagicMarkers();
|
||||
updateCustomMarkers();
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Update player markers when cell changes to fix their locations
|
||||
*/
|
||||
updatePlayerMarkers();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
}
|
||||
|
||||
void LocalMapBase::requestMapRender(const MWWorld::CellStore *cell)
|
||||
|
|
|
@ -384,7 +384,9 @@ void DedicatedPlayer::setCell()
|
|||
removeMarker();
|
||||
// Otherwise, update their marker so the player shows up in the right cell on the world map
|
||||
else
|
||||
updateMarker();
|
||||
{
|
||||
enableMarker();
|
||||
}
|
||||
|
||||
// If this player is now in a cell that we are the local authority over, we should send them all
|
||||
// NPC data in that cell
|
||||
|
@ -408,7 +410,9 @@ void DedicatedPlayer::setCell()
|
|||
void DedicatedPlayer::updateMarker()
|
||||
{
|
||||
if (!markerEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GUIController *gui = Main::get().getGUIController();
|
||||
|
||||
|
@ -419,7 +423,15 @@ void DedicatedPlayer::updateMarker()
|
|||
gui->mPlayerMarkers.addMarker(marker);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui->mPlayerMarkers.addMarker(marker, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DedicatedPlayer::enableMarker()
|
||||
{
|
||||
markerEnabled = true;
|
||||
updateMarker();
|
||||
}
|
||||
|
||||
void DedicatedPlayer::removeMarker()
|
||||
|
@ -431,18 +443,9 @@ void DedicatedPlayer::removeMarker()
|
|||
GUIController *gui = Main::get().getGUIController();
|
||||
|
||||
if (gui->mPlayerMarkers.contains(marker))
|
||||
Main::get().getGUIController()->mPlayerMarkers.deleteMarker(marker);
|
||||
}
|
||||
|
||||
void DedicatedPlayer::setMarkerState(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
markerEnabled = true;
|
||||
updateMarker();
|
||||
Main::get().getGUIController()->mPlayerMarkers.deleteMarker(marker);
|
||||
}
|
||||
else
|
||||
removeMarker();
|
||||
}
|
||||
|
||||
void DedicatedPlayer::playAnimation()
|
||||
|
@ -472,7 +475,7 @@ void DedicatedPlayer::createReference(const std::string& recId)
|
|||
|
||||
ESM::CustomMarker mEditingMarker = Main::get().getGUIController()->createMarker(guid);
|
||||
marker = mEditingMarker;
|
||||
setMarkerState(true);
|
||||
enableMarker();
|
||||
}
|
||||
|
||||
void DedicatedPlayer::deleteReference()
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace mwmp
|
|||
|
||||
void updateMarker();
|
||||
void removeMarker();
|
||||
void setMarkerState(bool state);
|
||||
void enableMarker();
|
||||
|
||||
void playAnimation();
|
||||
void playSpeech();
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "LocalPlayer.hpp"
|
||||
#include "Main.hpp"
|
||||
#include "Networking.hpp"
|
||||
#include "PlayerList.hpp"
|
||||
#include "CellController.hpp"
|
||||
#include "GUIController.hpp"
|
||||
#include "MechanicsHelper.hpp"
|
||||
|
@ -463,6 +464,13 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
|||
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send();
|
||||
|
||||
isChangingRegion = false;
|
||||
|
||||
// If this is an interior cell, are there any other players in it? If so,
|
||||
// enable their markers
|
||||
if (!ptrCell->isExterior())
|
||||
{
|
||||
mwmp::PlayerList::enableMarkers(*ptrCell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,17 @@ bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr)
|
|||
return (getPlayer(ptr) != 0);
|
||||
}
|
||||
|
||||
void PlayerList::enableMarkers(const ESM::Cell& cell)
|
||||
{
|
||||
for (auto &playerEntry : players)
|
||||
{
|
||||
if (Main::get().getCellController()->isSameCell(cell, playerEntry.second->cell))
|
||||
{
|
||||
playerEntry.second->enableMarker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Go through all DedicatedPlayers checking if their mHitAttemptActorId matches this one
|
||||
and set it to -1 if it does
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace mwmp
|
|||
|
||||
static bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
||||
|
||||
static void enableMarkers(const ESM::Cell& cell);
|
||||
|
||||
static void clearHitAttemptActorId(int actorId);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue