Infinity: Early out instead of scope

This commit is contained in:
Megamouse 2024-08-04 12:25:32 +02:00
parent 09ead1b6ea
commit 7fa2987bb9

View File

@ -276,8 +276,11 @@ bool infinity_base::remove_figure(u8 position)
std::lock_guard lock(infinity_mutex);
infinity_figure& figure = figures[position];
if (figure.present)
if (!figure.present)
{
return false;
}
position = derive_figure_position(position);
if (position == 0)
{
@ -286,8 +289,7 @@ bool infinity_base::remove_figure(u8 position)
figure.present = false;
std::array<u8, 32> figure_change_response = {0xab, 0x04, position, 0x09, figure.order_added,
0x01};
std::array<u8, 32> figure_change_response = {0xab, 0x04, position, 0x09, figure.order_added, 0x01};
figure_change_response[6] = generate_checksum(figure_change_response, 6);
m_figure_added_removed_responses.push(figure_change_response);
@ -295,8 +297,6 @@ bool infinity_base::remove_figure(u8 position)
figure.inf_file.close();
return true;
}
return false;
}
u32 infinity_base::load_figure(const std::array<u8, 0x14 * 0x10>& buf, fs::file in_file, u8 position)
{