Skip to content

Commit

Permalink
2787: get free tag index from number of registered tags (TrenchBroom#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kduske authored Jun 4, 2019
1 parent 2513781 commit 1de5d11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 3 additions & 6 deletions common/src/Model/TagManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ namespace TrenchBroom {
}
};

TagManager::TagManager() :
m_currentTagTypeIndex(0) {}

const std::list<SmartTag>& TagManager::smartTags() const {
return m_smartTags;
}
Expand Down Expand Up @@ -108,9 +105,9 @@ namespace TrenchBroom {

size_t TagManager::freeTagIndex() {
static const size_t Bits = (sizeof(Tag::TagType) * 8);

ensure(m_currentTagTypeIndex <= Bits, "no more tag types");
return m_currentTagTypeIndex++;
const auto index = m_smartTags.size();
ensure(index <= Bits, "no more tag types");
return index;
}
}
}
6 changes: 0 additions & 6 deletions common/src/Model/TagManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@ namespace TrenchBroom {
*/
class TagManager {
private:
size_t m_currentTagTypeIndex;
std::list<SmartTag> m_smartTags;
class TagCmp;
public:
/**
* Creates a new instance.
*/
TagManager();

/**
* Returns a vector containing all smart tags registered with this manager.
*/
Expand Down

0 comments on commit 1de5d11

Please sign in to comment.