Decompile fn_23492 (CSession::LoadFogParameters)
Batch #7219 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23492 CSession::LoadFogParameters: logic confirmed by peer review Peer-reviewed-by: meitogi, gordaoprogramas, Lumen, aDw 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
7a8fea3edb
commit
05e9c6314f
1 changed files with 48 additions and 0 deletions
|
|
@ -778,6 +778,54 @@ void CSession::LoadDamageSkinSettings() {
|
|||
}
|
||||
|
||||
// OFFSET: 0x00DE5620
|
||||
// FUNCTION: fn_23492
|
||||
bool CSession::LoadFogParameters() {
|
||||
this->m_fogParameters.clear();
|
||||
|
||||
CFile file;
|
||||
if (!file.Open("fogParameterTable.txt", 0, true, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* cursor = static_cast<const char*>(file.GetData());
|
||||
const char* end = cursor + file.GetSize();
|
||||
std::string name;
|
||||
std::vector<std::string> values;
|
||||
|
||||
for (const char* start = cursor; cursor < end; ++cursor) {
|
||||
const char value = *cursor;
|
||||
if (value == '\n' || value == '\r') {
|
||||
start = cursor + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value != '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name.empty()) {
|
||||
name.assign(start, cursor - start);
|
||||
} else if (values.size() < 3) {
|
||||
values.push_back(std::string(start, cursor));
|
||||
} else {
|
||||
std::string last(start, cursor);
|
||||
values.push_back(last);
|
||||
this->m_fogParameters.push_back(std::make_pair(name, values));
|
||||
name.clear();
|
||||
values.clear();
|
||||
}
|
||||
|
||||
start = cursor + 1;
|
||||
}
|
||||
|
||||
std::sort(this->m_fogParameters.begin(), this->m_fogParameters.end(),
|
||||
[](const std::pair<std::string, std::vector<std::string>>& left,
|
||||
const std::pair<std::string, std::vector<std::string>>& right) {
|
||||
return std::strcmp(left.first.c_str(), right.first.c_str()) < 0;
|
||||
});
|
||||
file.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DE5B40
|
||||
// FUNCTION: fn_23493
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue