- updated caching for explorecells to be smarter and also remove old items if the cache gets too large (hits a threshold)

This commit is contained in:
Mark Vejvoda 2010-07-16 22:17:36 +00:00
parent 3d62ba1089
commit 432343572f
2 changed files with 8 additions and 5 deletions

View File

@ -47,12 +47,12 @@ MaxLights=3
;MasterServerExternalPortList=80,143,587,21,110,25,443,993,995
Masterserver=http://megaglest.pepper.freeit.org/masterserver/
MasterServerExternalPortList=61357,80,143,587,21,110,25,443,993,995
NetPlayerName=newbie
NetPlayerName=SoftCoder
NetworkConsistencyChecks=true
PhotoMode=false
RefreshFrequency=75
ScreenHeight=768
ScreenWidth=1024
ScreenHeight=960
ScreenWidth=1670
ServerIp=172.20.100.101
ServerPort=61357
ShadowAlpha=0.2
@ -68,5 +68,5 @@ StencilBits=0
Textures3D=1
UnitParticles=true
UserData_Root=mydata/
Windowed=false
Windowed=true
; === propertyMap File ===

View File

@ -48,6 +48,7 @@ World::World(){
Config &config= Config::getInstance();
ExploredCellsLookupItemCache.clear();
ExploredCellsLookupItemCacheTimerCount = 0;
techTree = NULL;
fogOfWarOverride = false;
@ -750,7 +751,9 @@ time_t ExploredCellsLookupItem::lastDebug = 0;
void World::exploreCells(const Vec2i &newPos, int sightRange, int teamIndex){
// Experimental cache lookup of previously calculated cells + sight range
if(difftime(time(NULL),ExploredCellsLookupItem::lastDebug) >= 10) {
printf("In [%s::%s Line: %d] ExploredCellsLookupItemCache.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,ExploredCellsLookupItemCache.size());
ExploredCellsLookupItem::lastDebug = time(NULL);
//printf("In [%s::%s Line: %d] ExploredCellsLookupItemCache.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,ExploredCellsLookupItemCache.size());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ExploredCellsLookupItemCache.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,ExploredCellsLookupItemCache.size());
}
// Ok we limit the cache size doe to possible RAM constraints when