- chasing down out of synch

This commit is contained in:
Mark Vejvoda 2011-02-16 04:43:27 +00:00
parent 14c5b87da4
commit 7a5de218b7
3 changed files with 16 additions and 31 deletions

View File

@ -325,12 +325,7 @@ void PathFinder::processNode(Unit *unit, Node *node,const Vec2i finalPos, int i,
sucNode->prev= node; sucNode->prev= node;
sucNode->next= NULL; sucNode->next= NULL;
sucNode->exploredCell= map->getSurfaceCell(Map::toSurfCoords(sucPos))->isExplored(unit->getTeam()); sucNode->exploredCell= map->getSurfaceCell(Map::toSurfCoords(sucPos))->isExplored(unit->getTeam());
std::map<float, Nodes>::iterator iterFind = openNodesList.find(sucNode->heuristic); openNodesList[sucNode->heuristic].push_back(sucNode);
if(iterFind == openNodesList.end()) {
openNodesList[sucNode->heuristic].reserve(PathFinder::pathFindNodesMax / 3);
iterFind = openNodesList.find(sucNode->heuristic);
}
iterFind->second.push_back(sucNode);
openPosList[sucNode->pos] = true; openPosList[sucNode->pos] = true;
} }
else { else {
@ -489,13 +484,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
firstNode->pos= unitPos; firstNode->pos= unitPos;
firstNode->heuristic= heuristic(unitPos, finalPos); firstNode->heuristic= heuristic(unitPos, finalPos);
firstNode->exploredCell= true; firstNode->exploredCell= true;
openNodesList[firstNode->heuristic].push_back(firstNode);
std::map<float, Nodes>::iterator iterFind = openNodesList.find(firstNode->heuristic);
if(iterFind == openNodesList.end()) {
openNodesList[firstNode->heuristic].reserve(PathFinder::pathFindNodesMax / 3);
iterFind = openNodesList.find(firstNode->heuristic);
}
iterFind->second.push_back(firstNode);
openPosList[firstNode->pos] = true; openPosList[firstNode->pos] = true;
//b) loop //b) loop
@ -527,12 +516,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
//b4) move this node from closedNodes to openNodes //b4) move this node from closedNodes to openNodes
//add all succesors that are not in closedNodes or openNodes to openNodes //add all succesors that are not in closedNodes or openNodes to openNodes
std::map<float, Nodes>::iterator iterFind = closedNodesList.find(node->heuristic); closedNodesList[node->heuristic].push_back(node);
if(iterFind == closedNodesList.end()) {
closedNodesList[node->heuristic].reserve(PathFinder::pathFindNodesMax / 3);
iterFind = closedNodesList.find(node->heuristic);
}
iterFind->second.push_back(node);
openPosList[node->pos] = true; openPosList[node->pos] = true;
int tryDirection = random.randRange(0,3); int tryDirection = random.randRange(0,3);

View File

@ -34,10 +34,10 @@ namespace Glest { namespace Game {
double maxFrameCountLagAllowed = 25; double maxFrameCountLagAllowed = 25;
double maxClientLagTimeAllowed = 30; double maxClientLagTimeAllowed = 30;
double maxFrameCountLagAllowedEver = 60; double maxFrameCountLagAllowedEver = 65;
double warnFrameCountLagPercent = 0.65; double warnFrameCountLagPercent = 0.65;
double LAG_CHECK_GRACE_PERIOD = 15; double LAG_CHECK_GRACE_PERIOD = 15;
double MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = 1; double MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = 2;
const int MAX_SLOT_THREAD_WAIT_TIME = 3; const int MAX_SLOT_THREAD_WAIT_TIME = 3;
const int MASTERSERVER_HEARTBEAT_GAME_STATUS_SECONDS = 30; const int MASTERSERVER_HEARTBEAT_GAME_STATUS_SECONDS = 30;
@ -1170,17 +1170,18 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
} }
if(bOkToStart == true) { if(bOkToStart == true) {
/* bool useInGameBlockingClientSockets = Config::getInstance().getBool("EnableInGameBlockingSockets","false");
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(useInGameBlockingClientSockets == true) {
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[i],string(__FILE__) + "_" + intToStr(__LINE__) + "_" + intToStr(i)); for(int i= 0; i < GameConstants::maxPlayers; ++i) {
ConnectionSlot *connectionSlot= slots[i]; MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[i],string(__FILE__) + "_" + intToStr(__LINE__) + "_" + intToStr(i));
if(connectionSlot != NULL && ConnectionSlot *connectionSlot= slots[i];
connectionSlot->isConnected()) { if(connectionSlot != NULL && connectionSlot->isConnected()) {
connectionSlot->getSocket()->setBlock(true); connectionSlot->getSocket()->setBlock(true);
}
} }
} }
*/
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",__FILE__,__FUNCTION__,__LINE__,needToRepublishToMasterserver); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",__FILE__,__FUNCTION__,__LINE__,needToRepublishToMasterserver);
serverSocket.stopBroadCastThread(); serverSocket.stopBroadCastThread();

View File

@ -339,7 +339,7 @@ void UnitUpdater::updateMove(Unit *unit) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
char szBuf[4096]=""; char szBuf[4096]="";
sprintf(szBuf,"[updateMove] pos [%s] cmd [%s]",pos.getString().c_str(),command->toString().c_str()); sprintf(szBuf,"[updateMove] pos [%s] unit [%d - %s] cmd [%s]",pos.getString().c_str(),unit->getId(),unit->getFullName().c_str(),command->toString().c_str());
unit->logSynchData(__FILE__,__LINE__,szBuf); unit->logSynchData(__FILE__,__LINE__,szBuf);
} }