mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-14 23:21:43 +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();
|
updateMagicMarkers();
|
||||||
updateCustomMarkers();
|
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)
|
void LocalMapBase::requestMapRender(const MWWorld::CellStore *cell)
|
||||||
|
|
|
@ -384,7 +384,9 @@ void DedicatedPlayer::setCell()
|
||||||
removeMarker();
|
removeMarker();
|
||||||
// Otherwise, update their marker so the player shows up in the right cell on the world map
|
// Otherwise, update their marker so the player shows up in the right cell on the world map
|
||||||
else
|
else
|
||||||
updateMarker();
|
{
|
||||||
|
enableMarker();
|
||||||
|
}
|
||||||
|
|
||||||
// If this player is now in a cell that we are the local authority over, we should send them all
|
// 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
|
// NPC data in that cell
|
||||||
|
@ -408,7 +410,9 @@ void DedicatedPlayer::setCell()
|
||||||
void DedicatedPlayer::updateMarker()
|
void DedicatedPlayer::updateMarker()
|
||||||
{
|
{
|
||||||
if (!markerEnabled)
|
if (!markerEnabled)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GUIController *gui = Main::get().getGUIController();
|
GUIController *gui = Main::get().getGUIController();
|
||||||
|
|
||||||
|
@ -419,7 +423,15 @@ void DedicatedPlayer::updateMarker()
|
||||||
gui->mPlayerMarkers.addMarker(marker);
|
gui->mPlayerMarkers.addMarker(marker);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
gui->mPlayerMarkers.addMarker(marker, true);
|
gui->mPlayerMarkers.addMarker(marker, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DedicatedPlayer::enableMarker()
|
||||||
|
{
|
||||||
|
markerEnabled = true;
|
||||||
|
updateMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DedicatedPlayer::removeMarker()
|
void DedicatedPlayer::removeMarker()
|
||||||
|
@ -431,18 +443,9 @@ void DedicatedPlayer::removeMarker()
|
||||||
GUIController *gui = Main::get().getGUIController();
|
GUIController *gui = Main::get().getGUIController();
|
||||||
|
|
||||||
if (gui->mPlayerMarkers.contains(marker))
|
if (gui->mPlayerMarkers.contains(marker))
|
||||||
Main::get().getGUIController()->mPlayerMarkers.deleteMarker(marker);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DedicatedPlayer::setMarkerState(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
{
|
{
|
||||||
markerEnabled = true;
|
Main::get().getGUIController()->mPlayerMarkers.deleteMarker(marker);
|
||||||
updateMarker();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
removeMarker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DedicatedPlayer::playAnimation()
|
void DedicatedPlayer::playAnimation()
|
||||||
|
@ -472,7 +475,7 @@ void DedicatedPlayer::createReference(const std::string& recId)
|
||||||
|
|
||||||
ESM::CustomMarker mEditingMarker = Main::get().getGUIController()->createMarker(guid);
|
ESM::CustomMarker mEditingMarker = Main::get().getGUIController()->createMarker(guid);
|
||||||
marker = mEditingMarker;
|
marker = mEditingMarker;
|
||||||
setMarkerState(true);
|
enableMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DedicatedPlayer::deleteReference()
|
void DedicatedPlayer::deleteReference()
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace mwmp
|
||||||
|
|
||||||
void updateMarker();
|
void updateMarker();
|
||||||
void removeMarker();
|
void removeMarker();
|
||||||
void setMarkerState(bool state);
|
void enableMarker();
|
||||||
|
|
||||||
void playAnimation();
|
void playAnimation();
|
||||||
void playSpeech();
|
void playSpeech();
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "LocalPlayer.hpp"
|
#include "LocalPlayer.hpp"
|
||||||
#include "Main.hpp"
|
#include "Main.hpp"
|
||||||
#include "Networking.hpp"
|
#include "Networking.hpp"
|
||||||
|
#include "PlayerList.hpp"
|
||||||
#include "CellController.hpp"
|
#include "CellController.hpp"
|
||||||
#include "GUIController.hpp"
|
#include "GUIController.hpp"
|
||||||
#include "MechanicsHelper.hpp"
|
#include "MechanicsHelper.hpp"
|
||||||
|
@ -463,6 +464,13 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send();
|
||||||
|
|
||||||
isChangingRegion = false;
|
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);
|
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
|
Go through all DedicatedPlayers checking if their mHitAttemptActorId matches this one
|
||||||
and set it to -1 if it does
|
and set it to -1 if it does
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace mwmp
|
||||||
|
|
||||||
static bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
static bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
|
static void enableMarkers(const ESM::Cell& cell);
|
||||||
|
|
||||||
static void clearHitAttemptActorId(int actorId);
|
static void clearHitAttemptActorId(int actorId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue