diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-09-24 18:31:48 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-09-24 19:34:13 +0300 |
commit | 86446c7b55c4265b3dd90919e4d1cd4a4d30ea6a (patch) | |
tree | 4d9ab3182e9009a9a8608f2e5642f87491c13d38 | |
parent | 5eab13589284f1044bae7303d68bc2752f304a97 (diff) |
viewer#2648 Fix issues with day offset value
-rw-r--r-- | indra/newview/llenvironment.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 05bd704556..722c565300 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -2087,6 +2087,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf body[KEY_ENVIRONMENT][KEY_DAYLENGTH] = updates->mDayLength; } + // server only allows positive values if (updates->mDayOffset > 0) { body[KEY_ENVIRONMENT][KEY_DAYOFFSET] = updates->mDayOffset; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 423ca376d1..7dd9f6e86e 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -287,7 +287,7 @@ void LLPanelEnvironmentInfo::refresh() F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); - if (dayoffset.value() > 12.0f) + while (dayoffset.value() >= daylength.value()) dayoffset -= daylength; mSliderDayLength->setValue(daylength.value()); @@ -734,8 +734,8 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { F32Hours dayoffset(value); - if (dayoffset.value() <= 0.0f) - // if day cycle is 5 hours long, we want -1h offset to result in 4h + // server only allows positive values + while (dayoffset.value() <= 0.0f) dayoffset += mCurrentEnvironment->mDayLength; mCurrentEnvironment->mDayOffset = dayoffset; |