[Client] Track & use previous race & creatureRefId for DedicatedPlayers

0.6.3
David Cernat 7 years ago
parent acb1335d78
commit 68ee64902d

@ -60,6 +60,7 @@ DedicatedPlayer::DedicatedPlayer(RakNet::RakNetGUID guid) : BasePlayer(guid)
MWBase::World *world = MWBase::Environment::get().getWorld();
npc = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
npc.mId = "Dedicated Player";
previousRace = npc.mRace;
}
DedicatedPlayer::~DedicatedPlayer()
{
@ -142,8 +143,6 @@ void DedicatedPlayer::move(float dt)
void DedicatedPlayer::setBaseInfo()
{
static std::string previousRace;
// Use the previous race if the new one doesn't exist
if (!RecordHelper::doesRaceExist(npc.mRace))
npc.mRace = previousRace;
@ -175,6 +174,8 @@ void DedicatedPlayer::setShapeshift()
if (reference)
isNpc = ptr.getTypeName() == typeid(ESM::NPC).name();
if (creatureRefId != previousCreatureRefId)
{
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
{
if (isNpc)
@ -227,6 +228,9 @@ void DedicatedPlayer::setShapeshift()
reloadPtr();
}
previousCreatureRefId = creatureRefId;
}
if (ptr.getTypeName() == typeid(ESM::NPC).name())
{
MWBase::Environment::get().getMechanicsManager()->setWerewolf(ptr, isWerewolf);

@ -71,7 +71,9 @@ namespace mwmp
ESM::CustomMarker marker;
bool markerEnabled;
std::string npcRecordId;
std::string previousRace;
std::string previousCreatureRefId;
std::string creatureRecordId;
};
}

Loading…
Cancel
Save