[Clonekeenplus-commits] [SCM] clonekeenplus branch, master, updated. 0e4993b8f364dcfe62f9ed83f50141
Commander Keen Interpreter
Brought to you by:
gerstrong
From: Albert Z. <alb...@us...> - 2010-10-24 13:26:43
|
via 0e4993b8f364dcfe62f9ed83f50141d050cb8429 (commit) via 07781d84d0aad2bb428b40a9bdca74ba445d9bc8 (commit) from 1034409d5162e9a04a8ebe29f2e60a100126830d (commit) - Log ----------------------------------------------------------------- commit 0e4993b8f364dcfe62f9ed83f50141d050cb8429 Author: Albert Zeyer <alb...@rw...> Date: Sun Oct 24 15:26:17 2010 +0200 getting return code commit 07781d84d0aad2bb428b40a9bdca74ba445d9bc8 Author: Albert Zeyer <alb...@rw...> Date: Sun Oct 24 15:24:25 2010 +0200 Revert "totally wrong thought about threads. you will not have the return value while it is not executed yet" This reverts commit 05ee7430ed0eb1f816e8fba7bc150b1266dceb36. Actually, RunLoadAction waits until the threads finishes, so we can get a return code there. ----------------------------------------------------------------------- Summary of changes: src/CGameControl.cpp | 4 ++-- src/CResourceLoader.cpp | 10 ++++++---- src/CResourceLoader.h | 4 ++-- src/common/CMapLoader.cpp | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/CGameControl.cpp b/src/CGameControl.cpp index 619e361..4e33e2c 100644 --- a/src/CGameControl.cpp +++ b/src/CGameControl.cpp @@ -127,10 +127,10 @@ bool CGameControl::init(char mode) } }; + const std::string threadname = "Scanning Game-Directory"; // He we start the thread for cycling the loading screen g_pResourceLoader->setStyle(PROGRESS_STYLE_TEXT); - g_pResourceLoader->RunLoadAction(new GamesScan(mp_GameLauncher), "Scanning Game-Directory"); - return true; + return (g_pResourceLoader->RunLoadAction(new GamesScan(mp_GameLauncher), threadname) == 1); } else if(m_mode == PASSIVE) { diff --git a/src/CResourceLoader.cpp b/src/CResourceLoader.cpp index 523dd3d..62a7358 100644 --- a/src/CResourceLoader.cpp +++ b/src/CResourceLoader.cpp @@ -33,17 +33,19 @@ void CResourceLoader::setStyle(ProgressStyle style) * This will start up the thread for the load display and process the display of loading * and then return */ -void CResourceLoader::RunLoadAction(Action* act, const std::string &threadname, int min_permil, int max_permil) +int CResourceLoader::RunLoadAction(Action* act, const std::string &threadname, int min_permil, int max_permil) { assert(mp_Thread == 0); m_max_permil = max_permil; m_min_permil = min_permil; m_permil = m_min_permil; mp_Thread = threadPool->start(act, threadname); - process(); + int ret = 0; + process(&ret); + return ret; } -bool CResourceLoader::process() +bool CResourceLoader::process(int* ret) { SDL_FillRect(g_pVideoDriver->getBlitSurface(), NULL, 0x0); @@ -51,7 +53,7 @@ bool CResourceLoader::process() return false; // Do rendering here and the cycle - while(!threadPool->finalizeIfReady(mp_Thread)) + while(!threadPool->finalizeIfReady(mp_Thread, ret)) { g_pTimer->TimeToLogic(); diff --git a/src/CResourceLoader.h b/src/CResourceLoader.h index 5f67837..f6b1aeb 100644 --- a/src/CResourceLoader.h +++ b/src/CResourceLoader.h @@ -29,8 +29,8 @@ public: void setStyle(ProgressStyle style); - void RunLoadAction(Action* act, const std::string &threadname, int min_permil=0, int max_permil=1000); - bool process(); + int RunLoadAction(Action* act, const std::string &threadname, int min_permil=0, int max_permil=1000); + bool process(int* ret); void setPermilage(int permil); diff --git a/src/common/CMapLoader.cpp b/src/common/CMapLoader.cpp index 6d6cbf3..c0e107e 100644 --- a/src/common/CMapLoader.cpp +++ b/src/common/CMapLoader.cpp @@ -211,8 +211,7 @@ bool CMapLoader::load( Uint8 episode, Uint8 level, const std::string& path, bool } }; g_pResourceLoader->setStyle(PROGRESS_STYLE_BITMAP); - g_pResourceLoader->RunLoadAction(new MapLoad(this, episode, level, path, loadNewMusic, stategame), "Loading Map"); - return true; + return g_pResourceLoader->RunLoadAction(new MapLoad(this, episode, level, path, loadNewMusic, stategame), "Loading Map"); } void CMapLoader::addTile( Uint16 t, Uint16 x, Uint16 y ) hooks/post-receive -- clonekeenplus |