fix: 修复自动战斗在干员过多(14个及以上)时的崩溃问题

fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1122
This commit is contained in:
MistEO
2022-07-24 16:51:24 +08:00
parent fc3915a6ed
commit 847270cd78

View File

@@ -132,6 +132,9 @@ bool asst::BattleImageAnalyzer::opers_analyze()
for (const MatchRect& flag_mrect : flags_analyzer.get_result()) {
BattleRealTimeOper oper;
oper.rect = flag_mrect.rect.move(click_move);
if (oper.rect.x + oper.rect.width >= m_image.cols) {
oper.rect.width = m_image.cols - oper.rect.x;
}
oper.avatar = m_image(utils::make_rect<cv::Rect>(oper.rect));
Rect available_rect = flag_mrect.rect.move(avlb_move);
@@ -147,6 +150,9 @@ bool asst::BattleImageAnalyzer::opers_analyze()
#endif
Rect cooling_rect = flag_mrect.rect.move(cooling_move);
if (cooling_rect.x + cooling_rect.width >= m_image.cols) {
cooling_rect.width = m_image.cols - cooling_rect.x;
}
oper.cooling = oper_cooling_analyze(cooling_rect);
if (oper.cooling && oper.available) {
Log.error("oper is available, but with cooling");