1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-04 18:43:11 +00:00

Fix color

This commit is contained in:
SkyHasACat 2025-07-05 09:17:25 -05:00 committed by Evil Eye
parent 0acde006a0
commit 944985e1ce

View file

@ -46,13 +46,8 @@ namespace MWLua
= [](const ESM::Region& rec) -> std::string { return "ESM3_Region[" + rec.mId.toDebugString() + "]"; };
regionT["id"] = sol::readonly_property([](const ESM::Region& rec) { return rec.mId.serializeText(); });
regionT["name"] = sol::readonly_property([](const ESM::Region& rec) -> std::string_view { return rec.mName; });
regionT["mapColor"] = sol::readonly_property([](const ESM::Region& rec) -> Misc::Color {
uint32_t c = rec.mMapColor;
float r = ((c >> 16) & 0xFF) / 255.f;
float g = ((c >> 8) & 0xFF) / 255.f;
float b = (c & 0xFF) / 255.f;
return Misc::Color(r, g, b, 1.f); // assume alpha = 1.0
});
regionT["mapColor"] = sol::readonly_property(
[](const ESM::Region& rec) -> Misc::Color { return Misc::Color::fromRGB(rec.mMapColor); });
regionT["sleepList"]
= sol::readonly_property([](const ESM::Region& rec) { return rec.mSleepList.serializeText(); });