diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2019-10-26 16:20:31 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2019-10-26 16:20:31 +0200 |
commit | 3dee880c2941417c9e5ec42297da65f27ab9c5ca (patch) | |
tree | 93f0daf6f0fdc04fb2898a202157d3d9ec078ffb /src/core/templates.h | |
parent | script 500-599 (diff) | |
parent | Fix hornPatternsArray (diff) | |
download | re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar.gz re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar.bz2 re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar.lz re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar.xz re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.tar.zst re3-3dee880c2941417c9e5ec42297da65f27ab9c5ca.zip |
Diffstat (limited to 'src/core/templates.h')
-rw-r--r-- | src/core/templates.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/templates.h b/src/core/templates.h index ef2db33a..f785d647 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -44,7 +44,20 @@ public: m_flags[i].free = 1; } } - int GetSize(void) { return m_size; } + ~CPool() { + Flush(); + } + void Flush() { + if (m_size > 0) { + free(m_entries); + free(m_flags); + m_entries = nil; + m_flags = nil; + m_size = 0; + m_allocPtr = 0; + } + } + int GetSize(void) const { return m_size; } T *New(void){ bool wrapped = false; do @@ -101,12 +114,14 @@ public: n++; return n; } + bool IsFreeSlot(int i) { return !!m_flags[i].free; } void ClearStorage(uint8 *&flags, U *&entries){ free(flags); free(entries); flags = nil; entries = nil; } + uint32 GetMaxEntrySize() const { return sizeof(U); } void CopyBack(uint8 *&flags, U *&entries){ memcpy(m_flags, flags, sizeof(uint8)*m_size); memcpy(m_entries, entries, sizeof(U)*m_size); |