mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
Now that the project targets C++23, use the standard library's std::expected instead of the vendored tl::expected polyfill: - tl::expected -> std::expected, tl::unexpected/tl::make_unexpected -> std::unexpected - .map()/.map_error() -> .transform()/.transform_error() - #include <expected.hpp> -> #include <expected>, grouped with std headers - Remove 3rdParty/tl/expected.hpp (the tl target remains for function_ref.hpp) Co-Authored-By: Claude Fable 5 <[email protected]>
27 lines
751 B
C++
27 lines
751 B
C++
#include "init.hpp"
|
|
#include "mpq/mpq_reader.hpp"
|
|
|
|
#include <jni.h>
|
|
|
|
namespace devilution {
|
|
namespace {
|
|
|
|
bool AreExtraFontsOutOfDateForMpqPath(const char *mpqPath)
|
|
{
|
|
std::expected<MpqArchive, std::string> archive = MpqArchive::Open(mpqPath);
|
|
return archive.has_value() && AreExtraFontsOutOfDate(*archive);
|
|
}
|
|
|
|
} // namespace
|
|
} // namespace devilution
|
|
|
|
extern "C" {
|
|
JNIEXPORT jboolean JNICALL Java_org_diasurgical_devilutionx_DevilutionXSDLActivity_areFontsOutOfDate(JNIEnv *env, jclass cls, jstring fonts_mpq)
|
|
{
|
|
const char *mpqPath = env->GetStringUTFChars(fonts_mpq, nullptr);
|
|
bool outOfDate = devilution::AreExtraFontsOutOfDateForMpqPath(mpqPath);
|
|
env->ReleaseStringUTFChars(fonts_mpq, mpqPath);
|
|
return outOfDate;
|
|
}
|
|
}
|