Improve error handling in LoadBinaryGfx by checking palette application status before rendering

This commit is contained in:
scawful
2024-12-31 17:40:41 -05:00
parent aece708513
commit daad7a4731

View File

@@ -560,9 +560,11 @@ void ScreenEditor::LoadBinaryGfx() {
gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000), gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000),
converted_bin.begin() + ((i + 1) * 0x1000)); converted_bin.begin() + ((i + 1) * 0x1000));
sheets_.emplace(i, gfx::Bitmap(128, 32, 8, gfx_sheets[i])); sheets_.emplace(i, gfx::Bitmap(128, 32, 8, gfx_sheets[i]));
sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3)); status_ = sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3));
if (status_.ok()) {
Renderer::GetInstance().RenderBitmap(&sheets_[i]); Renderer::GetInstance().RenderBitmap(&sheets_[i]);
} }
}
binary_gfx_loaded_ = true; binary_gfx_loaded_ = true;
} else { } else {
status_ = absl::InternalError("Failed to load dungeon map tile16"); status_ = absl::InternalError("Failed to load dungeon map tile16");