rodecomp/Source/Contents/Configuration/ScriptOptions.cpp
ragnarok-clanker d9878c9459 Decompile fn_23798 (CSession::GetOptionFloat)
Batch #4598 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_23798 CSession::GetOptionFloat: logic confirmed by peer review

Peer-reviewed-by: youko, Snow
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-30 05:11:41 +00:00

46 lines
1.3 KiB
C++

#include "Contents/Configuration/ScriptOptions.h"
#include "Script/LuaScript.h"
#include "Utility/GuidParse.h"
#include "Client/Session.h"
#include <cstring>
// OFFSET: 0x00E0A890
// FUNCTION: fn_23800
int ScriptOptions::Integer(const char* key, int fallback) {
int value = -1;
this->script.Call("l_GetOptionValue", "s>d", key, &value);
return value == -1 ? fallback : value;
}
// OFFSET: 0x00E0A950
// FUNCTION: fn_23801
std::string ScriptOptions::String(const char* key, const char* fallback) {
const char* value = nullptr;
this->script.Call("l_GetOptionValue", "s>s", key, &value);
return !value || std::strcmp(value, "-1") == 0 ? fallback : value;
}
// OFFSET: 0x00E0A760
// FUNCTION: fn_23799
GUID ScriptOptions::Guid(const char* key, const GUID& fallback) {
const char* value = nullptr;
this->script.Call("l_GetOptionValue", "s>s", key, &value);
if (value && std::strcmp(value, "-1") != 0) {
GUID parsed;
if (ParseGuid(value, std::strlen(value), parsed, true) == 1) {
return parsed;
}
}
return fallback;
}
// OFFSET: 0x00E0A670
// FUNCTION: fn_23798
float CSession::GetOptionFloat(const char* key, float fallback) {
double value = -1.0;
this->m_hotkeyScript->Call("l_GetOptionValue", "s>l", key, &value);
return value == -1.0 ? fallback : static_cast<float>(value);
}