#apply
#include "../_include.txt"

/*
@param
代入先の文字列変数
行数
*/
cev[CEV_PB_GET_RANKING_STR] .name(">>>ランキング文字列を取得する") {
    defv {
        a_pos = TV_PB_GET_RANKING_STR
        a_line

        idx
        vid
        tid
        bit
    }

    deft {
        strScore = TS_PB_GET_RANKING_STR
        strTimer
        strBest
        strPrevious
        strCurrent
    }

    @loop 3 .dst(idx) bl {
        vid = [__id(pbBestScore), __id(pbPreviousScore), __id(pbCurrentScore)][idx]
        tid = [__id(strBest), __id(strPrevious), __id(strCurrent)][idx]

        //スコア(半角空白で埋める)
        strScore.asg(v[vid])
        strScore.asg(strScore .min(8))
        //時間
        getTimerString(0, __id(strTimer), v[vid+1])

        //統合する
        t[tid].asg(__str("\c[7]\", strScore, "  \c[0]\", strTimer) .extract)
    }

    //現在、過去、最良
    t[a_pos].asg("         \c[5]SCORE     TIME")
    @if a_line >= 3 bl {
        t[a_pos].cat(__str(NEWLINE, " \c[2]今の    \", strCurrent) .extract)
    }
    @if a_line >= 2 bl {
        t[a_pos].cat(__str(NEWLINE, " \c[2]前の    \", strPrevious) .extract)
    }
    @if a_line >= 1 bl {
        t[a_pos].cat(__str(NEWLINE, " \c[2]ベスト  \",strBest) .extract)
    }

    //使用した文字列を初期化する
    t[__id(strScore)..__id(strCurrent)].asg("")
}