summaryrefslogtreecommitdiff
path: root/indra/newview/lldaycyclemanager.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 14:23:10 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 14:23:10 +0300
commit497c0983bb013cb65b6faf10045ea7b62511cc55 (patch)
treeb3d20dcf47109a5e94ffa888f2add1448fa7ff0d /indra/newview/lldaycyclemanager.cpp
parent0a2406b494bed489da02f27852d916790b412ab5 (diff)
STORM-1253 WIP Fixed a potential bug: removing a day cycle didn't remove it from internal data structures.
Diffstat (limited to 'indra/newview/lldaycyclemanager.cpp')
-rw-r--r--indra/newview/lldaycyclemanager.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp
index 2e622d002c..07a9a72e68 100644
--- a/indra/newview/lldaycyclemanager.cpp
+++ b/indra/newview/lldaycyclemanager.cpp
@@ -88,20 +88,25 @@ bool LLDayCycleManager::savePreset(const std::string& name, const LLSD& data)
bool LLDayCycleManager::deletePreset(const std::string& name)
{
- std::string path;
- std::string filename = LLURI::escape(name) + ".xml";
+ // Remove it from the map.
+ dc_map_t::iterator it = mDayCycleMap.find(name);
+ if (it == mDayCycleMap.end())
+ {
+ LL_WARNS("Windlight") << "No day cycle named " << name << LL_ENDL;
+ return false;
+ }
+ mDayCycleMap.erase(it);
- // Try removing specified user preset.
- path = getUserDir() + filename;
- if (gDirUtilp->fileExists(path))
+ // Remove from the filesystem.
+ std::string filename = LLURI::escape(name) + ".xml";
+ if (gDirUtilp->fileExists(getUserDir() + filename))
{
gDirUtilp->deleteFilesInDir(getUserDir(), filename);
- mModifySignal();
- return true;
}
- // Invalid or system preset.
- return false;
+ // Signal interested parties.
+ mModifySignal();
+ return true;
}
boost::signals2::connection LLDayCycleManager::setModifyCallback(const modify_signal_t::slot_type& cb)