Decompile fn_10763 (UIEditCtrl3::ExtractItemLink)
Batch #9025 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_10763 UIEditCtrl3::ExtractItemLink: logic confirmed by peer review Peer-reviewed-by: eAthena, System4z 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
4deff9e985
commit
ca9aff1bbb
2 changed files with 49 additions and 0 deletions
|
|
@ -7334,3 +7334,51 @@ void UIMerchantItemShopWnd::Paint() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00857B60
|
||||
// FUNCTION: fn_10763
|
||||
bool UIEditCtrl3::ExtractItemLink(std::string& text, std::string& link, int& position, const char* source) {
|
||||
std::size_t close = text.find(g_itemLinkClose);
|
||||
if (close == std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
do {
|
||||
text = text.substr(0, close);
|
||||
std::size_t open = text.find(g_itemLinkOpen);
|
||||
if (close != std::string::npos && open == std::string::npos) {
|
||||
position += g_itemLinkClose.size();
|
||||
text = source;
|
||||
text = text.substr(position);
|
||||
return true;
|
||||
}
|
||||
|
||||
close = text.find(g_itemLinkClose);
|
||||
if (open != std::string::npos) {
|
||||
for (;;) {
|
||||
position += open;
|
||||
text = text.substr(open + g_itemLinkOpen.size());
|
||||
open = text.find(g_itemLinkOpen);
|
||||
close = text.find(g_itemLinkClose);
|
||||
if (open == std::string::npos) {
|
||||
break;
|
||||
}
|
||||
|
||||
position += g_itemLinkOpen.size();
|
||||
}
|
||||
|
||||
link = text;
|
||||
text = source;
|
||||
std::string name = "";
|
||||
if (!this->LinkDisplayName(link, name)) {
|
||||
position += link.size() + g_itemLinkOpen.size() + g_itemLinkClose.size();
|
||||
text = text.substr(position);
|
||||
return true;
|
||||
}
|
||||
|
||||
text = text.substr(position + link.size() + g_itemLinkOpen.size() + g_itemLinkClose.size());
|
||||
}
|
||||
} while (close != std::string::npos);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ public:
|
|||
int DecodeLinkCards(std::vector<int>& fields, const char* text, int& position, const char& separator, const int& length, int index);
|
||||
void DecodeLinkFields(const std::string& link, std::vector<int>& fields);
|
||||
bool LinkDisplayName(const std::string& encoded, std::string& output);
|
||||
bool ExtractItemLink(std::string& text, std::string& link, int& position, const char* source);
|
||||
|
||||
/* 011C */ std::list<std::vector<UIItemTagButton*>> entries;
|
||||
/* 0124 */ std::vector<std::string> pendingText;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue