Skip to content

Commit

Permalink
DrawAreaBase: Modify loop to return the variable value just as it is (#…
Browse files Browse the repository at this point in the history
…976)

構造体のリストを走査して条件を満たしたとき返す値を固定値で
補正していましたがリストの前後要素を一時変数に保持しておくことで
変数値をそのまま返すように修正します。

Co-authored-by: JD Project <jd.project@acc574344b8506f1335297eaa7f74be0f7ea992b>
  • Loading branch information
ma8ma and JD Project committed May 14, 2022
1 parent 13d012e commit bd9380c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/article/drawareabase.cpp
Expand Up @@ -510,13 +510,15 @@ int DrawAreaBase::get_current_res_num() const

// 先頭のヘッダブロックから順に調べる
const LAYOUT* header = m_layout_tree->top_header();
while( header ){
const LAYOUT* next_header = header ? header->next_header : nullptr;
while( next_header ){

// y が含まれているブロックを探す
if( header->rect->y >= y ) return header->res_number -1;
if( next_header->rect->y >= y ) return header->res_number;

// 次のブロックへ
header = header->next_header;
header = next_header;
next_header = header->next_header;
}

return max_number();
Expand Down

0 comments on commit bd9380c

Please sign in to comment.