Decompile 3 functions in Source/Network/TextEncoding.h, Source/Network/TextEncoding.cpp, ...
Batch #16442 by eAthena: 1 byte-identical, 2 confirmed by peer review. - fn_16615 CUIRenewQuestUI::MatchesFilter: byte-identical - fn_02795 FindSubstring: logic confirmed by peer review - fn_16210 HighlightKeyword: logic confirmed by peer review Peer-reviewed-by: Yommy, kyoshi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
4ad7463d25
commit
0a34d86404
5 changed files with 7 additions and 13 deletions
|
|
@ -160,7 +160,7 @@ std::wstring LowercaseWide(const std::string& text) {
|
|||
|
||||
// OFFSET: 0x0058D6B0
|
||||
// FUNCTION: fn_02795
|
||||
int FindSubstring(const char* text, int codePage, const char* pattern) {
|
||||
return static_cast<int>(LowercaseWide(text).find(LowercaseWide(pattern)));
|
||||
int FindSubstring(std::string_view text, std::string_view pattern) {
|
||||
return static_cast<int>(LowercaseWide(text.data()).find(LowercaseWide(pattern.data())));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define RAGNAROK_SOURCE_NETWORK_TEXTENCODING_H
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <windows.h>
|
||||
|
||||
extern UINT g_textCodePage;
|
||||
|
|
@ -14,7 +15,7 @@ std::string ToUtf8(const std::string& text, UINT codePage);
|
|||
|
||||
void LowercaseText(std::string& text);
|
||||
std::wstring LowercaseWide(const std::string& text);
|
||||
int FindSubstring(const char* text, int codePage, const char* pattern);
|
||||
int FindSubstring(std::string_view text, std::string_view pattern);
|
||||
std::wstring DecodeText(UINT codePage, const std::string& text);
|
||||
std::string EncodeText(UINT codePage, const std::wstring& text);
|
||||
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ void CUIProbabilityTable::Search() {
|
|||
|
||||
list = this->m_list;
|
||||
auto matches = [keyword](const ProbabilityTable::CItemData& data) {
|
||||
return FindSubstring(data.name.c_str(), static_cast<int>(data.name.size()), keyword.data()) != -1;
|
||||
return FindSubstring(data.name, keyword) != -1;
|
||||
};
|
||||
|
||||
auto start = list->data.begin();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void CUIProbabilityTable::SetItem(int itemId) {
|
|||
// FUNCTION: fn_16210
|
||||
int HighlightKeyword(std::string& text, std::string_view keyword, std::string_view prefix, std::string_view suffix) {
|
||||
int count = 0;
|
||||
if (FindSubstring(text.c_str(), static_cast<int>(text.size()), keyword.data()) == -1) {
|
||||
if (FindSubstring(text, keyword) == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -961,14 +961,7 @@ bool CUIRenewQuestUI::MatchesFilter(const RenewQuestInfo& info) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!this->searchText.empty()) {
|
||||
if (FindSubstring(info.summary.c_str(), static_cast<int>(info.summary.size()), this->searchText.c_str()) == -1 &&
|
||||
FindSubstring(info.m_title.c_str(), static_cast<int>(info.m_title.size()), this->searchText.c_str()) == -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return this->searchText.empty() || FindSubstring(info.summary, this->searchText) != -1 || FindSubstring(info.m_title, this->searchText) != -1;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A660E0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue