Skip to content

Commit

Permalink
PUBLIC_MODE 時に Log.LapTime を設定するとアクセスバイオレーションを起こすのを修正
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/yoshi/.svnrepos/vsd/trunk@576 177d47f1-6453-0410-9475-f12f96c2b1a2
  • Loading branch information
yoshinrt committed Mar 22, 2013
1 parent b894f5c commit 9db573d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
28 changes: 17 additions & 11 deletions vsd_filter/CVsdFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,28 @@ double CVsdFilter::LapNum2LogNum( CVsdLog* Log, int iLapNum ){
if( iLapNum < 0 ) return 0;

if( m_LapLog->m_iLapMode == LAPMODE_MAGNET ){
// fLogNum は VSD ログ番号
if( Log == m_VsdLog ) return m_LapLog->m_Lap[ iLapNum ].fLogNum;
if( VsdSt == VsdEd ) return 0;

// 一旦ビデオフレームに変換
dFrame =
( m_VsdLog->Time( m_LapLog->m_Lap[ iLapNum ].fLogNum ) * SLIDER_TIME - VsdSt ) /
( VsdEd - VsdSt ) * ( VideoEd - VideoSt ) + VideoSt;

return Log->GetIndex( dFrame, VideoSt, VideoEd, GPSSt, GPSEd, -1 );

#ifdef PUBLIC_MODE
// ここを通るのは ラップ番号(GPS)→GPS ログ番号 しかありえない
return m_LapLog->m_Lap[ iLapNum ].fLogNum;
#else
// fLogNum は VSD ログ番号
if( Log == m_VsdLog ) return m_LapLog->m_Lap[ iLapNum ].fLogNum;
if( VsdSt == VsdEd ) return 0;

// ラップ番号(VSD)→GPS ログ番号に変換
// 一旦ビデオフレームに変換
dFrame =
( m_VsdLog->Time( m_LapLog->m_Lap[ iLapNum ].fLogNum ) * SLIDER_TIME - VsdSt ) /
( VsdEd - VsdSt ) * ( VideoEd - VideoSt ) + VideoSt;

return Log->GetIndex( dFrame, VideoSt, VideoEd, GPSSt, GPSEd, -1 );
#endif
}else if( m_LapLog->m_iLapMode != LAPMODE_HAND_VIDEO ){
// fLogNum は GPS ログ番号
if( Log == m_GPSLog ) return m_LapLog->m_Lap[ iLapNum ].fLogNum;
if( GPSSt == GPSEd ) return 0;

// ラップ番号(GPS)→VSD ログ番号に変換
// 一旦ビデオフレームに変換
dFrame =
( Log->Time( m_LapLog->m_Lap[ iLapNum ].fLogNum ) * SLIDER_TIME - VsdSt ) /
Expand Down
10 changes: 7 additions & 3 deletions vsd_filter/CVsdFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@
#define SelectLogGPS ( m_CurLog = m_GPSLog ? m_GPSLog : m_VsdLog )

// Laptime 計算用
#define SelectLogForLapTime ( m_CurLog = \
m_LapLog && m_LapLog->m_iLapMode == LAPMODE_MAGNET \
? m_VsdLog : m_GPSLog )
#ifdef PUBLIC_MODE
#define SelectLogForLapTime ( m_CurLog = m_GPSLog )
#else
#define SelectLogForLapTime ( m_CurLog = \
m_LapLog && m_LapLog->m_iLapMode == LAPMODE_MAGNET \
? m_VsdLog : m_GPSLog )
#endif

/*** track / check ID *******************************************************/

Expand Down
4 changes: 2 additions & 2 deletions vsd_filter/CVsdFilterDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ void CVsdFilter::DrawLapTime(

if( m_LapLog->m_iBestTime >= 0 ){
m_iTextPosY += Font.GetHeight() / 4;

// Best 表示
swprintf(
szBuf, sizeof( szBuf ), L"Best%2d'%02d.%03d",
Expand All @@ -1118,7 +1118,7 @@ void CVsdFilter::DrawLapTime(
m_LapLog->m_iBestTime % 1000
);
DrawTextAlign( POS_DEFAULT, POS_DEFAULT, uAlign, szBuf, Font, uColor, uColorOutline );

// Lapタイム表示
DrawLapTimeLog(
m_iTextPosX, m_iTextPosY, uAlign,
Expand Down

0 comments on commit 9db573d

Please sign in to comment.