Batch #4805 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_13540 UIRoundBoxTooltipWnd::Slot15: logic confirmed by peer review - fn_13555 UIMiniMapWnd::LoadMemos: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag, Lumen, Snow, Qwenkler3.8, willerthal Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
92 lines
2.4 KiB
C++
92 lines
2.4 KiB
C++
#include "UI/Dialogs/UIEditctrlWnd.h"
|
|
|
|
#include "Client/Application/Launcher.h"
|
|
#include "Client/Mode/CGameMode.h"
|
|
#include "Client/Mode/ModeCursor.h"
|
|
#include "Client/Mode/ModeMgr.h"
|
|
#include "Client/Session.h"
|
|
#include "Contents/MessageTable.h"
|
|
#include "Contents/TownInfoMgr.h"
|
|
#include "UI/Buttons/UIBitmapButton.h"
|
|
#include "UI/Buttons/UIButton.h"
|
|
#include "UI/Dialogs/UIMiniMapWnd.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// GLOBAL: gl_24906
|
|
const char* g_miniMapMemoPath = "%s\\Memo\\$$%s.txt";
|
|
|
|
// OFFSET: 0x0099B540
|
|
|
|
// OFFSET: 0x0099BA80
|
|
// FUNCTION: fn_13555
|
|
int UIMiniMapWnd::LoadMemos() {
|
|
for (int index = 0; index < 20; ++index) {
|
|
this->memoButtons[index]->Move(-100, -100);
|
|
this->memoButtons[index]->SetTooltip("");
|
|
}
|
|
|
|
int count = 0;
|
|
const std::string path = FormatOwnedString(g_miniMapMemoPath, g_applicationDirectory, g_session.m_navigationPlayerMap);
|
|
FILE* file = std::fopen(path.c_str(), "rb");
|
|
if (file) {
|
|
char separators[] = "\t ,\t\r\n";
|
|
char line[1024];
|
|
std::memset(line, 0, sizeof(line));
|
|
std::vector<std::string> tokens;
|
|
|
|
int lineCount = 0;
|
|
while (!std::feof(file)) {
|
|
if (++lineCount >= 40 || count >= 20) {
|
|
break;
|
|
}
|
|
|
|
std::fgets(line, sizeof(line), file);
|
|
for (char* token = std::strtok(line, separators); token; token = std::strtok(nullptr, separators)) {
|
|
tokens.push_back(std::string(token));
|
|
}
|
|
|
|
if (tokens.size() >= 2) {
|
|
const int x = std::atoi(tokens[0].c_str());
|
|
const int y = std::atoi(tokens[1].c_str());
|
|
if (x <= 0 || this->geometry.width < x || y <= 0 || this->geometry.height < y) {
|
|
break;
|
|
}
|
|
|
|
std::string text;
|
|
for (unsigned index = 2; index < tokens.size(); ++index) {
|
|
if (text.size() > 30) {
|
|
break;
|
|
}
|
|
text += " ";
|
|
text += tokens[index];
|
|
}
|
|
|
|
tokens.clear();
|
|
this->memoButtons[count]->Move(x, y);
|
|
this->memoButtons[count]->SetTooltip(text.c_str());
|
|
++count;
|
|
}
|
|
}
|
|
|
|
std::fclose(file);
|
|
this->Invalidate();
|
|
}
|
|
|
|
return count;
|
|
}
|
|
|
|
// OFFSET: 0x0099C530
|
|
// FUNCTION: fn_13558
|
|
void UIEditctrlWnd::Paint() {
|
|
UIButtonContext& controls = *this->m_controls;
|
|
this->ClearSurface(0xFFFFFFFF);
|
|
this->DrawTitleBar(controls.fonts, controls.locale, true, LookupMessage(2755), 0);
|
|
}
|
|
|
|
// OFFSET: 0x0099C8A0
|