From 5a696fb0eef95e110cf916ac47c3a2a56d364131 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Fri, 11 Aug 2023 11:55:44 +0200 Subject: [PATCH] Replace some begin/rbegin usage with front/back --- effect.cpp | 4 ++-- operations.cpp | 18 +++++++++--------- processor.cpp | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/effect.cpp b/effect.cpp index 227ef3c3..ccadf484 100644 --- a/effect.cpp +++ b/effect.cpp @@ -515,9 +515,9 @@ int32_t effect::is_chainable(uint8_t tp) { if(pduel->game_field->core.current_chain.size()) { if(!is_flag(EFFECT_FLAG_FIELD_ONLY) && (type & EFFECT_TYPE_TRIGGER_O) && (get_handler()->current.location == LOCATION_HAND)) { - if(pduel->game_field->core.current_chain.rbegin()->triggering_effect->get_speed() > 2) + if(pduel->game_field->core.current_chain.back().triggering_effect->get_speed() > 2) return FALSE; - } else if(sp < pduel->game_field->core.current_chain.rbegin()->triggering_effect->get_speed()) + } else if(sp < pduel->game_field->core.current_chain.back().triggering_effect->get_speed()) return FALSE; } for(const auto& ch_lim : pduel->game_field->core.chain_limit) { diff --git a/operations.cpp b/operations.cpp index 8770630a..228a4799 100644 --- a/operations.cpp +++ b/operations.cpp @@ -5352,9 +5352,9 @@ int32_t field::operation_replace(uint16_t step, effect* replace_effect, group* t return FALSE; } case 3: { - if(core.continuous_chain.rbegin()->target_cards) - pduel->delete_group(core.continuous_chain.rbegin()->target_cards); - for(auto& oit : core.continuous_chain.rbegin()->opinfos) { + if(core.continuous_chain.back().target_cards) + pduel->delete_group(core.continuous_chain.back().target_cards); + for(auto& oit : core.continuous_chain.back().opinfos) { if(oit.second.op_cards) pduel->delete_group(oit.second.op_cards); } @@ -5419,9 +5419,9 @@ int32_t field::operation_replace(uint16_t step, effect* replace_effect, group* t return FALSE; } case 8: { - if(core.continuous_chain.rbegin()->target_cards) - pduel->delete_group(core.continuous_chain.rbegin()->target_cards); - for(auto& oit : core.continuous_chain.rbegin()->opinfos) { + if(core.continuous_chain.back().target_cards) + pduel->delete_group(core.continuous_chain.back().target_cards); + for(auto& oit : core.continuous_chain.back().opinfos) { if(oit.second.op_cards) pduel->delete_group(oit.second.op_cards); } @@ -5536,9 +5536,9 @@ int32_t field::operation_replace(uint16_t step, effect* replace_effect, group* t return FALSE; } case 16: { - if(core.continuous_chain.rbegin()->target_cards) - pduel->delete_group(core.continuous_chain.rbegin()->target_cards); - for(auto& oit : core.continuous_chain.rbegin()->opinfos) { + if(core.continuous_chain.back().target_cards) + pduel->delete_group(core.continuous_chain.back().target_cards); + for(auto& oit : core.continuous_chain.back().opinfos) { if(oit.second.op_cards) pduel->delete_group(oit.second.op_cards); } diff --git a/processor.cpp b/processor.cpp index 1d19cfa9..d4613ad4 100644 --- a/processor.cpp +++ b/processor.cpp @@ -2705,7 +2705,7 @@ int32_t field::process_battle_command(uint16_t step) { } else if(core.tpchain.size() == 1){ core.sub_solving_event.push_back(nil_event); - add_process(PROCESSOR_EXECUTE_OPERATION, 0, core.tpchain.begin()->triggering_effect, 0, infos.turn_player, 0); + add_process(PROCESSOR_EXECUTE_OPERATION, 0, core.tpchain.front().triggering_effect, 0, infos.turn_player, 0); adjust_all(); } return FALSE;