mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-24 18:41:34 +00:00
Don't extinguish held light sources when they're hidden (bug #6910)
This commit is contained in:
parent
a9c1fe3ee9
commit
94dfcdd062
2 changed files with 14 additions and 17 deletions
|
@ -136,6 +136,7 @@
|
||||||
Bug #6898: Accessing the Quick Inventory menu does not work while in menu mode
|
Bug #6898: Accessing the Quick Inventory menu does not work while in menu mode
|
||||||
Bug #6901: Morrowind.exe soul gem usage discrepancy
|
Bug #6901: Morrowind.exe soul gem usage discrepancy
|
||||||
Bug #6909: Using enchanted items has no animation
|
Bug #6909: Using enchanted items has no animation
|
||||||
|
Bug #6910: Torches should not be extinguished when not being held
|
||||||
Feature #890: OpenMW-CS: Column filtering
|
Feature #890: OpenMW-CS: Column filtering
|
||||||
Feature #1465: "Reset" argument for AI functions
|
Feature #1465: "Reset" argument for AI functions
|
||||||
Feature #2491: Ability to make OpenMW "portable"
|
Feature #2491: Ability to make OpenMW "portable"
|
||||||
|
|
|
@ -988,30 +988,26 @@ namespace MWMechanics
|
||||||
heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||||
|
|
||||||
//If holding a light...
|
//If holding a light...
|
||||||
if(heldIter.getType() == MWWorld::ContainerStore::Type_Light)
|
const auto world = MWBase::Environment::get().getWorld();
|
||||||
|
MWRender::Animation *anim = world->getAnimation(ptr);
|
||||||
|
if (heldIter.getType() == MWWorld::ContainerStore::Type_Light && anim && anim->getCarriedLeftShown())
|
||||||
{
|
{
|
||||||
const auto world = MWBase::Environment::get().getWorld();
|
|
||||||
// Use time from the player's light
|
// Use time from the player's light
|
||||||
if(isPlayer)
|
if(isPlayer)
|
||||||
{
|
{
|
||||||
// But avoid using it up if the light source is hidden
|
float timeRemaining = heldIter->getClass().getRemainingUsageTime(*heldIter);
|
||||||
MWRender::Animation *anim = world->getAnimation(ptr);
|
|
||||||
if (anim && anim->getCarriedLeftShown())
|
// -1 is infinite light source. Other negative values are treated as 0.
|
||||||
|
if (timeRemaining != -1.0f)
|
||||||
{
|
{
|
||||||
float timeRemaining = heldIter->getClass().getRemainingUsageTime(*heldIter);
|
timeRemaining -= duration;
|
||||||
|
if (timeRemaining <= 0.f)
|
||||||
// -1 is infinite light source. Other negative values are treated as 0.
|
|
||||||
if (timeRemaining != -1.0f)
|
|
||||||
{
|
{
|
||||||
timeRemaining -= duration;
|
inventoryStore.remove(*heldIter, 1, ptr); // remove it
|
||||||
if (timeRemaining <= 0.f)
|
return;
|
||||||
{
|
|
||||||
inventoryStore.remove(*heldIter, 1, ptr); // remove it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
heldIter->getClass().setRemainingUsageTime(*heldIter, timeRemaining);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
heldIter->getClass().setRemainingUsageTime(*heldIter, timeRemaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue