TurnAround.txt
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:1k
- dirtest = true;
- // Count a integer step
- rt_mobile = m_ppTanks[i]->GetRect();
- step = m_ppTanks[i]->GetDirectionUnit();
- if ( step.y != 0 ) {
- residue = m_ppTanks[i]->GetTop() % DEFTURNSTEP;
- if ( residue == 0 )
- dirtest = false;
- else if ( residue > DEFTURNSTEP/2 ) { // down
- residue = DEFTURNSTEP - residue;
- rt_mobile.top += residue;
- rt_mobile.bottom += residue;
- } else { // up
- rt_mobile.top -= residue;
- rt_mobile.bottom -= residue;
- }
- } else if ( step.x != 0 ) {
- residue = m_ppTanks[i]->GetLeft() % DEFTURNSTEP;
- if ( residue == 0 )
- dirtest = false;
- else if ( residue > DEFTURNSTEP/2 ) { // right
- residue = DEFTURNSTEP - residue;
- rt_mobile.left += residue;
- rt_mobile.right += residue;
- } else { // left
- rt_mobile.left -= residue;
- rt_mobile.right -= residue;
- }
- }
- // Test if it can move
- if ( dirtest ) {
- MapInfo.ColRToMobile( rt_mobile, step, (CMobileObject **)m_ppTanks, 10, i,
- m_ppTanks[i]->m_uiTeamType, false, hit );
- if ( hit < 0 )
- m_ppTanks[i]->SetPos( rt_mobile.left, rt_mobile.top );
- }