diff --git a/src/app/editor/dungeon/dungeon_editor.cc b/src/app/editor/dungeon/dungeon_editor.cc index 6994c67c..e5a51d04 100644 --- a/src/app/editor/dungeon/dungeon_editor.cc +++ b/src/app/editor/dungeon/dungeon_editor.cc @@ -80,7 +80,7 @@ absl::Status DungeonEditor::Load() { // Load the palette group and palette for the dungeon full_palette_ = dungeon_man_pal_group[current_palette_group_id_]; ASSIGN_OR_RETURN(current_palette_group_, - gfx::CreatePaletteGroupFromLargePalette(full_palette_)) + gfx::CreatePaletteGroupFromLargePalette(full_palette_)); CalculateUsageStats(); is_loaded_ = true; diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index e46e6a9c..26da003d 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -756,7 +756,7 @@ absl::Status GraphicsEditor::DrawMemoryEditor() { absl::Status GraphicsEditor::DecompressImportData(int size) { ASSIGN_OR_RETURN(import_data_, gfx::lc_lz2::DecompressV2( - temp_rom_.data(), current_offset_, size)) + temp_rom_.data(), current_offset_, size)); auto converted_sheet = gfx::SnesTo8bppSheet(import_data_, 3); bin_bitmap_.Create(gfx::kTilesheetWidth, 0x2000, gfx::kTilesheetDepth, @@ -785,7 +785,7 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() { std::stoi(offset, nullptr, 16); // convert hex string to int ASSIGN_OR_RETURN( auto decompressed_data, - gfx::lc_lz2::DecompressV2(temp_rom_.data(), offset_value, 0x1000)) + gfx::lc_lz2::DecompressV2(temp_rom_.data(), offset_value, 0x1000)); auto converted_sheet = gfx::SnesTo8bppSheet(decompressed_data, 3); gfx_sheets_[i] = gfx::Bitmap(gfx::kTilesheetWidth, gfx::kTilesheetHeight, gfx::kTilesheetDepth, converted_sheet); @@ -810,7 +810,7 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() { std::stoi(offset, nullptr, 16); // convert hex string to int ASSIGN_OR_RETURN( auto decompressed_data, - gfx::lc_lz2::DecompressV2(temp_rom_.data(), offset_value, 0x1000)) + gfx::lc_lz2::DecompressV2(temp_rom_.data(), offset_value, 0x1000)); auto converted_sheet = gfx::SnesTo8bppSheet(decompressed_data, 3); gfx_sheets_[i] = gfx::Bitmap(gfx::kTilesheetWidth, gfx::kTilesheetHeight, gfx::kTilesheetDepth, converted_sheet); diff --git a/src/app/gfx/compression.cc b/src/app/gfx/compression.cc index 9b747a10..12d65aa2 100644 --- a/src/app/gfx/compression.cc +++ b/src/app/gfx/compression.cc @@ -760,7 +760,7 @@ absl::Status ValidateCompressionResult(CompressionPiecePointer& chain_head, RETURN_IF_ERROR( temp_rom.LoadFromData(CreateCompressionString(chain_head->next, mode))) ASSIGN_OR_RETURN(auto decomp_data, - DecompressV2(temp_rom.data(), 0, temp_rom.size())) + DecompressV2(temp_rom.data(), 0, temp_rom.size())); if (!std::equal(decomp_data.begin() + start, decomp_data.end(), temp_rom.begin())) { return absl::InternalError(absl::StrFormat( @@ -1180,7 +1180,7 @@ absl::Status ValidateCompressionResultV3(const CompressionContext& context) { Rom temp_rom; RETURN_IF_ERROR(temp_rom.LoadFromData(context.compressed_data)); ASSIGN_OR_RETURN(auto decomp_data, - DecompressV2(temp_rom.data(), 0, temp_rom.size())) + DecompressV2(temp_rom.data(), 0, temp_rom.size())); if (!std::equal(decomp_data.begin() + context.start, decomp_data.end(), temp_rom.begin())) { diff --git a/src/app/rom.cc b/src/app/rom.cc index e98a7966..cbba6161 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -46,7 +46,7 @@ absl::StatusOr> Load2BppGraphics(const Rom &rom) { rom.version_constants().kOverworldGfxPtr2, rom.version_constants().kOverworldGfxPtr3); ASSIGN_OR_RETURN(auto decomp_sheet, - gfx::lc_lz2::DecompressV2(rom.data(), offset)) + gfx::lc_lz2::DecompressV2(rom.data(), offset)); auto converted_sheet = gfx::SnesTo8bppSheet(decomp_sheet, 2); for (const auto &each_pixel : converted_sheet) { sheet.push_back(each_pixel); @@ -64,7 +64,7 @@ absl::StatusOr> LoadLinkGraphics( ASSIGN_OR_RETURN( auto link_sheet_data, rom.ReadByteVector(/*offset=*/kLinkGfxOffset + (i * kLinkGfxLength), - /*length=*/kLinkGfxLength)) + /*length=*/kLinkGfxLength)); auto link_sheet_8bpp = gfx::SnesTo8bppSheet(link_sheet_data, /*bpp=*/4); link_graphics[i].Create(gfx::kTilesheetWidth, gfx::kTilesheetHeight, gfx::kTilesheetDepth, link_sheet_8bpp); @@ -155,7 +155,7 @@ absl::StatusOr> LoadAllGraphicsData( rom.data(), i, rom.version_constants().kOverworldGfxPtr1, rom.version_constants().kOverworldGfxPtr2, rom.version_constants().kOverworldGfxPtr3); - ASSIGN_OR_RETURN(sheet, gfx::lc_lz2::DecompressV2(rom.data(), offset)) + ASSIGN_OR_RETURN(sheet, gfx::lc_lz2::DecompressV2(rom.data(), offset)); bpp3 = true; } @@ -222,6 +222,7 @@ absl::Status SaveAllGraphicsData( rom.version_constants().kOverworldGfxPtr2, rom.version_constants().kOverworldGfxPtr3); std::copy(final_data.begin(), final_data.end(), rom.begin() + offset); + std::ranges::copy(final_data, rom.begin() + offset); } } return absl::OkStatus(); @@ -551,16 +552,16 @@ absl::StatusOr Rom::ReadTile16(uint32_t tile16_id) { // Skip 8 bytes per tile. auto tpos = kTile16Ptr + (tile16_id * 0x08); gfx::Tile16 tile16 = {}; - ASSIGN_OR_RETURN(auto new_tile0, ReadWord(tpos)) + ASSIGN_OR_RETURN(auto new_tile0, ReadWord(tpos)); tile16.tile0_ = gfx::WordToTileInfo(new_tile0); tpos += 2; - ASSIGN_OR_RETURN(auto new_tile1, ReadWord(tpos)) + ASSIGN_OR_RETURN(auto new_tile1, ReadWord(tpos)); tile16.tile1_ = gfx::WordToTileInfo(new_tile1); tpos += 2; - ASSIGN_OR_RETURN(auto new_tile2, ReadWord(tpos)) + ASSIGN_OR_RETURN(auto new_tile2, ReadWord(tpos)); tile16.tile2_ = gfx::WordToTileInfo(new_tile2); tpos += 2; - ASSIGN_OR_RETURN(auto new_tile3, ReadWord(tpos)) + ASSIGN_OR_RETURN(auto new_tile3, ReadWord(tpos)); tile16.tile3_ = gfx::WordToTileInfo(new_tile3); return tile16; } diff --git a/src/app/rom.h b/src/app/rom.h index ac7adec2..f9256408 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -180,7 +180,7 @@ class Rom { auto end() { return rom_data_.end(); } auto vector() const { return rom_data_; } auto filename() const { return filename_; } - auto set_filename(std::string name) { filename_ = name; } + auto set_filename(std::string_view name) { filename_ = name; } auto short_name() const { return short_name_; } auto graphics_buffer() const { return graphics_buffer_; } auto mutable_graphics_buffer() { return &graphics_buffer_; } diff --git a/src/app/zelda3/screen/inventory.cc b/src/app/zelda3/screen/inventory.cc index bed9b35d..6c591ee0 100644 --- a/src/app/zelda3/screen/inventory.cc +++ b/src/app/zelda3/screen/inventory.cc @@ -76,7 +76,7 @@ absl::Status Inventory::Create() { absl::Status Inventory::BuildTileset() { tilesheets_.reserve(6 * 0x2000); for (int i = 0; i < 6 * 0x2000; i++) tilesheets_.push_back(0xFF); - ASSIGN_OR_RETURN(tilesheets_, Load2BppGraphics(*rom())) + ASSIGN_OR_RETURN(tilesheets_, Load2BppGraphics(*rom())); std::vector test; for (int i = 0; i < 0x4000; i++) { test_.push_back(tilesheets_[i]); diff --git a/src/util/macro.h b/src/util/macro.h index 50986c43..6c6cf0f5 100644 --- a/src/util/macro.h +++ b/src/util/macro.h @@ -65,7 +65,7 @@ if (!error_or_value.ok()) { \ return error_or_value.status(); \ } \ - type_variable_name = std::move(*error_or_value); + type_variable_name = std::move(*error_or_value) #define ASSIGN_OR_LOG_ERROR(type_variable_name, expression) \ ASSIGN_OR_LOG_ERROR_IMPL(APPEND_NUMBER(error_or_value, __LINE__), \