1.1 --- a/core/UserMessages.cpp Sat Apr 14 04:49:08 2007 +0000
1.2 +++ b/core/UserMessages.cpp Sun Apr 15 05:43:43 2007 +0000
1.3 @@ -19,8 +19,6 @@
1.4 SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
1.5 SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
1.6
1.7 -//:TODO: USE NEW MM IFACE TO SEARCH FOR MESSAGE NAMES ETC! faluco--> i'll do this when i have some spare time
1.8 -
1.9 UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
1.10 {
1.11 m_Names = sm_trie_create();
1.12 @@ -63,35 +61,20 @@
1.13 int UserMessages::GetMessageIndex(const char *msg)
1.14 {
1.15 int msgid;
1.16 +
1.17 if (!sm_trie_retrieve(m_Names, msg, reinterpret_cast<void **>(&msgid)))
1.18 {
1.19 - char buf[255];
1.20 - int dummy;
1.21 - msgid = 0;
1.22 + msgid = g_SMAPI->FindUserMessage(msg);
1.23
1.24 - while (gamedll->GetUserMessageInfo(msgid, buf, sizeof(buf), dummy))
1.25 + if (msgid != INVALID_MESSAGE_ID)
1.26 {
1.27 - if (strcmp(msg, buf) == 0)
1.28 - {
1.29 - sm_trie_insert(m_Names, msg, reinterpret_cast<void *>(msgid));
1.30 - return msgid;
1.31 - }
1.32 - msgid++;
1.33 + sm_trie_insert(m_Names, msg, reinterpret_cast<void *>(msgid));
1.34 }
1.35 -
1.36 - return INVALID_MESSAGE_ID;
1.37 }
1.38
1.39 return msgid;
1.40 }
1.41
1.42 -bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlen) const
1.43 -{
1.44 - int dummy;
1.45 -
1.46 - return gamedll->GetUserMessageInfo(msgid, buffer, maxlen, dummy);
1.47 -}
1.48 -
1.49 bf_write *UserMessages::StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags)
1.50 {
1.51 bf_write *buffer;