1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Add int64_t support to INI parser (#12374)

This commit is contained in:
Michał Janiszewski
2020-07-25 09:37:35 +02:00
committed by GitHub
parent 6ba6184602
commit 3b60740128
5 changed files with 31 additions and 0 deletions

View File

@@ -155,6 +155,23 @@ public:
return result;
}
int64_t GetInt64(const std::string& name, int64_t defaultValue) const override
{
int64_t result = defaultValue;
std::string value;
if (TryGetString(name, &value))
{
try
{
result = std::stoll(value);
}
catch (const std::exception&)
{
}
}
return result;
}
float GetFloat(const std::string& name, float defaultValue) const override
{
float result = defaultValue;
@@ -388,6 +405,11 @@ public:
return defaultValue;
}
int64_t GetInt64([[maybe_unused]] const std::string& name, int64_t defaultValue) const override
{
return defaultValue;
}
float GetFloat([[maybe_unused]] const std::string& name, float defaultValue) const override
{
return defaultValue;