mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-02 02:36:43 +00:00
Merge pull request #2958 from akortunov/statswatcher
Corrections for StatsWatcher
This commit is contained in:
commit
0f6badc581
3 changed files with 26 additions and 23 deletions
|
@ -136,27 +136,6 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
mWatchedStatsEmpty = false;
|
mWatchedStatsEmpty = false;
|
||||||
|
|
||||||
// Update the equipped weapon icon
|
|
||||||
MWWorld::InventoryStore& inv = mWatched.getClass().getInventoryStore(mWatched);
|
|
||||||
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
|
||||||
if (weapon == inv.end())
|
|
||||||
winMgr->unsetSelectedWeapon();
|
|
||||||
else
|
|
||||||
winMgr->setSelectedWeapon(*weapon);
|
|
||||||
|
|
||||||
// Update the selected spell icon
|
|
||||||
MWWorld::ContainerStoreIterator enchantItem = inv.getSelectedEnchantItem();
|
|
||||||
if (enchantItem != inv.end())
|
|
||||||
winMgr->setSelectedEnchantItem(*enchantItem);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const std::string& spell = winMgr->getSelectedSpell();
|
|
||||||
if (!spell.empty())
|
|
||||||
winMgr->setSelectedSpell(spell, int(MWMechanics::getSpellSuccessChance(spell, mWatched)));
|
|
||||||
else
|
|
||||||
winMgr->unsetSelectedSpell();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsWatcher::addListener(StatsListener* listener)
|
void StatsWatcher::addListener(StatsListener* listener)
|
||||||
|
|
|
@ -302,13 +302,37 @@ namespace MWMechanics
|
||||||
|
|
||||||
void MechanicsManager::update(float duration, bool paused)
|
void MechanicsManager::update(float duration, bool paused)
|
||||||
{
|
{
|
||||||
|
// Note: we should do it here since game mechanics and world updates use these values
|
||||||
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
|
|
||||||
|
// Update the equipped weapon icon
|
||||||
|
MWWorld::InventoryStore& inv = ptr.getClass().getInventoryStore(ptr);
|
||||||
|
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
|
if (weapon == inv.end())
|
||||||
|
winMgr->unsetSelectedWeapon();
|
||||||
|
else
|
||||||
|
winMgr->setSelectedWeapon(*weapon);
|
||||||
|
|
||||||
|
// Update the selected spell icon
|
||||||
|
MWWorld::ContainerStoreIterator enchantItem = inv.getSelectedEnchantItem();
|
||||||
|
if (enchantItem != inv.end())
|
||||||
|
winMgr->setSelectedEnchantItem(*enchantItem);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const std::string& spell = winMgr->getSelectedSpell();
|
||||||
|
if (!spell.empty())
|
||||||
|
winMgr->setSelectedSpell(spell, int(MWMechanics::getSpellSuccessChance(spell, ptr)));
|
||||||
|
else
|
||||||
|
winMgr->unsetSelectedSpell();
|
||||||
|
}
|
||||||
|
|
||||||
if (mUpdatePlayer)
|
if (mUpdatePlayer)
|
||||||
{
|
{
|
||||||
mUpdatePlayer = false;
|
mUpdatePlayer = false;
|
||||||
|
|
||||||
// HACK? The player has been changed, so a new Animation object may
|
// HACK? The player has been changed, so a new Animation object may
|
||||||
// have been made for them. Make sure they're properly updated.
|
// have been made for them. Make sure they're properly updated.
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
|
||||||
mActors.removeActor(ptr);
|
mActors.removeActor(ptr);
|
||||||
mActors.addActor(ptr, true);
|
mActors.addActor(ptr, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1907,7 +1907,7 @@ namespace MWWorld
|
||||||
std::string enchantId = selectedEnchantItem.getClass().getEnchantment(selectedEnchantItem);
|
std::string enchantId = selectedEnchantItem.getClass().getEnchantment(selectedEnchantItem);
|
||||||
if (!enchantId.empty())
|
if (!enchantId.empty())
|
||||||
{
|
{
|
||||||
const ESM::Enchantment* ench = mStore.get<ESM::Enchantment>().search(selectedEnchantItem.getClass().getEnchantment(selectedEnchantItem));
|
const ESM::Enchantment* ench = mStore.get<ESM::Enchantment>().search(enchantId);
|
||||||
if (ench)
|
if (ench)
|
||||||
preloadEffects(&ench->mEffects);
|
preloadEffects(&ench->mEffects);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue