|
From: Greg <evo...@us...> - 2005-12-18 21:37:20
|
Update of /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20446/Evolution/Ulysses Modified Files: AiInterface.cpp AiInterface.h ELandscape.cpp ELandscape.h EWorldview.cpp EWorldview.h GameScreen.cpp GovernorDlg.cpp GovernorDlg.h Ulysses.dsp Log Message: ADD : process province dimensions ADD : adjust governor map to province (in dev) Index: AiInterface.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/AiInterface.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AiInterface.cpp 18 Aug 2005 13:05:48 -0000 1.14 --- AiInterface.cpp 18 Dec 2005 21:37:03 -0000 1.15 *************** *** 163,164 **** --- 163,176 ---- } } + + AgentIdentifier AiInterface::GetCartographer() + { + CommandDomain cdSearchDomain; + cdSearchDomain.SetDomain( eDomainType_country, 0 ); // country 0 (player) + cdSearchDomain.SetDomain( eDomainType_power, e_powerCartograph ); + + AiInterface aiInterface; + return aiInterface.FindInstitution( cdSearchDomain ); + + } + Index: AiInterface.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/AiInterface.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AiInterface.h 22 Jul 2005 08:10:26 -0000 1.10 --- AiInterface.h 18 Dec 2005 21:37:03 -0000 1.11 *************** *** 30,33 **** --- 30,34 ---- institutionId GetAgentPanel(); + AgentIdentifier GetCartographer(); void SubscribeNotificationsFrom( EControl *pControl, AgentIdentifier source ); Index: ELandscape.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/ELandscape.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ELandscape.cpp 13 Sep 2005 13:29:05 -0000 1.4 --- ELandscape.cpp 18 Dec 2005 21:37:03 -0000 1.5 *************** *** 481,484 **** --- 481,486 ---- } + + double ELandscape::sqx( int x, int y ) { *************** *** 948,951 **** --- 950,985 ---- } + void ELandscape::SetZoomToViewRect( GeoDimension dimLength, GeoDimension dimHeight ) + { + // 1. Process nbIteration and TileSize for the requested dimensions + // 2. Set up m_config + + int iNbrIteration; + GeoDimension dimCurrentWidth, dimCurrentHeight; + m_config.m_fTileSize = m_config.m_fMaxTileSize / 2; + + // We have set the TileSize to minimum ( max/2 ) + // Now, we try to find the NbrIteration need to have an area with the requested size + + for( iNbrIteration = 1; iNbrIteration < 999; iNbrIteration ++ ) // 999 is a protection ... + { + GetMapDimFromNbIteration( iNbrIteration, & dimCurrentWidth, & dimCurrentHeight ); + + if( (dimCurrentWidth >= dimLength) && (dimCurrentHeight >= dimHeight ) ) + { + // With iNbrIteration, we have a bigger area than requested + // Now, we increase m_fTileSize to fit exactly what we want + // rmq : m_fTileSize = zoom * m_fMaxTileSize + + double fHorZoom = ( (double) dimCurrentWidth ) / ( (double)dimLength ); // >= 1 + double fVerZoom = ( (double) dimCurrentHeight ) / ( (double)dimHeight ); // >= 1 + + SetZoom( min( fHorZoom, fVerZoom ) ); + return ; + } + } + + assert( false ); + } Index: ELandscape.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/ELandscape.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ELandscape.h 16 Dec 2005 15:46:47 -0000 1.5 --- ELandscape.h 18 Dec 2005 21:37:03 -0000 1.6 *************** *** 70,73 **** --- 70,74 ---- void ScrollView( int dx, int dy ); void ChangeMapCenter( GeoCode gc ); + void SetZoomToViewRect( GeoDimension dimLength, GeoDimension dimHeight ); void Zoom( bool bUnzoom ); *************** *** 99,103 **** void GetMapDimFromNbIteration( int iNbrIteration, GeoDimension *piMaxWidth, GeoDimension *piMaxHeight ); - // Terrain drawing methods --- 100,103 ---- Index: EWorldview.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/EWorldview.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EWorldview.cpp 16 Dec 2005 15:46:47 -0000 1.8 --- EWorldview.cpp 18 Dec 2005 21:37:03 -0000 1.9 *************** *** 535,538 **** --- 535,545 ---- } + void EWorldview::ZoomToSeeRect( GeoDimension width, GeoDimension height ) + { + m_Landscape.SetZoomToViewRect( width, height ); + Invalidate(); + } + + void EWorldview::UpdateSelectionAgent( AgentIdentifier agentSelected ) { Index: EWorldview.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/EWorldview.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EWorldview.h 16 Dec 2005 15:46:47 -0000 1.6 --- EWorldview.h 18 Dec 2005 21:37:03 -0000 1.7 *************** *** 45,48 **** --- 45,49 ---- void ScrollView( int dx, int dy ); void ChangeMapCenter( GeoCode gc ); + void ZoomToSeeRect( GeoDimension width, GeoDimension height ); void Zoom( bool bUnzoom ); Index: GameScreen.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/GameScreen.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** GameScreen.cpp 16 Dec 2005 16:20:13 -0000 1.90 --- GameScreen.cpp 18 Dec 2005 21:37:03 -0000 1.91 *************** *** 855,859 **** CGovernorDlg *pGovernorDlg = new CGovernorDlg; pNewDialog = pGovernorDlg; - pGovernorDlg->Create( this, mainAgentid ); m_dlgMinimap.Hide(); --- 855,858 ---- *************** *** 862,876 **** m_cvSystemButtons.Hide(); ! m_Worldview.SetPosition( 180, 470 ); ! m_Worldview.SetDimension( 670, 300 ); ! ! Kernel *pKernel = Kernel::LockKernel(); ! ! provinceId idProvince = mainAgentid.GetProvince(); ! assert( idProvince != INVALID_ID ); ! GeoCode gcProvinceCenter = pKernel->world.GetIProvince( idProvince )->GetIGeoProvince()->GetGeoCenter(); ! m_Worldview.ChangeMapCenter( gcProvinceCenter ); ! ! pKernel->Unlock(); break; --- 861,865 ---- m_cvSystemButtons.Hide(); ! pGovernorDlg->Create( this, mainAgentid, & m_Worldview ); break; Index: GovernorDlg.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/GovernorDlg.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** GovernorDlg.cpp 4 Dec 2005 17:35:41 -0000 1.49 --- GovernorDlg.cpp 18 Dec 2005 21:37:03 -0000 1.50 *************** *** 8,11 **** --- 8,12 ---- #include "ESliderDlg.h" #include "AGeneral.h" + #include "EWorldView.h" #define ADDBUILDINGMENU_SIZEFACTOR 512 *************** *** 19,22 **** --- 20,24 ---- Invalidate(); m_idMenuAddBuilding = INVALID_ID; + m_pWorldview = NULL; } *************** *** 25,32 **** } ! void CGovernorDlg::Create( ECanvas *pParent, AgentIdentifier agentId ) { m_agentId = agentId; m_mode = eGovernorMode_general; EDialog::Create( pParent ); --- 27,49 ---- } ! void CGovernorDlg::Create( ECanvas *pParent, AgentIdentifier agentId, EWorldview *pWorldview ) { m_agentId = agentId; m_mode = eGovernorMode_general; + m_pWorldview = pWorldview; + + // Center the wordview on the hole / on the province + + m_pWorldview->SetPosition( 180, 470 ); + m_pWorldview->SetDimension( 670, 300 ); + + AiInterface aiInterface; + + OInt oGetProvinceGeographicInfos; + oGetProvinceGeographicInfos.value = agentId.GetProvince(); + OProvinceGeoInfos& oGeoInfos = (OProvinceGeoInfos&) aiInterface.SendOrder( e_orderGetProvinceGeographicInfos, oGetProvinceGeographicInfos, aiInterface.GetCartographer() ); + + m_pWorldview->ChangeMapCenter( oGeoInfos.gcCenter ); + m_pWorldview->ZoomToSeeRect( oGeoInfos.dimWestEast, oGeoInfos.dimNorthSouth ); EDialog::Create( pParent ); Index: GovernorDlg.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/GovernorDlg.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GovernorDlg.h 4 Dec 2005 17:35:41 -0000 1.24 --- GovernorDlg.h 18 Dec 2005 21:37:03 -0000 1.25 *************** *** 16,19 **** --- 16,20 ---- #include "ELabel.h" + class EWorldview; enum eGovernorMode *************** *** 31,35 **** virtual ~CGovernorDlg(); ! void Create( ECanvas *pParent, AgentIdentifier agentId ); void OnCreate( ); virtual void OnPaint( OpenGl &gl, SDL_Rect rect ); --- 32,36 ---- virtual ~CGovernorDlg(); ! void Create( ECanvas *pParent, AgentIdentifier agentId, EWorldview * pWorldView ); void OnCreate( ); virtual void OnPaint( OpenGl &gl, SDL_Rect rect ); *************** *** 64,67 **** --- 65,70 ---- private: + EWorldview * m_pWorldview; + eGovernorMode m_mode; Index: Ulysses.dsp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/Ulysses.dsp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Ulysses.dsp 18 Aug 2005 13:05:48 -0000 1.37 --- Ulysses.dsp 18 Dec 2005 21:37:03 -0000 1.38 *************** *** 70,74 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../Sphinx" /I "../../ELib" /I "../Agamemnon" /I "../protogonos" /I "../kerberos" /I "../Ares" /I "../Atlas" /I "../Hestia" /I "../Ploutos" /I "../Apollon" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 70,74 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../Sphinx" /I "../../ELib" /I "../Agamemnon" /I "../protogonos" /I "../kerberos" /I "../Ares" /I "../Atlas" /I "../Hestia" /I "../Ploutos" /I "../Apollon" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 |