From 6324df3d0f2b0f43efbec8ba73d7772a2348d81b Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 3 May 2014 16:57:53 -0400 Subject: [PATCH 1/4] Trash cruft --- Sources/Plasma/Apps/plClient/plClient.cpp | 67 ----------------------- Sources/Plasma/Apps/plClient/plClient.h | 9 --- 2 files changed, 76 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index bdc5528d..8b72ae1f 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -1393,73 +1393,6 @@ extern bool gDataServerLocal; #include "plQuality.h" #include "plLoadMask.h" -#if 0 -class LoginNetClientCommCallback : public plNetClientComm::Callback -{ -public: - enum Op {kAuth, kCreatePlayer, kGetPlayerList, kLeave, kDeletePlayer}; - - LoginNetClientCommCallback() : plNetClientComm::Callback(), fNumCurrentOps(0) - {} - - virtual void OperationStarted( uint32_t context ) - { - fNumCurrentOps++; - } - virtual void OperationComplete( uint32_t context, int resultCode ) - { - if (context == kAuth) - { - if (hsSucceeded(resultCode)) - { - plClient::GetInstance()->fAuthPassed = true; - } - } - else if (context == kGetPlayerList) - { - if ( hsSucceeded( resultCode ) ) - { - uint32_t numPlayers = fCbArgs.GetInt(0); - uint32_t pId = -1; - std::string pName; - - for (uint32_t i = 0; i < numPlayers; i++) - { - pId = fCbArgs.GetInt((uint16_t)(i*3+1)); - pName = fCbArgs.GetString((uint16_t)(i*3+2)); - - if (pName == plClient::GetInstance()->fUsername) - { - plClient::GetInstance()->fPlayerID = pId; - break; - } - } - } - } - else if (context == kCreatePlayer) - { - if (hsSucceeded(resultCode)) - plClient::GetInstance()->fPlayerID = fCbArgs.GetInt(0); - } - else if (context == kDeletePlayer) - { - if (hsSucceeded(resultCode)) - plClient::GetInstance()->fPlayerID = -1; - } - - fNumCurrentOps--; - } - - bool IsActive() - { - return fNumCurrentOps > 0; - } - -private: - int fNumCurrentOps; -}; -#endif - //============================================================================ bool plClient::StartInit() { diff --git a/Sources/Plasma/Apps/plClient/plClient.h b/Sources/Plasma/Apps/plClient/plClient.h index 1984b041..7f4a1c80 100644 --- a/Sources/Plasma/Apps/plClient/plClient.h +++ b/Sources/Plasma/Apps/plClient/plClient.h @@ -296,15 +296,6 @@ public: void IWriteDefaultGraphicsSettings(const plFileName& destFile); plAnimDebugList *fAnimDebugList; - -#if 0 - std::string fUsername; - std::string fPasswordDigest; - std::string fServer; - int fPlayerID; - bool fRecreatePlayer; - bool fAuthPassed; -#endif }; #endif // plClient_inc From b426d2faf009228d788454f01edc2ab6a31dc3f3 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 3 May 2014 17:10:00 -0400 Subject: [PATCH 2/4] Age Loading now longer has a progress bar... ... So we don't need to show/hide the spinner... Or make the console flash. Stop aggravating me! --- Sources/Plasma/Apps/plClient/plClient.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 8b72ae1f..7e4928e5 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -1749,11 +1749,6 @@ bool plClient::IUpdate() } bool plClient::IDrawProgress() { - // HACK: Don't draw while we're caching some room loads, otherwise the - // progress bar will jump around while we're calculating the size - if (fHoldLoadRequests) - return false; - // Reset our stats plProfileManager::Instance().BeginFrame(); From 1d18288779dbc7ef8ab919b2dcbc9b25d10cbb83 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 3 May 2014 17:20:31 -0400 Subject: [PATCH 3/4] pfKI is dead, long live pfKI! --- Sources/Plasma/Apps/plClient/plClient.cpp | 9 +-------- Sources/Plasma/Apps/plClient/plClient.h | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 7e4928e5..810fb3da 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -187,7 +187,6 @@ plClient::plClient() fLinkEffectsMgr(nil), fProgressBar(nil), fGameGUIMgr(nil), - fKIGUIGlue(nil), fWindowActive(false), fAnimDebugList(nil), fClampCap(-1), @@ -346,12 +345,6 @@ bool plClient::Shutdown() if (fPageMgr) fPageMgr->Reset(); - if( fKIGUIGlue != nil ) - { - fKIGUIGlue->UnRegisterAs( kKIGUIGlue_KEY ); - fKIGUIGlue = nil; - } - if( fTransitionMgr != nil ) { fTransitionMgr->UnRegisterAs( kTransitionMgr_KEY ); @@ -1781,7 +1774,7 @@ bool plClient::IDraw() // tends to cause a device reload each frame. if (fDone) return true; - + if (plProgressMgr::GetInstance()->IsActive()) return IDrawProgress(); diff --git a/Sources/Plasma/Apps/plClient/plClient.h b/Sources/Plasma/Apps/plClient/plClient.h index 7f4a1c80..4611a01b 100644 --- a/Sources/Plasma/Apps/plClient/plClient.h +++ b/Sources/Plasma/Apps/plClient/plClient.h @@ -123,8 +123,6 @@ protected: pfConsoleEngine* fConsoleEngine; pfConsole* fConsole; - pfKI *fKIGUIGlue; - bool fDone; bool fWindowActive; From dc9497cf901520020477627ac8e919d00a7b1435 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 3 May 2014 17:57:55 -0400 Subject: [PATCH 4/4] Shutdown code de-duplication --- Sources/Plasma/Apps/plClient/plClient.cpp | 78 ++++++------------- .../PubUtilLib/plAgeLoader/plAgeLoader.cpp | 2 + .../PubUtilLib/plNetClient/plNetClientMgr.cpp | 4 + 3 files changed, 30 insertions(+), 54 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 810fb3da..10f87e0e 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -251,6 +251,15 @@ plClient::~plClient() #include "plGImage/plAVIWriter.h" #include "pfCharacter/pfMarkerMgr.h" +template +static void IUnRegisterAs(T*& ko, plFixedKeyId id) +{ + if (ko) { + ko->UnRegisterAs(id); + ko = nullptr; + } +} + bool plClient::Shutdown() { plSynchEnabler ps(false); // disable dirty state tracking during shutdown @@ -296,31 +305,13 @@ bool plClient::Shutdown() // Take down our GUI control generator pfGUICtrlGenerator::Instance().Shutdown(); - if (plNetClientMgr::GetInstance()) - { - plNetClientMgr::GetInstance()->Shutdown(); - plNetClientMgr::GetInstance()->UnRegisterAs(kNetClientMgr_KEY); // deletes NetClientMgr instance - plNetClientMgr::SetInstance(nil); - } - - if (plAgeLoader::GetInstance()) - { - plAgeLoader::GetInstance()->Shutdown(); - plAgeLoader::GetInstance()->UnRegisterAs(kAgeLoader_KEY); // deletes instance - plAgeLoader::SetInstance(nil); - } - - if (fInputManager) - { - fInputManager->UnRegisterAs(kInput_KEY); - fInputManager = nil; - } + if (plNetClientMgr* nc = plNetClientMgr::GetInstance()) + nc->Shutdown(); + if (plAgeLoader* al = plAgeLoader::GetInstance()) + al->Shutdown(); - if( fGameGUIMgr != nil ) - { - fGameGUIMgr->UnRegisterAs( kGameGUIMgr_KEY ); - fGameGUIMgr = nil; - } + IUnRegisterAs(fInputManager, kInput_KEY); + IUnRegisterAs(fGameGUIMgr, kGameGUIMgr_KEY); for (int i = 0; i < fRooms.Count(); i++) { @@ -341,50 +332,30 @@ bool plClient::Shutdown() plSimulationMgr::Shutdown(); plAvatarMgr::ShutDown(); plRelevanceMgr::DeInit(); - + if (fPageMgr) fPageMgr->Reset(); - if( fTransitionMgr != nil ) - { - fTransitionMgr->UnRegisterAs( kTransitionMgr_KEY ); - fTransitionMgr = nil; - } - + IUnRegisterAs(fTransitionMgr, kTransitionMgr_KEY); + delete fConsoleEngine; fConsoleEngine = nil; - if (fLinkEffectsMgr) - { - fLinkEffectsMgr->UnRegisterAs( kLinkEffectsMgr_KEY); - fLinkEffectsMgr=nil; - } + IUnRegisterAs(fLinkEffectsMgr, kLinkEffectsMgr_KEY); plClothingMgr::DeInit(); - if( fFontCache != nil ) - { - fFontCache->UnRegisterAs( kFontCache_KEY ); - fFontCache = nil; - } + IUnRegisterAs(fFontCache, kFontCache_KEY); pfMarkerMgr::Shutdown(); delete fAnimDebugList; -//#ifndef PLASMA_EXTERNAL_RELEASE - if( fConsole != nil ) - { - // UnRegisterAs destroys the object for us - fConsole->UnRegisterAs( kConsoleObject_KEY ); - fConsole = nil; - } -//#endif + IUnRegisterAs(fConsole, kConsoleObject_KEY); PythonInterface::finiPython(); - - if (fNewCamera) - fNewCamera->UnRegisterAs( kVirtualCamera1_KEY ); + + IUnRegisterAs(fNewCamera, kVirtualCamera1_KEY); // mark the listener for death. // there's no need to keep this around... @@ -401,7 +372,7 @@ bool plClient::Shutdown() if (pfLocalizationMgr::InstanceValid()) pfLocalizationMgr::Shutdown(); - + ShutdownDLLs(); plVisLOSMgr::DeInit(); @@ -416,7 +387,6 @@ bool plClient::Shutdown() // This will destruct the client. Do it last. UnRegisterAs(kClient_KEY); - return false; } diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp index a59b9dbb..d126767d 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp @@ -110,6 +110,8 @@ plAgeLoader::~plAgeLoader() void plAgeLoader::Shutdown() { plResPatcher::GetInstance()->Shutdown(); + UnRegisterAs(kAgeLoader_KEY); + SetInstance(nullptr); } void plAgeLoader::Init() diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index e24982a7..7d181b0a 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -199,6 +199,10 @@ void plNetClientMgr::Shutdown() IRemoveCloneRoom(); VaultDestroy(); + + // commit hara-kiri + UnRegisterAs(kNetClientMgr_KEY); + SetInstance(nullptr); } //