mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-08 03:28:15 +03:00
Handle zero and negative loop increment offset
This commit is contained in:
parent
647db01978
commit
3aab3f5839
1 changed files with 2 additions and 1 deletions
|
@ -479,7 +479,8 @@ namespace MWWorld
|
|||
|
||||
// This formula finds the number of missed increments necessary to make the rise hour a 24-day loop.
|
||||
// The offset increases on the first day of the loop and is multiplied by the number of completed loops.
|
||||
float incrementOffset = (24.0f - (24.0f / mDailyIncrement)) * std::floor((gameDay + startDay) / 24.0f);
|
||||
float incrementOffset = (mDailyIncrement == 0.0f) ?
|
||||
0.0f : (24.0f - std::abs(24.0f / mDailyIncrement)) * std::floor((gameDay + startDay) / 24.0f);
|
||||
|
||||
// This odd formula arises from the fact that on 16 Last Seed, 17 increments have occurred, meaning
|
||||
// that upon starting a new game, it must only calculate the moon phase as far back as 1 Last Seed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue