[Client] Rename methods to make their purpose clearer

0.6.1
David Cernat 8 years ago
parent 6da6c4e62d
commit 0ccbe70e61

@ -1593,15 +1593,15 @@ void CharacterController::update(float duration)
Keep track of LocalActor and DedicatedActor objects so as to reuse them Keep track of LocalActor and DedicatedActor objects so as to reuse them
*/ */
bool hasLocalActorRecord = mwmp::Main::get().getCellController()->hasLocalActorRecord(mPtr); bool isLocalActor = mwmp::Main::get().getCellController()->isLocalActor(mPtr);
bool hasDedicatedActorRecord = mwmp::Main::get().getCellController()->hasDedicatedActorRecord(mPtr); bool isDedicatedActor = mwmp::Main::get().getCellController()->isDedicatedActor(mPtr);
mwmp::LocalActor *localActor = nullptr; mwmp::LocalActor *localActor = nullptr;
mwmp::DedicatedActor *dedicatedActor = nullptr; mwmp::DedicatedActor *dedicatedActor = nullptr;
if (hasLocalActorRecord) if (isLocalActor)
localActor = mwmp::Main::get().getCellController()->getLocalActor(mPtr); localActor = mwmp::Main::get().getCellController()->getLocalActor(mPtr);
if (hasDedicatedActorRecord) if (isDedicatedActor)
dedicatedActor = mwmp::Main::get().getCellController()->getDedicatedActor(mPtr); dedicatedActor = mwmp::Main::get().getCellController()->getDedicatedActor(mPtr);
/* /*
End of tes3mp addition End of tes3mp addition
@ -1898,7 +1898,7 @@ void CharacterController::update(float duration)
Save or load animation states for this actor, depending on whether it's a local Save or load animation states for this actor, depending on whether it's a local
or dedicated one or dedicated one
*/ */
if (hasLocalActorRecord) if (isLocalActor)
{ {
localActor->hasAnimStates = true; localActor->hasAnimStates = true;
localActor->animStates.idlestate = idlestate; localActor->animStates.idlestate = idlestate;
@ -1906,7 +1906,7 @@ void CharacterController::update(float duration)
localActor->animStates.jumpstate = jumpstate; localActor->animStates.jumpstate = jumpstate;
localActor->animStates.forcestateupdate = forcestateupdate; localActor->animStates.forcestateupdate = forcestateupdate;
} }
else if (hasDedicatedActorRecord) else if (isDedicatedActor)
{ {
if (dedicatedActor->hasAnimStates) if (dedicatedActor->hasAnimStates)
{ {
@ -2016,14 +2016,14 @@ void CharacterController::update(float duration)
Save or load movement velocity based on whether this is a local or dedicated actor Save or load movement velocity based on whether this is a local or dedicated actor
*/ */
if (hasLocalActorRecord) if (isLocalActor)
{ {
localActor->hasMovement = true; localActor->hasMovement = true;
localActor->movement.x = moved.x(); localActor->movement.x = moved.x();
localActor->movement.y = moved.y(); localActor->movement.y = moved.y();
localActor->movement.z = moved.z(); localActor->movement.z = moved.z();
} }
else if (hasDedicatedActorRecord) else if (isDedicatedActor)
{ {
if (dedicatedActor->hasMovement) if (dedicatedActor->hasMovement)
moved = osg::Vec3f(dedicatedActor->movement.x, dedicatedActor->movement.y, dedicatedActor->movement.z); moved = osg::Vec3f(dedicatedActor->movement.x, dedicatedActor->movement.y, dedicatedActor->movement.z);
@ -2166,7 +2166,7 @@ bool CharacterController::playGroup(const std::string &groupname, int mode, int
If we are the cell authority over this actor, we need to record this new If we are the cell authority over this actor, we need to record this new
animation for it animation for it
*/ */
if (mwmp::Main::get().getCellController()->hasLocalActorRecord(mPtr)) if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
{ {
mwmp::LocalActor *actor = mwmp::Main::get().getCellController()->getLocalActor(mPtr); mwmp::LocalActor *actor = mwmp::Main::get().getCellController()->getLocalActor(mPtr);
actor->hasAnimation = true; actor->hasAnimation = true;
@ -2459,13 +2459,13 @@ void CharacterController::updateHeadTracking(float duration)
Save or load head pitch and yaw depending on whether this is a local or dedicated actor Save or load head pitch and yaw depending on whether this is a local or dedicated actor
*/ */
if (mwmp::Main::get().getCellController()->hasLocalActorRecord(mPtr)) if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
{ {
mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(mPtr); mwmp::LocalActor *localActor = mwmp::Main::get().getCellController()->getLocalActor(mPtr);
localActor->headPitch = xAngleRadians; localActor->headPitch = xAngleRadians;
localActor->headYaw = zAngleRadians; localActor->headYaw = zAngleRadians;
} }
else if (mwmp::Main::get().getCellController()->hasDedicatedActorRecord(mPtr)) else if (mwmp::Main::get().getCellController()->isDedicatedActor(mPtr))
{ {
mwmp::DedicatedActor *dedicatedActor = mwmp::Main::get().getCellController()->getDedicatedActor(mPtr); mwmp::DedicatedActor *dedicatedActor = mwmp::Main::get().getCellController()->getDedicatedActor(mPtr);

@ -112,7 +112,7 @@ void CellController::removeLocalActorRecord(std::string actorIndex)
localActorsToCells.erase(actorIndex); localActorsToCells.erase(actorIndex);
} }
bool CellController::hasLocalActorRecord(MWWorld::Ptr ptr) bool CellController::isLocalActor(MWWorld::Ptr ptr)
{ {
std::string mapIndex = generateMapIndex(ptr); std::string mapIndex = generateMapIndex(ptr);
@ -137,7 +137,7 @@ void CellController::removeDedicatedActorRecord(std::string actorIndex)
dedicatedActorsToCells.erase(actorIndex); dedicatedActorsToCells.erase(actorIndex);
} }
bool CellController::hasDedicatedActorRecord(MWWorld::Ptr ptr) bool CellController::isDedicatedActor(MWWorld::Ptr ptr)
{ {
std::string mapIndex = generateMapIndex(ptr); std::string mapIndex = generateMapIndex(ptr);

@ -25,12 +25,12 @@ namespace mwmp
void setLocalActorRecord(std::string actorIndex, std::string cellIndex); void setLocalActorRecord(std::string actorIndex, std::string cellIndex);
void removeLocalActorRecord(std::string actorIndex); void removeLocalActorRecord(std::string actorIndex);
bool hasLocalActorRecord(MWWorld::Ptr ptr); bool isLocalActor(MWWorld::Ptr ptr);
virtual LocalActor *getLocalActor(MWWorld::Ptr ptr); virtual LocalActor *getLocalActor(MWWorld::Ptr ptr);
void setDedicatedActorRecord(std::string actorIndex, std::string cellIndex); void setDedicatedActorRecord(std::string actorIndex, std::string cellIndex);
void removeDedicatedActorRecord(std::string actorIndex); void removeDedicatedActorRecord(std::string actorIndex);
bool hasDedicatedActorRecord(MWWorld::Ptr ptr); bool isDedicatedActor(MWWorld::Ptr ptr);
virtual DedicatedActor *getDedicatedActor(MWWorld::Ptr ptr); virtual DedicatedActor *getDedicatedActor(MWWorld::Ptr ptr);
std::string generateMapIndex(MWWorld::Ptr ptr); std::string generateMapIndex(MWWorld::Ptr ptr);

Loading…
Cancel
Save