From 664b2b1b7d19222b0efd9c6adc57a329b22710ac Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sun, 28 Nov 2010 00:07:08 +0000 Subject: [PATCH] - disabled another cache in pathfinder trying to hunt down xplatform out of synch --- source/glest_game/ai/path_finder.cpp | 17 +++++++++----- source/glest_game/main/main.cpp | 22 ++++++++++--------- source/glest_game/type_instances/faction.h | 2 +- .../shared_lib/include/platform/sdl/gl_wrap.h | 6 ++--- .../platform/common/platform_common.cpp | 10 ++++----- .../sources/platform/win32/platform_util.cpp | 2 +- 6 files changed, 33 insertions(+), 26 deletions(-) diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 9ab3509c..f9ef0c9a 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -38,7 +38,7 @@ namespace Glest{ namespace Game{ const int PathFinder::maxFreeSearchRadius= 10; //const int PathFinder::pathFindNodesMax= 400; -const int PathFinder::pathFindNodesMax= 150; +const int PathFinder::pathFindNodesMax= 200; const int PathFinder::pathFindRefresh= 10; @@ -112,7 +112,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu UnitPathBasic *basicPath = dynamic_cast(path); Vec2i pos= basicPath->pop(); - if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + //if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + if(map->canMove(unit, unit->getPos(), pos)) { unit->setTargetPos(pos); unit->addCurrentTargetPathTakenCell(finalPos,pos); return tsMoving; @@ -122,7 +123,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu UnitPath *advPath = dynamic_cast(path); //route cache Vec2i pos= advPath->peek(); - if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + //if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + if(map->canMove(unit, unit->getPos(), pos)) { advPath->pop(); unit->setTargetPos(pos); return tsMoving; @@ -182,7 +184,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu for(int bailoutX = -20; bailoutX <= 20 && ts == tsBlocked; ++bailoutX) { for(int bailoutY = -20; bailoutY <= 20 && ts == tsBlocked; ++bailoutY) { const Vec2i newFinalPos = finalPos + Vec2i(bailoutX,bailoutY); - if(map->canMove(unit, unit->getPos(), newFinalPos, &lookupCacheCanMove)) { + //if(map->canMove(unit, unit->getPos(), newFinalPos, &lookupCacheCanMove)) { + if(map->canMove(unit, unit->getPos(), newFinalPos)) { ts= aStar(unit, newFinalPos, true); } } @@ -199,7 +202,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu UnitPathBasic *basicPath = dynamic_cast(path); Vec2i pos= basicPath->pop(); - if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + //if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + if(map->canMove(unit, unit->getPos(), pos)) { unit->setTargetPos(pos); unit->addCurrentTargetPathTakenCell(finalPos,pos); } @@ -211,7 +215,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu else if(dynamic_cast(path) != NULL) { UnitPath *advPath = dynamic_cast(path); Vec2i pos= advPath->peek(); - if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + //if(map->canMove(unit, unit->getPos(), pos, &lookupCacheCanMove)) { + if(map->canMove(unit, unit->getPos(), pos)) { advPath->pop(); unit->setTargetPos(pos); } diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index fc6d2fa8..565d4194 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -36,16 +36,18 @@ #include "font_gl.h" #include "cache_manager.h" -#ifdef WIN32 -#include -#include +#ifdef WIN32 +#if defined(__WIN32__) && !defined(__GNUC__) +#include +#endif +#include #endif #include "leak_dumper.h" -#ifndef WIN32 - #define stricmp strcasecmp - #define strnicmp strncasecmp +#ifndef WIN32 + #define stricmp strcasecmp + #define strnicmp strncasecmp #define _strnicmp strncasecmp #endif @@ -140,12 +142,12 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep) { SymInitialize(GetCurrentProcess(), NULL, TRUE); while(::StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &sf, context, NULL, ::SymFunctionTableAccess, ::SymGetModuleBase, NULL)) { - struct { IMAGEHLP_SYMBOL sym; stringType n; } + struct { IMAGEHLP_SYMBOL sym; stringType n; } si = { { sizeof( IMAGEHLP_SYMBOL ), 0, 0, 0, sizeof(stringType) } }; IMAGEHLP_LINE li = { sizeof( IMAGEHLP_LINE ) }; DWORD off=0; DWORD dwDisp=0; - if( SymGetSymFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &off, &si.sym) && + if( SymGetSymFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &off, &si.sym) && SymGetLineFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &dwDisp, &li)) { char *del = strrchr(li.FileName, '\\'); formatstring(t)("%s - %s [%d]\n", si.sym.Name, del ? del + 1 : li.FileName, li.LineNumber+dwDisp); @@ -648,11 +650,11 @@ int glestMain(int argc, char** argv) { if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SDL_INFO]) == true) { SDL_version ver; - + // Prints the compile time version SDL_VERSION(&ver); print_SDL_version("SDL compile-time version", &ver); - + // Prints the run-time version ver = *SDL_Linked_Version(); print_SDL_version("SDL runtime version", &ver); diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index 35cec705..fe7e064d 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -90,7 +90,7 @@ private: std::map cachedCloseResourceTargetLookupList; time_t lastResourceTargettListPurge; - std::map > cacheUnitCommandClassList; + //std::map > cacheUnitCommandClassList; // This cache stores the units free cell movement calcs during a world // update of the faction //std::map > > localCacheForUnitCellMovement; diff --git a/source/shared_lib/include/platform/sdl/gl_wrap.h b/source/shared_lib/include/platform/sdl/gl_wrap.h index 4413caf0..f3716c0b 100644 --- a/source/shared_lib/include/platform/sdl/gl_wrap.h +++ b/source/shared_lib/include/platform/sdl/gl_wrap.h @@ -15,11 +15,11 @@ #include -#include -#include +#include +#include #include -#define GLEST_GLPROC(X, Y) inline X( static a= wglGetProcAddress(a); return a;) +#define GLEST_GLPROC(X, Y) inline X( static a= wglGetProcAddress(a); return a;) #else diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index a4b7fdb2..22f6b71f 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -12,7 +12,7 @@ #ifdef WIN32 #include -#include +#include #include #include #include @@ -305,7 +305,7 @@ void findAll(const string &path, vector &results, bool cutExtension, boo } } } - + bool isdir(const char *path) { string friendly_path = path; @@ -322,12 +322,12 @@ bool isdir(const char *path) bool ret = (result == 0); if(ret == true) { ret = S_ISDIR(stats.st_mode); // #define S_ISDIR(mode) ((mode) & _S_IFDIR) - + if(ret == false) { //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path [%s] ret = %d\n",__FILE__,__FUNCTION__,__LINE__,friendly_path.c_str(),ret); } } - else { + else { //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path [%s] ret = %d, result = %d, errno = %d\n",__FILE__,__FUNCTION__,__LINE__,friendly_path.c_str(),ret,result,errno); } //if(ret == false) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] NOT a path [%s]\n",__FILE__,__FUNCTION__,__LINE__,path); @@ -461,7 +461,7 @@ int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string // Look recursively for sub-folders #if defined(__APPLE__) || defined(__FreeBSD__) res = glob(mypath.c_str(), 0, 0, &globbuf); -#else +#else res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf); #endif if(res < 0) { diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index deefbcda..f3546fa9 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -12,7 +12,7 @@ #include "platform_util.h" #include -#include +#include #include #include