mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Merged pull request #1935
This commit is contained in:
commit
0e06a25f21
7 changed files with 28 additions and 18 deletions
|
@ -148,6 +148,7 @@ Programmers
|
|||
Scott Howard
|
||||
scrawl
|
||||
Sebastian Wick (swick)
|
||||
Sergey Fukanchik
|
||||
Sergey Shambir
|
||||
ShadowRadiance
|
||||
Siimacore
|
||||
|
|
|
@ -167,6 +167,7 @@
|
|||
Task #4621: Optimize combat AI
|
||||
Task #4643: Revise editor record verifying functionality
|
||||
Task #4645: Use constants instead of widely used magic numbers
|
||||
Task #4652: Move call to enemiesNearby() from InputManager::rest() to World::canRest()
|
||||
|
||||
0.44.0
|
||||
------
|
||||
|
|
|
@ -438,12 +438,16 @@ namespace MWBase
|
|||
|
||||
virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable) = 0;
|
||||
|
||||
virtual int canRest() = 0;
|
||||
///< check if the player is allowed to rest \n
|
||||
/// 0 - yes \n
|
||||
/// 1 - only waiting \n
|
||||
/// 2 - player is underwater \n
|
||||
/// 3 - enemies are nearby (not implemented)
|
||||
enum RestPermitted
|
||||
{
|
||||
Rest_Allowed = 0,
|
||||
Rest_OnlyWaiting = 1,
|
||||
Rest_PlayerIsUnderwater = 2,
|
||||
Rest_EnemiesAreNearby = 3
|
||||
};
|
||||
|
||||
/// check if the player is allowed to rest
|
||||
virtual RestPermitted canRest() const = 0;
|
||||
|
||||
/// \todo Probably shouldn't be here
|
||||
virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0;
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MWGui
|
|||
|
||||
void WaitDialog::setPtr(const MWWorld::Ptr &ptr)
|
||||
{
|
||||
setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == 0);
|
||||
setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == MWBase::World::Rest_Allowed);
|
||||
|
||||
if (mUntilHealedButton->getVisible())
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mUntilHealedButton);
|
||||
|
@ -120,9 +120,14 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||
}
|
||||
|
||||
int canRest = MWBase::Environment::get().getWorld ()->canRest ();
|
||||
MWBase::World::RestPermitted canRest = MWBase::Environment::get().getWorld ()->canRest ();
|
||||
|
||||
if (canRest == 2)
|
||||
if (canRest == MWBase::World::Rest_EnemiesAreNearby)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}");
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||
}
|
||||
else if (canRest == MWBase::World::Rest_PlayerIsUnderwater)
|
||||
{
|
||||
// resting underwater or mid-air not allowed
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
|
||||
|
|
|
@ -1029,10 +1029,6 @@ namespace MWInput
|
|||
if (!MWBase::Environment::get().getWindowManager()->getRestEnabled () || MWBase::Environment::get().getWindowManager()->isGuiMode ())
|
||||
return;
|
||||
|
||||
if(mPlayer->enemiesNearby()) {//Check if in combat
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}"); //Nope,
|
||||
return;
|
||||
}
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_Rest); //Open rest GUI
|
||||
|
||||
}
|
||||
|
|
|
@ -2297,7 +2297,7 @@ namespace MWWorld
|
|||
applyLoopingParticles(player);
|
||||
}
|
||||
|
||||
int World::canRest ()
|
||||
World::RestPermitted World::canRest () const
|
||||
{
|
||||
CellStore *currentCell = mWorldScene->getCurrentCell();
|
||||
|
||||
|
@ -2309,13 +2309,16 @@ namespace MWWorld
|
|||
if (!actor)
|
||||
throw std::runtime_error("can't find player");
|
||||
|
||||
if(mPlayer->enemiesNearby())
|
||||
return Rest_EnemiesAreNearby;
|
||||
|
||||
if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isUnderwater(currentCell, playerPos) || isWalkingOnWater(player))
|
||||
return 2;
|
||||
return Rest_PlayerIsUnderwater;
|
||||
|
||||
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf())
|
||||
return 1;
|
||||
return Rest_OnlyWaiting;
|
||||
|
||||
return 0;
|
||||
return Rest_Allowed;
|
||||
}
|
||||
|
||||
MWRender::Animation* World::getAnimation(const MWWorld::Ptr &ptr)
|
||||
|
|
|
@ -551,7 +551,7 @@ namespace MWWorld
|
|||
|
||||
void enableActorCollision(const MWWorld::Ptr& actor, bool enable) override;
|
||||
|
||||
int canRest() override;
|
||||
RestPermitted canRest() const override;
|
||||
///< check if the player is allowed to rest \n
|
||||
/// 0 - yes \n
|
||||
/// 1 - only waiting \n
|
||||
|
|
Loading…
Reference in a new issue