- disabled another cache in pathfinder trying to hunt down xplatform out of synch

This commit is contained in:
Mark Vejvoda 2010-11-28 00:07:08 +00:00
parent ee249b8878
commit 664b2b1b7d
6 changed files with 33 additions and 26 deletions

View File

@ -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<UnitPathBasic *>(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<UnitPath *>(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<UnitPathBasic *>(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<UnitPath *>(path) != NULL) {
UnitPath *advPath = dynamic_cast<UnitPath *>(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);
}

View File

@ -36,16 +36,18 @@
#include "font_gl.h"
#include "cache_manager.h"
#ifdef WIN32
#include <eh.h>
#include <DbgHelp.h>
#ifdef WIN32
#if defined(__WIN32__) && !defined(__GNUC__)
#include <eh.h>
#endif
#include <dbghelp.h>
#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);

View File

@ -90,7 +90,7 @@ private:
std::map<Vec2i,bool> cachedCloseResourceTargetLookupList;
time_t lastResourceTargettListPurge;
std::map<CommandClass,std::map<int,int> > cacheUnitCommandClassList;
//std::map<CommandClass,std::map<int,int> > cacheUnitCommandClassList;
// This cache stores the units free cell movement calcs during a world
// update of the faction
//std::map<int,std::map<Field, std::map<Vec2i,std::map<Vec2i, > > > localCacheForUnitCellMovement;

View File

@ -15,11 +15,11 @@
#include <windows.h>
#include <GL\gl.h>
#include <GL\glu.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <glprocs.h>
#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

View File

@ -12,7 +12,7 @@
#ifdef WIN32
#include <io.h>
#include <DbgHelp.h>
#include <dbghelp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <direct.h>
@ -305,7 +305,7 @@ void findAll(const string &path, vector<string> &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) {

View File

@ -12,7 +12,7 @@
#include "platform_util.h"
#include <io.h>
#include <DbgHelp.h>
#include <dbghelp.h>
#include <cassert>
#include <algorithm>