From: <mg...@us...> - 2007-12-29 06:03:34
|
Revision: 536 http://planeshift.svn.sourceforge.net/planeshift/?rev=536&view=rev Author: mgist Date: 2007-12-28 22:03:39 -0800 (Fri, 28 Dec 2007) Log Message: ----------- - Some warning fixes. - Added Planeshift.Client.Loading.UnloadLast option to psclient.cfg which alters whether unloading is done before or after map loading. Set to true by default, maps are loaded before old are unloaded (faster for machines with enough ram to not swap, possibly slower for those who swap). Will add GUI option in future. Modified Paths: -------------- trunk/docs/history.txt trunk/src/client/psengine.cpp trunk/src/client/psengine.h trunk/src/common/effects/pseffectobjlabel.cpp trunk/src/common/engine/psworld.cpp trunk/src/common/engine/psworld.h trunk/src/common/util/pspath.cpp trunk/src/common/util/stringarray.h Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/docs/history.txt 2007-12-29 06:03:39 UTC (rev 536) @@ -2,6 +2,12 @@ - Added Update.Execs option to the updater. Set to false if you don't want to update executable files. - Updated xDelta3. +- Some warning fixes. +- Added Planeshift.Client.Loading.UnloadLast option to psclient.cfg which + alters whether unloading is done before or after map loading. Set to true + by default, maps are loaded before old are unloaded (faster for machines + with enough ram to not swap, possibly slower for those who swap). Will + add GUI option in future. *** 2007-12-29 by Anders Reggestad - Added alias command to the /path admin command. Modified: trunk/src/client/psengine.cpp =================================================================== --- trunk/src/client/psengine.cpp 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/client/psengine.cpp 2007-12-29 06:03:39 UTC (rev 536) @@ -543,6 +543,8 @@ zonehandler->SetLoadAllMaps(GetConfig()->GetBool("Planeshift.Client.Loading.AllMaps",false)); zonehandler->SetKeepMapsLoaded(GetConfig()->GetBool("Planeshift.Client.Loading.KeepMaps",false)); + unloadLast = GetConfig()->GetBool("Planeshift.Client.Loading.UnloadLast", true); + materialmanager.AttachNew(new MaterialManager(object_reg, preloadModels)); if(preloadModels) Modified: trunk/src/client/psengine.h =================================================================== --- trunk/src/client/psengine.h 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/client/psengine.h 2007-12-29 06:03:39 UTC (rev 536) @@ -350,9 +350,12 @@ /// get the inventory cache psInventoryCache* GetInventoryCache(void) { return inventoryCache; } - // Are we preloading models? + /// Are we preloading models? bool PreloadingModels() { return preloadModels; } + /// Unload order. + bool UnloadingLast() { return unloadLast; } + private: // Load the log report settings from the config file. void LoadLogSettings(); @@ -464,7 +467,10 @@ bool muteSoundsOnFocusLoss; /// Define if the sound is on or off from psclient.cfg. - bool soundOn; + bool soundOn; + + /// Define what kind of loading we want to do; unload first or unload last. + bool unloadLast; // Event ID cache csEventID event_preprocess; Modified: trunk/src/common/effects/pseffectobjlabel.cpp =================================================================== --- trunk/src/common/effects/pseffectobjlabel.cpp 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/common/effects/pseffectobjlabel.cpp 2007-12-29 06:03:39 UTC (rev 536) @@ -378,8 +378,8 @@ int mw,mh; fact->GetMaterialWrapper()->GetMaterial()->GetTexture()->GetOriginalDimensions(mw, mh); - facState->SetVertexCount( lettercount * 4 ); - facState->SetTriangleCount( lettercount * 2 ); + facState->SetVertexCount( (int)lettercount * 4 ); + facState->SetTriangleCount( (int)lettercount * 2 ); size_t elementCount = elemBuffer.GetSize(); int cp = 0; Modified: trunk/src/common/engine/psworld.cpp =================================================================== --- trunk/src/common/engine/psworld.cpp 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/common/engine/psworld.cpp 2007-12-29 06:03:39 UTC (rev 536) @@ -72,16 +72,17 @@ { object_reg = objectReg; engine = csQueryRegistry<iEngine>(object_reg); + startLoading = psengine->UnloadingLast(); return true; } bool psWorld::CreateMap( const char* name, const char* mapfile, bool load_now, bool loadMeshes) { - if ( !NewRegion(mapfile,load_now, loadMeshes) ) + if (!NewRegion(mapfile,load_now, loadMeshes)) return false; - return true; + return true; } psRegion* psWorld::NewRegion(const char *mapfile,bool load, bool loadMeshes) @@ -170,19 +171,22 @@ int psWorld::ExecuteFlaggedRegions(bool transitional) { - // Load any regions on the list which are not already loaded. - for (uint i=0; i < regions.GetSize(); i++) + if(startLoading) { - psRegion *rgn = regions[i]; - if (!rgn->IsLoaded() ) + // Load any regions on the list which are not already loaded. + for (uint i=0; i < regions.GetSize(); i++) { - if(!rgn->Load()) + psRegion *rgn = regions[i]; + if (!rgn->IsLoaded() ) { - Error2("Loading region %s failed!", rgn->GetName()); - return 1; + if(!rgn->Load()) + { + Error2("Loading region %s failed!", rgn->GetName()); + return 1; + } + // 2 signifies that a region is loaded, and that we need to refresh the screen. + return 2; } - // 2 signifies that a region is loaded, and that we need to refresh the screen. - return 2; } } @@ -212,6 +216,16 @@ } } + // Mark that we should start loading maps. + if(!startLoading) + { + startLoading = true; + return 2; + } + + // Reset loading flag. + startLoading = psengine->UnloadingLast(); + return 0; } Modified: trunk/src/common/engine/psworld.h =================================================================== --- trunk/src/common/engine/psworld.h 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/common/engine/psworld.h 2007-12-29 06:03:39 UTC (rev 536) @@ -243,6 +243,8 @@ static float GetAngle(float x, float y); void DumpWarpCache(); +private: + bool startLoading; }; Modified: trunk/src/common/util/pspath.cpp =================================================================== --- trunk/src/common/util/pspath.cpp 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/common/util/pspath.cpp 2007-12-29 06:03:39 UTC (rev 536) @@ -197,7 +197,7 @@ if (dist < 0 || d < dist) { dist = d; - idx = i; + idx = (int)i; } } if (dist >= 0.0) Modified: trunk/src/common/util/stringarray.h =================================================================== --- trunk/src/common/util/stringarray.h 2007-12-29 05:45:09 UTC (rev 535) +++ trunk/src/common/util/stringarray.h 2007-12-29 06:03:39 UTC (rev 536) @@ -33,7 +33,7 @@ * Push a printf-style string onto the list (makes copy of string after * formatting). */ - int FormatPush(char const * fmt, ...) + size_t FormatPush(char const * fmt, ...) { csString str; va_list args; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |