crlib: reworked dictionary to hashmap.

linkage: another fix to dynamic linkage.
cpp: fixed msvc warning about placement new.
This commit is contained in:
dmitry 2020-06-15 22:36:11 +03:00 committed by jeefo
commit 43f6a7828a
12 changed files with 291 additions and 312 deletions

View file

@ -71,6 +71,7 @@ CR_DECLARE_SCOPED_ENUM (StatusIconCache,
class MessageDispatcher final : public Singleton <MessageDispatcher> {
private:
using MsgFunc = void (MessageDispatcher::*) ();
using MsgHash = Hash <int32>;
private:
struct Args {
@ -87,20 +88,22 @@ private:
};
private:
Dictionary <String, int32> m_textMsgCache; // cache strings for faster access for textmsg
Dictionary <String, int32> m_showMenuCache; // cache for the showmenu message
Dictionary <String, int32> m_statusIconCache; // cache for status icon message
Dictionary <String, int32> m_teamInfoCache; // cache for teaminfo message
HashMap <String, int32> m_textMsgCache; // cache strings for faster access for textmsg
HashMap <String, int32> m_showMenuCache; // cache for the showmenu message
HashMap <String, int32> m_statusIconCache; // cache for status icon message
HashMap <String, int32> m_teamInfoCache; // cache for teaminfo message
private:
Bot *m_bot {}; // owner of a message
NetMsg m_current {}; // ongoing message id
SmallArray <Args> m_args; // args collected from write* functions
Dictionary <String, NetMsg> m_wanted; // wanted messages
Dictionary <NetMsg, int32, IntNoHash <int32>> m_maps; // maps our message to id to engine message id
Dictionary <NetMsg, MsgFunc, IntNoHash <int32>> m_handlers; // maps our message id to handler function
HashMap <String, NetMsg> m_wanted; // wanted messages
HashMap <int32, NetMsg> m_reverseMap; // maps engine message id to our message id
HashMap <NetMsg, int32, MsgHash> m_maps; // maps our message to id to engine message id
HashMap <NetMsg, MsgFunc, MsgHash> m_handlers; // maps our message id to handler function
private:
void netMsgTextMsg ();