forked from teamnwah/openmw-tes3coop
[Client] Track & use previous race & creatureRefId for DedicatedPlayers
This commit is contained in:
parent
acb1335d78
commit
68ee64902d
2 changed files with 49 additions and 43 deletions
|
@ -60,6 +60,7 @@ DedicatedPlayer::DedicatedPlayer(RakNet::RakNetGUID guid) : BasePlayer(guid)
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
npc = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
npc = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||||
npc.mId = "Dedicated Player";
|
npc.mId = "Dedicated Player";
|
||||||
|
previousRace = npc.mRace;
|
||||||
}
|
}
|
||||||
DedicatedPlayer::~DedicatedPlayer()
|
DedicatedPlayer::~DedicatedPlayer()
|
||||||
{
|
{
|
||||||
|
@ -142,8 +143,6 @@ void DedicatedPlayer::move(float dt)
|
||||||
|
|
||||||
void DedicatedPlayer::setBaseInfo()
|
void DedicatedPlayer::setBaseInfo()
|
||||||
{
|
{
|
||||||
static std::string previousRace;
|
|
||||||
|
|
||||||
// Use the previous race if the new one doesn't exist
|
// Use the previous race if the new one doesn't exist
|
||||||
if (!RecordHelper::doesRaceExist(npc.mRace))
|
if (!RecordHelper::doesRaceExist(npc.mRace))
|
||||||
npc.mRace = previousRace;
|
npc.mRace = previousRace;
|
||||||
|
@ -175,6 +174,8 @@ void DedicatedPlayer::setShapeshift()
|
||||||
if (reference)
|
if (reference)
|
||||||
isNpc = ptr.getTypeName() == typeid(ESM::NPC).name();
|
isNpc = ptr.getTypeName() == typeid(ESM::NPC).name();
|
||||||
|
|
||||||
|
if (creatureRefId != previousCreatureRefId)
|
||||||
|
{
|
||||||
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
|
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
|
||||||
{
|
{
|
||||||
if (isNpc)
|
if (isNpc)
|
||||||
|
@ -227,6 +228,9 @@ void DedicatedPlayer::setShapeshift()
|
||||||
reloadPtr();
|
reloadPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousCreatureRefId = creatureRefId;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr.getTypeName() == typeid(ESM::NPC).name())
|
if (ptr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getMechanicsManager()->setWerewolf(ptr, isWerewolf);
|
MWBase::Environment::get().getMechanicsManager()->setWerewolf(ptr, isWerewolf);
|
||||||
|
|
|
@ -71,7 +71,9 @@ namespace mwmp
|
||||||
ESM::CustomMarker marker;
|
ESM::CustomMarker marker;
|
||||||
bool markerEnabled;
|
bool markerEnabled;
|
||||||
|
|
||||||
std::string npcRecordId;
|
std::string previousRace;
|
||||||
|
std::string previousCreatureRefId;
|
||||||
|
|
||||||
std::string creatureRecordId;
|
std::string creatureRecordId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue