diff --git a/core/MenuStyle_Base.cpp b/core/MenuStyle_Base.cpp index 9c4d27fe..d8341641 100644 --- a/core/MenuStyle_Base.cpp +++ b/core/MenuStyle_Base.cpp @@ -194,6 +194,16 @@ void BaseMenuStyle::ProcessWatchList() return; } +#if defined MENU_DEBUG + g_Logger.LogMessage("BaseMenuStyle::ProcessWatchList(%d,%d,%d,%d,%d,%p)", + m_WatchList.m_Size, + m_WatchList.m_FirstLink, + m_WatchList.m_FreeNodes, + m_WatchList.m_LastLink, + m_WatchList.m_MaxSize, + m_WatchList.m_Nodes); +#endif + unsigned int total = 0; for (FastLink::iterator iter=m_WatchList.begin(); iter!=m_WatchList.end(); ++iter) { diff --git a/core/sm_fastlink.h b/core/sm_fastlink.h index a35a0c6b..73714eb9 100644 --- a/core/sm_fastlink.h +++ b/core/sm_fastlink.h @@ -31,7 +31,7 @@ public: T obj; }; public: - FastLink(unsigned int maxsize) : m_Size(0), m_FirstLink(0), m_FreeNodes(0), m_LastLink(0) + FastLink(unsigned int maxsize) : m_Size(0), m_FirstLink(0), m_FreeNodes(0), m_LastLink(0), m_UsableIndex(0) { m_MaxSize = maxsize; m_Nodes = new FastLinkNode[m_MaxSize+1]; @@ -70,11 +70,12 @@ private: { return m_Nodes[m_FreeNodes--].freeNode; } else { - if (m_LastLink >= m_MaxSize) + if (m_UsableIndex >= m_MaxSize) { return 0; } - return m_LastLink + 1; + m_UsableIndex++; + return m_UsableIndex; } } public: @@ -184,12 +185,17 @@ public: return iter; } +#if defined MENU_DEBUG +public: +#else private: +#endif size_t m_Size; unsigned int m_FirstLink; unsigned int m_FreeNodes; unsigned int m_LastLink; unsigned int m_MaxSize; + unsigned int m_UsableIndex; FastLinkNode *m_Nodes; };