| 111 | } |
| 112 | |
| 113 | int UserMessages::GetMessageIndex(const char *msg) |
| 114 | { |
| 115 | #if SOURCE_ENGINE == SE_CSGO |
| 116 | // Can split this per engine and/or game later |
| 117 | return g_Cstrike15UsermessageHelpers.GetIndex(msg); |
| 118 | #elif SOURCE_ENGINE == SE_BLADE |
| 119 | return g_BerimbauUsermessageHelpers.GetIndex(msg); |
| 120 | #elif SOURCE_ENGINE == SE_MCV |
| 121 | return g_VietnamUsermessageHelpers.GetIndex(msg); |
| 122 | #else |
| 123 | |
| 124 | int msgid; |
| 125 | if (!m_Names.retrieve(msg, &msgid)) |
| 126 | { |
| 127 | if (m_FallbackSearch) |
| 128 | { |
| 129 | char msgbuf[64]; |
| 130 | int size; |
| 131 | msgid = 0; |
| 132 | |
| 133 | while (gamedll->GetUserMessageInfo(msgid, msgbuf, sizeof(msgbuf), size)) |
| 134 | { |
| 135 | if (strcmp(msgbuf, msg) == 0) |
| 136 | { |
| 137 | m_Names.insert(msg, msgid); |
| 138 | return msgid; |
| 139 | } |
| 140 | msgid++; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | msgid = g_SMAPI->FindUserMessage(msg); |
| 145 | |
| 146 | if (msgid != INVALID_MESSAGE_ID) |
| 147 | m_Names.insert(msg, msgid); |
| 148 | } |
| 149 | |
| 150 | return msgid; |
| 151 | #endif |
| 152 | } |
| 153 | |
| 154 | bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) const |
| 155 | { |
no test coverage detected