#include "StdAfx.h" #include "DnDungeonHistory.h" #include "DnGameTask.h" #include "DnWorld.h" #include "DnWorldGrid.h" #include "DnWorldSector.h" #include "DnWorldActProp.h" CDnDungeonHistory::CDnDungeonHistory( CDnGameTask *pTask ) { m_pGameTask = pTask; m_nRandomSeed = 0; } CDnDungeonHistory::~CDnDungeonHistory() { SAFE_DELETE_VEC( m_dwMapLiveUnitList ); for( DWORD i=0; iGetRoom(); int nRoomID = pRoom->GetRoomID(); DWORD dwCount = (DWORD)CDnActor::s_pVecProcessList[nRoomID].size(); for( DWORD i=0; iGetMySmartPtr(); if( !hActor ) continue; if( hActor->IsDie() ) continue; m_dwMapLiveUnitList.insert( make_pair(hActor->GetUniqueID(), hActor->GetUniqueID()) ); } // ±×´ã Ǫ¶ø for( DWORD j=0; jGetActiveSectorCount(); j++ ) { CDnWorldSector *pSector = (CDnWorldSector *)CDnWorld::GetInstance(pRoom).GetGrid()->GetActiveSector(j); dwCount = pSector->GetPropCount(); SectorStruct Struct; Struct.Index = pSector->GetIndex(); for( DWORD i=0; iGetPropFromIndex(i))->GetMySmartPtr(); if( !hProp ) continue; DWORD dwActionIndex = -1; switch( hProp->GetPropType() ) { case PTE_Static: continue; case PTE_Light: continue; case PTE_Trap: continue; case PTE_Action: case PTE_Broken: case PTE_Operation: case PTE_Chest: dwActionIndex = ((CDnWorldActProp*)hProp.GetPointer())->GetElementIndex( ((CDnWorldActProp*)hProp.GetPointer())->GetCurrentAction() ); break; } Struct.dwMapLivePropList.insert( make_pair(hProp->GetCreateUniqueID(), dwActionIndex) ); } m_VecLiveSectorList.push_back( Struct ); } return true; } bool CDnDungeonHistory::Recovery() { CMultiRoom *pRoom = m_pGameTask->GetRoom(); int nRoomID = pRoom->GetRoomID(); DWORD dwCount = (DWORD)CDnActor::s_pVecProcessList[nRoomID].size(); std::map::iterator it; // À¯´Ö »ì¸®±¸ for( DWORD i=0; iGetMySmartPtr(); if( !hActor ) continue; it = m_dwMapLiveUnitList.find( hActor->GetUniqueID() ); if( it != m_dwMapLiveUnitList.end() ) continue; hActor->SetDestroy(); } // ÇÁ¶ø »ì¸®±¸. for( DWORD j=0; jGetActiveSectorCount(); j++ ) { CDnWorldSector *pSector = (CDnWorldSector *)CDnWorld::GetInstance(pRoom).GetGrid()->GetActiveSector(j); dwCount = pSector->GetPropCount(); SectorStruct *pStruct = NULL; for( DWORD k=0; kGetIndex() ) { pStruct = &m_VecLiveSectorList[k]; break; } } if( pStruct == NULL ) continue; for( DWORD i=0; iGetPropFromIndex(i))->GetMySmartPtr(); if( !hProp ) continue; switch( hProp->GetPropType() ) { case PTE_Static: continue; case PTE_Trap: continue; case PTE_Light: continue; case PTE_Action: case PTE_Broken: case PTE_Operation: case PTE_Chest: break; } it = pStruct->dwMapLivePropList.find( hProp->GetCreateUniqueID() ); if( it != pStruct->dwMapLivePropList.end() ) continue; SAFE_RELEASE_SPTR( hProp ); i--; } } return true; }