openmw-tes3coop/apps/openmw/mwmp/DedicatedPlayer.hpp
David Cernat 141eb8b7c2 [Client] Streamline creation of references for DedicatedPlayers
Additionally, delete DedicatedPlayers who disconnect.

Previously, all disconnected DedicatedPlayers were still kept in memory, but never used again. There was code that suggested they were meant to be reused upon reconnecting, but that reuse had never actually been implemented, and would probably not be that useful anyway.
2018-04-08 15:02:43 +03:00

77 lines
1.5 KiB
C++

//
// Created by koncord on 02.01.16.
//
#ifndef OPENMW_DEDICATEDPLAYER_HPP
#define OPENMW_DEDICATEDPLAYER_HPP
#include <components/esm/custommarkerstate.hpp>
#include <components/esm/loadcrea.hpp>
#include <components/esm/loadnpc.hpp>
#include <components/openmw-mp/Base/BasePlayer.hpp>
#include "../mwclass/npc.hpp"
#include "../mwmechanics/aisequence.hpp"
#include "../mwworld/manualref.hpp"
#include <map>
#include <RakNetTypes.h>
namespace MWMechanics
{
class Actor;
}
namespace mwmp
{
struct DedicatedPlayer;
class DedicatedPlayer : public BasePlayer
{
friend class PlayerList;
public:
void update(float dt);
void move(float dt);
void setBaseInfo();
void setShapeshift();
void setAnimFlags();
void setEquipment();
void setCell();
void updateMarker();
void removeMarker();
void setMarkerState(bool state);
void playAnimation();
void playSpeech();
ESM::NPC getNpcRecord();
ESM::Creature getCreatureRecord();
void createReference(ESM::NPC& npc, ESM::Creature& creature);
void deleteReference();
MWWorld::Ptr getPtr();
MWWorld::ManualRef* getRef();
void setPtr(const MWWorld::Ptr& newPtr);
private:
DedicatedPlayer(RakNet::RakNetGUID guid);
virtual ~DedicatedPlayer();
MWWorld::ManualRef* reference;
MWWorld::Ptr ptr;
ESM::CustomMarker marker;
bool markerEnabled;
};
}
#endif //OPENMW_DEDICATEDPLAYER_HPP