From: <rly...@us...> - 2011-06-12 16:27:18
|
Revision: 7401 http://planeshift.svn.sourceforge.net/planeshift/?rev=7401&view=rev Author: rlydontknow Date: 2011-06-12 16:27:11 +0000 (Sun, 12 Jun 2011) Log Message: ----------- fixed library loading functionality in bgloader removed functionality for recursive loads as they aren't thread-safe bumped bgloader version as the removal of the recursive functionality breaks the API compability Modified Paths: -------------- trunk/include/ibgloader.h trunk/src/client/psengine.cpp trunk/src/eedit/eeditapp.cpp trunk/src/npcclient/npcclient.cpp trunk/src/plugins/common/bgloader/loader.h trunk/src/plugins/common/bgloader/parser.cpp trunk/src/server/psserver.cpp trunk/src/tools/navgen/navgen.cpp Modified: trunk/include/ibgloader.h =================================================================== --- trunk/include/ibgloader.h 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/include/ibgloader.h 2011-06-12 16:27:11 UTC (rev 7401) @@ -52,7 +52,7 @@ */ struct iBgLoader : public virtual iBase { - SCF_INTERFACE(iBgLoader, 2, 2, 0); + SCF_INTERFACE(iBgLoader, 2, 3, 0); /** * Start loading a material into the engine. Check return for finished state/success. @@ -85,12 +85,10 @@ * Pass a data file to be cached. This method will parse your data and add it to it's * internal world representation. You may then request that these objects are loaded. * @param path path to the file to be cached. - * @param recursive Mark true if this is a recursive call (no vfs chdir needed). - * If you don't know, set this to false. * This call will be dispatched to a thread, so it will return immediately. * You should wait for parsing to finish before calling UpdatePosition(). */ - THREADED_INTERFACE2(PrecacheData, const char* path, bool recursive); + THREADED_INTERFACE1(PrecacheData, const char* path); /** * Clean up any intermediate data that was required parse time. Modified: trunk/src/client/psengine.cpp =================================================================== --- trunk/src/client/psengine.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/client/psengine.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -554,7 +554,7 @@ progress->SetCurrentValue(0.0f); // Start to fill the loader cache. - precaches.Push(loader->PrecacheData("/planeshift/materials/materials.cslib", false)); + precaches.Push(loader->PrecacheData("/planeshift/materials/materials.cslib")); lastLoadingCount = 1; // Initialize Networking @@ -644,7 +644,7 @@ // Continue to fill the loader cache. for(size_t j=0; j<meshes->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(meshes->Get(j), false)); + precaches.Push(loader->PrecacheData(meshes->Get(j))); } lastLoadingCount = meshes->GetSize(); @@ -670,7 +670,7 @@ // Continue to fill the loader cache. for(size_t j=0; j<maps->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(maps->Get(j), false)); + precaches.Push(loader->PrecacheData(maps->Get(j))); } lastLoadingCount = maps->GetSize(); Modified: trunk/src/eedit/eeditapp.cpp =================================================================== --- trunk/src/eedit/eeditapp.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/eedit/eeditapp.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -218,19 +218,19 @@ // loads materials, meshes and maps csRef<iBgLoader> loader = csQueryRegistry<iBgLoader>(object_reg); - loader->PrecacheDataWait("/planeshift/materials/materials.cslib", false); + loader->PrecacheDataWait("/planeshift/materials/materials.cslib"); csRef<iStringArray> meshes = vfs->FindFiles("/planeshift/meshes/"); for(size_t j=0; j<meshes->GetSize(); ++j) { - loader->PrecacheDataWait(meshes->Get(j), false); + loader->PrecacheDataWait(meshes->Get(j)); } csRef<iStringArray> maps = vfs->FindFiles("/planeshift/world/"); for(size_t j=0; j<maps->GetSize(); ++j) { - loader->PrecacheDataWait(maps->Get(j), false); + loader->PrecacheDataWait(maps->Get(j)); } //CPrintf(CON_CMDOUTPUT,"Loader cache filled"); Modified: trunk/src/npcclient/npcclient.cpp =================================================================== --- trunk/src/npcclient/npcclient.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/npcclient/npcclient.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -256,7 +256,7 @@ csRef<iThreadManager> threadManager = csQueryRegistry<iThreadManager>(object_reg); // load materials - loader->PrecacheDataWait("/planeshift/materials/materials.cslib", false); + loader->PrecacheDataWait("/planeshift/materials/materials.cslib"); csRefArray<iThreadReturn> precaches; @@ -264,7 +264,7 @@ csRef<iStringArray> meshes = vfs->FindFiles("/planeshift/meshes/"); for(size_t j=0; j<meshes->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(meshes->Get(j), false)); + precaches.Push(loader->PrecacheData(meshes->Get(j))); } threadManager->Wait(precaches); precaches.Empty(); @@ -274,7 +274,7 @@ csRef<iStringArray> maps = vfs->FindFiles("/planeshift/world/"); for(size_t j=0; j<maps->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(maps->Get(j), false)); + precaches.Push(loader->PrecacheData(maps->Get(j))); } threadManager->Wait(precaches); precaches.Empty(); Modified: trunk/src/plugins/common/bgloader/loader.h =================================================================== --- trunk/src/plugins/common/bgloader/loader.h 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/plugins/common/bgloader/loader.h 2011-06-12 16:27:11 UTC (rev 7401) @@ -121,12 +121,10 @@ /** * Pass a data file to be cached. This method will parse your data and add it to it's * internal world representation. You may then request that these objects are loaded. - * @param recursive Mark true if this is a recursive call (no vfs chdir needed). - * If you don't know, set this to false. * This call will be dispatched to a thread, so it will return immediately. * You should wait for parsing to finish before calling UpdatePosition(). */ - THREADED_CALLABLE_DECL2(BgLoader, PrecacheData, csThreadReturn, const char*, path, bool, recursive, THREADEDL, false, false); + THREADED_CALLABLE_DECL1(BgLoader, PrecacheData, csThreadReturn, const char*, path, THREADEDL, false, false); /** * Clears all temporary data that is only required parse time. Modified: trunk/src/plugins/common/bgloader/parser.cpp =================================================================== --- trunk/src/plugins/common/bgloader/parser.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/plugins/common/bgloader/parser.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -1024,7 +1024,7 @@ return loaded; } - THREADED_CALLABLE_IMPL2(BgLoader, PrecacheData, const char* path, bool recursive) + THREADED_CALLABLE_IMPL1(BgLoader, PrecacheData, const char* path) { (void)sync; // prevent unused variable warning @@ -1061,14 +1061,7 @@ if(!doc->GetRoot()) return false; - if(!recursive) - { - dirchange.ChangeTo(data.vfsPath.Truncate(data.vfsPath.FindLast('/')+1)); - } - else - { - data.vfsPath = vfs->GetCwd(); - } + dirchange.ChangeTo(data.vfsPath.Truncate(data.vfsPath.FindLast('/')+1)); // Begin document parsing. data.realRoot = false; @@ -1110,8 +1103,9 @@ // Parse referenced libraries. case PARSERTOKEN_LIBRARY: { - csString target(node->GetContentsValue()); - PrecacheDataTC(ret, false, target, target.FindFirst('/') == SIZET_NOT_FOUND); + csString target(data.vfsPath); + target.Append(node->GetContentsValue()); + PrecacheDataTC(ret, false, target); } break; Modified: trunk/src/server/psserver.cpp =================================================================== --- trunk/src/server/psserver.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/server/psserver.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -321,7 +321,7 @@ csRef<iThreadManager> threadManager = csQueryRegistry<iThreadManager>(object_reg); // load materials - loader->PrecacheDataWait("/planeshift/materials/materials.cslib", false); + loader->PrecacheDataWait("/planeshift/materials/materials.cslib"); csRefArray<iThreadReturn> precaches; @@ -329,7 +329,7 @@ csRef<iStringArray> meshes = vfs->FindFiles("/planeshift/meshes/"); for(size_t j=0; j<meshes->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(meshes->Get(j), false)); + precaches.Push(loader->PrecacheData(meshes->Get(j))); } threadManager->Wait(precaches); precaches.Empty(); @@ -339,7 +339,7 @@ csRef<iStringArray> maps = vfs->FindFiles("/planeshift/world/"); for(size_t j=0; j<maps->GetSize(); ++j) { - precaches.Push(loader->PrecacheData(maps->Get(j), false)); + precaches.Push(loader->PrecacheData(maps->Get(j))); } threadManager->Wait(precaches); precaches.Empty(); Modified: trunk/src/tools/navgen/navgen.cpp =================================================================== --- trunk/src/tools/navgen/navgen.cpp 2011-06-12 13:46:38 UTC (rev 7400) +++ trunk/src/tools/navgen/navgen.cpp 2011-06-12 16:27:11 UTC (rev 7401) @@ -105,7 +105,7 @@ // precache materials { csPrintf("caching materials\n"); - csRef<iThreadReturn> ret = loader->PrecacheDataWait(materials+"materials.cslib", false); + csRef<iThreadReturn> ret = loader->PrecacheDataWait(materials+"materials.cslib"); if(!ret->IsFinished() || !ret->WasSuccessful()) { csPrintf("failed to cache materials\n"); @@ -129,7 +129,7 @@ csRefArray<iThreadReturn> returns; for(size_t i = 0; i < meshFiles->GetSize(); i++) { - returns.Push(loader->PrecacheData(meshFiles->Get(i), false)); + returns.Push(loader->PrecacheData(meshFiles->Get(i))); } csPrintf("finishing mesh cache\n"); @@ -159,7 +159,7 @@ csPrintf("caching world\n"); for(size_t i = 0; i < worldFiles->GetSize(); i++) { - returns.Push(loader->PrecacheData(worldFiles->Get(i), false)); + returns.Push(loader->PrecacheData(worldFiles->Get(i))); } csPrintf("finishing world cache\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |