Decompile 9 functions in Source/Contents/GuildInfo.cpp, Source/Contents/GuildInfo.h, ...
Batch #4413 by eAthena: 0 byte-identical, 9 confirmed by peer review. - fn_18040 GuildInfo::HasRelatedGuild: logic confirmed by peer review - fn_18041 GuildInfo::UpdateMemberExpRatios: logic confirmed by peer review - fn_18043 GuildInfo::DeleteMember: logic confirmed by peer review - fn_18045 GuildInfo::UpdateMemberStatus: logic confirmed by peer review - fn_18046 GuildInfo::SetMemberOnline: logic confirmed by peer review - fn_18047 GuildInfo::SetMasterCharacterId: logic confirmed by peer review - fn_18048 GuildInfo::UpdateUnknown00D4: logic confirmed by peer review - fn_18052 CGuildTip::GetTipList: logic confirmed by peer review - fn_18053 CGuildTip::Load: logic confirmed by peer review Peer-reviewed-by: alisonrag, youko, KWDev Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/Contents/GuildTip.cpp
This commit is contained in:
parent
b51e87ee7d
commit
e5cd382eb5
5 changed files with 247 additions and 3 deletions
87
Source/Contents/GuildTip.cpp
Normal file
87
Source/Contents/GuildTip.cpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#include "Contents/GuildTip.h"
|
||||
#include "Client/Input/InputCharset.h"
|
||||
#include "Contents/Configuration/ServiceConfiguration.h"
|
||||
#include "File/File.h"
|
||||
#include "File/ResourcePath.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
// OFFSET: 0x00AE54B0
|
||||
// FUNCTION: fn_18052
|
||||
std::vector<StringList> CGuildTip::GetTipList() {
|
||||
if (this->m_bTryLoading == false) {
|
||||
this->Load();
|
||||
}
|
||||
|
||||
return this->m_tipList;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AE55B0
|
||||
// FUNCTION: fn_18053
|
||||
int CGuildTip::Load() {
|
||||
this->m_bTryLoading = true;
|
||||
char* fileBuf = nullptr;
|
||||
int fileSize = 0;
|
||||
|
||||
if (g_serviceType == 0) {
|
||||
FILE* file = std::fopen("GuildTip.txt", "r");
|
||||
|
||||
if (file == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::fseek(file, 0, SEEK_END);
|
||||
fileSize = std::ftell(file);
|
||||
fileBuf = new char[fileSize + 1];
|
||||
std::fseek(file, 0, SEEK_SET);
|
||||
std::fread(fileBuf, fileSize, 1, file);
|
||||
std::fclose(file);
|
||||
} else {
|
||||
const char* fName = g_serverLanguage->ServiceName("GuildTip.txt");
|
||||
|
||||
if (!ResourceExists(fName, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CFile fp;
|
||||
|
||||
if (!fp.Open(fName, 0, true, false)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fileSize = static_cast<int>(fp.GetSize());
|
||||
fileBuf = new char[fileSize + 1];
|
||||
fp.Read(fileBuf, fileSize);
|
||||
fp.Close();
|
||||
}
|
||||
|
||||
fileBuf[fileSize] = 0;
|
||||
|
||||
char* baseBuf = fileBuf;
|
||||
StringList tmpList;
|
||||
|
||||
for (int i = 0; i < fileSize; ++i) {
|
||||
switch (fileBuf[i]) {
|
||||
case 10: {
|
||||
fileBuf[i] = 0;
|
||||
std::string line(baseBuf);
|
||||
tmpList.push_back(line);
|
||||
baseBuf = fileBuf + i + 1;
|
||||
break;
|
||||
}
|
||||
case '#':
|
||||
fileBuf[i] = 0;
|
||||
tmpList.push_back(baseBuf);
|
||||
this->m_tipList.push_back(tmpList);
|
||||
tmpList.clear();
|
||||
baseBuf = fileBuf + i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fileBuf) {
|
||||
delete[] fileBuf;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue