• R/O
  • HTTP
  • SSH
  • HTTPS

GVONavish: Commit

大航海時代Onlineのプレイを少しだけ助けてくれるツール。


Commit MetaInfo

Revisioncb7d5d7a7f1e20d6b54292916329980d3b94c7dc (tree)
Time2014-03-10 17:23:49
AuthorMandhelingFreak <mandheling30-freak@yaho...>
CommiterMandhelingFreak

Log Message

航行距離のデータ形式をdoubleに変更。少しは誤差が少なくなると思う。
最新航路を直前の航路と接続するボタンを設置。今の仕様だと頻繁に航路が途切れるので利便性向上を図る。
その他、少し気になるところを修正。

Change Summary

Incremental Difference

--- a/GVONavish/GVONavish/GVONavish.cpp
+++ b/GVONavish/GVONavish/GVONavish.cpp
@@ -574,7 +574,6 @@ static void s_onPaint( HWND hwnd )
574574 #ifdef GVO_PERF_CHECK
575575 const int64_t perfBegin = g_queryPerformanceCounter();
576576 #endif
577-
578577 s_renderer.render( s_latestShipVector, s_latestShipVelocity, s_shipTexture.get(), s_shipRouteList.get() );
579578 ::ValidateRect( hwnd, NULL );
580579
@@ -642,7 +641,7 @@ static void s_updateFrame( HWND hwnd )
642641 s_latestShipVelocity = status.m_shipVelocity;
643642 s_config.m_initialSurveyCoord = s_latestSurveyCoord;
644643 s_renderer.setShipPositionInWorld( s_latestSurveyCoord );
645- if ( (s_latestTimeStamp + k_surveyCoordLostThreshold) <= status.m_timeStamp ) {
644+ if ( (s_latestTimeStamp + k_surveyCoordLostThreshold) < status.m_timeStamp ) {
646645 s_closeShipRoute();
647646 }
648647 s_latestTimeStamp = status.m_timeStamp;
--- a/GVONavish/GVONavish/GVONavish.rc
+++ b/GVONavish/GVONavish/GVONavish.rc
@@ -80,8 +80,8 @@ CAPTION "
8080 FONT 11, "MS UI Gothic", 400, 0, 128
8181 {
8282 ICON IDR_MAINFRAME, IDC_STATIC, 14, 14, 16, 17, SS_ICON, WS_EX_LEFT
83- CONTROL "GVONavish, Version 1.0", IDC_VERSION_LABEL, WC_STATIC, SS_LEFTNOWORDWRAP | SS_NOPREFIX, 42, 14, 149, 8, WS_EX_LEFT
84- CONTROL "Copyright (C) 2014", IDC_COPYRIGHT_LABEL, WC_STATIC, SS_LEFTNOWORDWRAP, 42, 26, 149, 8, WS_EX_LEFT
83+ CONTROL "GVONavish, Version 1.0", IDC_VERSION_LABEL, WC_STATIC, NOT WS_GROUP | SS_LEFTNOWORDWRAP | SS_NOPREFIX, 42, 14, 149, 8, WS_EX_LEFT
84+ CONTROL "Copyright (C) 2014", IDC_COPYRIGHT_LABEL, WC_STATIC, NOT WS_GROUP | SS_LEFTNOWORDWRAP, 42, 26, 149, 8, WS_EX_LEFT
8585 DEFPUSHBUTTON "OK", IDOK, 141, 52, 50, 14, WS_GROUP, WS_EX_LEFT
8686 LTEXT "http://gvonavish.sourceforge.jp/", 0, 42, 39, 149, 8, SS_LEFT, WS_EX_LEFT
8787 }
@@ -95,9 +95,10 @@ EXSTYLE WS_EX_WINDOWEDGE
9595 CAPTION "航路管理ウィンドウ"
9696 FONT 11, "MS UI Gothic"
9797 {
98- PUSHBUTTON "航路選択を解除する", IDM_DESELECT_ROUTE, 7, 7, 68, 14, 0, WS_EX_LEFT
99- PUSHBUTTON "設定", IDM_ROUTE_MANAGE_OPTION, 179, 7, 28, 14, NOT WS_VISIBLE | WS_GROUP, WS_EX_LEFT
100- CONTROL "", IDC_SHIPROUTELIST, WC_LISTVIEW, WS_GROUP | WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_SINGLESEL | LVS_REPORT, 0, 26, 214, 89, WS_EX_LEFT
98+ PUSHBUTTON "選択解除", IDM_DESELECT_ROUTE, 3, 3, 35, 14, 0, WS_EX_LEFT
99+ PUSHBUTTON "設定", IDM_ROUTE_MANAGE_OPTION, 183, 3, 28, 14, NOT WS_VISIBLE | WS_GROUP, WS_EX_LEFT
100+ CONTROL "", IDC_SHIPROUTELIST, WC_LISTVIEW, WS_GROUP | WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_SINGLESEL | LVS_REPORT, 0, 22, 214, 93, WS_EX_LEFT
101+ PUSHBUTTON "最新航路を直前航路と接続", IDM_JOINT_LATEST_ROUTE, 40, 3, 90, 14, 0, WS_EX_LEFT
101102 }
102103
103104
--- a/GVONavish/GVONavish/GVORenderer.cpp
+++ b/GVONavish/GVONavish/GVORenderer.cpp
@@ -79,14 +79,18 @@ void GVORenderer::setupGL()
7979 ::glDisable( GL_LIGHTING );
8080 ::glEnable( GL_CULL_FACE );
8181 ::glCullFace( GL_BACK );
82+ ::wglMakeCurrent( NULL, NULL );
8283 }
8384
8485
8586 void GVORenderer::setWorldMap( const GVOWorldMap * worldMap )
8687 {
88+ ::wglMakeCurrent( m_hdcPrimary, m_hglrc );
8789 m_worldMap = worldMap;
8890 m_worldMapTexture = new GVOTexture();
8991 m_worldMapTexture->setImage( worldMap->image() );
92+ ::glFlush();
93+ ::wglMakeCurrent( NULL, NULL );
9094 }
9195
9296
@@ -98,6 +102,8 @@ void GVORenderer::setViewSize( const SIZE& viewSize )
98102 ::glLoadIdentity();
99103 ::glViewport( 0, 0, m_viewSize.cx, m_viewSize.cy );
100104 ::gluOrtho2D( 0, m_viewSize.cx, m_viewSize.cy, 0 );
105+ ::glFlush();
106+ ::wglMakeCurrent( NULL, NULL );
101107 }
102108
103109
@@ -501,6 +507,7 @@ GVOTexture * GVORenderer::createTextureFromImage( const GVOImage & image )
501507 ::wglMakeCurrent( m_hdcPrimary, m_hglrc );
502508 std::auto_ptr<GVOTexture> texture( new GVOTexture() );
503509 texture->setImage( image );
510+ ::glFlush();
504511 ::wglMakeCurrent( NULL, NULL );
505512
506513 return texture.release();
--- a/GVONavish/GVONavish/GVOShipRoute.cpp
+++ b/GVONavish/GVONavish/GVOShipRoute.cpp
@@ -32,7 +32,7 @@ void GVOShipRoute::addRoutePoint( const GVONormalizedPoint & point )
3232 }
3333
3434 GVOVector vector( s_denormalizedPoint( line.back() ), s_denormalizedPoint( point ) );
35- m_length += static_cast<int64_t>(::round( vector.length() ));
35+ m_length += vector.length();
3636
3737 const GVONormalizedPoint & prevPoint = line.back();
3838 if ( prevPoint.isEqualValue( point ) ) {
@@ -93,7 +93,7 @@ void GVOShipRoute::jointPreviousLinesWithRoute( const GVOShipRoute & srcRoute )
9393
9494 // 航路間の長さを足す
9595 const double betweenLength = GVOVector( s_denormalizedPoint( prevPoint ), s_denormalizedPoint( nextPoint ) ).length();
96- m_length += static_cast<int64_t>(::round( betweenLength ));
96+ m_length += betweenLength;
9797
9898 // 世界を跨いでいないようなら線を接続する
9999 if ( (std::max( prevPoint.x(), nextPoint.x() ) - std::min(prevPoint.x(), nextPoint.x())) < k_worldLoopThreshold ) {
--- a/GVONavish/GVONavish/GVOShipRoute.h
+++ b/GVONavish/GVONavish/GVOShipRoute.h
@@ -9,7 +9,7 @@ public:
99 typedef std::deque<Line> Lines;
1010 private:
1111 Lines m_lines;
12- int64_t m_length = 0;
12+ double m_length = 0.0;
1313 bool m_favorite = false;
1414 bool m_hilight = false;
1515 bool m_fixed = false; //!<@brief 航路固定フラグ
@@ -74,7 +74,7 @@ public:
7474 m_fixed = isFixed;
7575 }
7676
77- int64_t length() const
77+ double length() const
7878 {
7979 return m_length;
8080 }
--- a/GVONavish/GVONavish/GVOShipRouteList.cpp
+++ b/GVONavish/GVONavish/GVOShipRouteList.cpp
@@ -96,11 +96,16 @@ void GVOShipRouteList::joinPreviousRouteAtReverseIndex( int reverseIndex )
9696 GVOShipRoutePtr prevRoute = *itPrev;
9797
9898 m_shipRouteList.erase( itPrev );
99+
100+ // removeした時に通知ハンドラで属性が変更されてしまうので、
101+ // この時点で強調属性を保存しておく。
102+ bool isHilight = prevRoute->isHilight() | baseRoute->isHilight();
99103 if ( m_observer ) {
100104 m_observer->onShipRouteListRemoveItem( prevRoute );
101105 }
102106
103107 baseRoute->jointPreviousLinesWithRoute( *prevRoute );
108+ baseRoute->setHilight( isHilight );
104109
105110 // 通知
106111 if ( m_observer ) {
--- a/GVONavish/GVONavish/GVOShipRouteManageView.cpp
+++ b/GVONavish/GVONavish/GVOShipRouteManageView.cpp
@@ -66,6 +66,10 @@ void GVOShipRouteManageView::onShipRouteListUpdateRoute( GVOShipRoutePtr shipRou
6666 {
6767 int reverseIndex = m_routeList->reverseIndexFromShipRoute( shipRoute );
6868 if ( 0 <= reverseIndex ) {
69+ if ( shipRoute->isHilight() ) {
70+ selectRow( m_selectionIndex, false );
71+ selectRow( reverseIndex, true );
72+ }
6973 ListView_RedrawItems( m_listViewCtrl, reverseIndex, reverseIndex );
7074 }
7175 }
@@ -169,6 +173,11 @@ void GVOShipRouteManageView::onCommand( WORD eventCode, WORD cmdId, HANDLE ctrl
169173 ListView_RedrawItems( m_listViewCtrl, m_selectionIndex, m_selectionIndex );
170174 }
171175 break;
176+ case IDM_JOINT_LATEST_ROUTE:
177+ if ( 1 < m_routeList->getList().size() ) {
178+ m_routeList->joinPreviousRouteAtReverseIndex( 0 );
179+ }
180+ break;
172181 default:
173182 break;
174183 }
@@ -225,7 +234,7 @@ void GVOShipRouteManageView::onNotify( LPNMHDR nmh )
225234 //std::vector<wchar_t> buf( 4096 );
226235 //::swprintf( &buf[0], buf.size(), L"%.1f km", length );
227236 //str = &buf[0];
228- str = std::to_wstring( route->length() );
237+ str = std::to_wstring( static_cast<int>(::round( route->length() )) );
229238 }
230239 break;
231240 default:
@@ -338,5 +347,8 @@ void GVOShipRouteManageView::updateVisibleListItemCount()
338347
339348 void GVOShipRouteManageView::selectRow( int index, bool isSelection )
340349 {
350+ if ( index < 0 ) {
351+ return;
352+ }
341353 ListView_SetItemState( m_listViewCtrl, index, isSelection ? LVIS_SELECTED : 0, LVIS_SELECTED );
342354 }
--- a/GVONavish/GVONavish/Resource.h
+++ b/GVONavish/GVONavish/Resource.h
@@ -33,3 +33,4 @@
3333 #define IDM_DESELECT_ROUTE 40019
3434 #define IDM_DEBUG_CLOSE_ROUTE 40020
3535 #define IDM_TOGGLE_FAVORITE 40021
36+#define IDM_JOINT_LATEST_ROUTE 40022
Show on old repository browser