Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -72,22 +72,15 @@ bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& lis · 71 unmodified lines | ||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const QString& listName, T idToAdd) { |
| 75 | − QWriteLocker writeLock(&_mapLock); | |
| 76 | − auto currentList = _selectedItemsListMap.value(listName); | |
| 77 | − if (currentList.getContainsData()) { | |
| 78 | − currentList.addToGameplayObjects(idToAdd); | |
| 79 | − _selectedItemsListMap.insert(listName, currentList); | |
| 75 | + GameplayObjects currentList = _selectedItemsListMap.value(listName); | |
| 76 | + currentList.addToGameplayObjects(idToAdd); | |
| 77 | + _selectedItemsListMap.insert(listName, currentList); | |
| 80 | 78 | |
| 81 | − emit selectedItemsListChanged(listName); | |
| 82 | − return true; | |
| 83 | − } else { | |
| 84 | − _selectedItemsListMap.insert(listName, GameplayObjects()); | |
| 85 | − return addToGameplayObjects(listName, idToAdd); | |
| 86 | − } | |
| 79 | + emit selectedItemsListChanged(listName); | |
| 80 | + return true; | |
| 87 | 81 | } |
| 88 | 82 | template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(const QString& listName, T idToRemove) { |
| 89 | − QWriteLocker writeLock(&_mapLock); | |
| 90 | − auto currentList = _selectedItemsListMap.value(listName); | |
| 83 | + GameplayObjects currentList = _selectedItemsListMap.value(listName); | |
| 91 | 84 | if (currentList.getContainsData()) { |
| 92 | 85 | currentList.removeFromGameplayObjects(idToRemove); |
| 93 | 86 | _selectedItemsListMap.insert(listName, currentList); |
| @@ -103,13 +96,11 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 9 unmodified lines | ||
| 103 | 96 | // |
| 104 | 97 | |
| 105 | 98 | GameplayObjects SelectionScriptingInterface::getList(const QString& listName) { |
| 106 | − QReadLocker readLock(&_mapLock); | |
| 107 | 99 | return _selectedItemsListMap.value(listName); |
| 108 | 100 | } |
| 109 | 101 | |
| 110 | 102 | void SelectionScriptingInterface::printList(const QString& listName) { |
| 111 | − QReadLocker readLock(&_mapLock); | |
| 112 | − auto currentList = _selectedItemsListMap.value(listName); | |
| 103 | + GameplayObjects currentList = _selectedItemsListMap.value(listName); | |
| 113 | 104 | if (currentList.getContainsData()) { |
| 114 | 105 | |
| 115 | 106 | qDebug() << "Avatar IDs:"; |
| @@ -135,7 +126,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 19 unmodified lines | ||
| 135 | 126 | } |
| 136 | 127 | |
| 137 | 128 | bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { |
| 138 | − QWriteLocker writeLock(&_mapLock); | |
| 139 | 129 | if (_selectedItemsListMap.remove(listName)) { |
| 140 | 130 | emit selectedItemsListChanged(listName); |
| 141 | 131 | return true; |