- update new version # 3.5.3 (possible bugfix release)

- updated some pathfinder settings to see if performance and reaction to attacking is better
This commit is contained in:
Mark Vejvoda 2011-06-02 07:09:19 +00:00
parent 38aa9c94fb
commit 95755ad832
3 changed files with 41 additions and 13 deletions

View File

@ -41,7 +41,7 @@ const int PathFinder::maxFreeSearchRadius = 10;
//const int PathFinder::pathFindNodesMax= 400; //const int PathFinder::pathFindNodesMax= 400;
int PathFinder::pathFindNodesAbsoluteMax = 900; int PathFinder::pathFindNodesAbsoluteMax = 900;
int PathFinder::pathFindNodesMax = 2000; int PathFinder::pathFindNodesMax = 1500;
const int PathFinder::pathFindRefresh = 10; const int PathFinder::pathFindRefresh = 10;
const int PathFinder::pathFindBailoutRadius = 20; const int PathFinder::pathFindBailoutRadius = 20;
const int PathFinder::pathFindExtendRefreshForNodeCount = 25; const int PathFinder::pathFindExtendRefreshForNodeCount = 25;
@ -288,7 +288,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(canUnitMove) { if(canUnitMove) {
//printf("$$$$ Unit BAILOUT(1) ASTAR ATTEMPT for [%d - %s] newFinalPos = [%s]\n",unit->getId(),unit->getFullName().c_str(),newFinalPos.getString().c_str()); //printf("$$$$ Unit BAILOUT(1) ASTAR ATTEMPT for [%d - %s] newFinalPos = [%s]\n",unit->getId(),unit->getFullName().c_str(),newFinalPos.getString().c_str());
ts= aStar(unit, newFinalPos, true, frameIndex); int maxBailoutNodeCount = (PathFinder::pathFindBailoutRadius * 2);
ts= aStar(unit, newFinalPos, true, frameIndex, maxBailoutNodeCount);
} }
} }
} }
@ -308,7 +309,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(canUnitMove) { if(canUnitMove) {
//printf("$$$$ Unit BAILOUT(1) ASTAR ATTEMPT for [%d - %s] newFinalPos = [%s]\n",unit->getId(),unit->getFullName().c_str(),newFinalPos.getString().c_str()); //printf("$$$$ Unit BAILOUT(1) ASTAR ATTEMPT for [%d - %s] newFinalPos = [%s]\n",unit->getId(),unit->getFullName().c_str(),newFinalPos.getString().c_str());
ts= aStar(unit, newFinalPos, true, frameIndex); int maxBailoutNodeCount = (PathFinder::pathFindBailoutRadius * 2);
ts= aStar(unit, newFinalPos, true, frameIndex, maxBailoutNodeCount);
} }
} }
} }

View File

@ -27,7 +27,7 @@ using namespace Shared::Platform;
namespace Glest { namespace Game { namespace Glest { namespace Game {
const string mailString = "contact@megaglest.org"; const string mailString = "contact@megaglest.org";
const string glestVersionString = "v3.5.2"; const string glestVersionString = "v3.5.3-dev";
#if defined(SVNVERSION) #if defined(SVNVERSION)
const string SVN_Rev = string("Rev: ") + string(SVNVERSION); const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
#elif defined(SVNVERSIONHEADER) #elif defined(SVNVERSIONHEADER)

View File

@ -483,16 +483,42 @@ void UnitUpdater::updateAttack(Unit *unit, int frameIndex) {
else { else {
//if unit arrives destPos order has ended //if unit arrives destPos order has ended
switch (tsValue){ switch (tsValue){
case tsMoving: case tsMoving:
unit->setCurrSkill(act->getMoveSkillType()); unit->setCurrSkill(act->getMoveSkillType());
break;
case tsBlocked: {
if(unit->getPath()->isBlocked()){ std::pair<bool,Unit *> beingAttacked = unitBeingAttacked(unit);
if(beingAttacked.first == true) {
Unit *enemy = beingAttacked.second;
const AttackCommandType *act_forenemy = unit->getType()->getFirstAttackCommand(enemy->getCurrField());
if(act_forenemy != NULL) {
if(unit->getEp() >= act_forenemy->getAttackSkillType()->getEpCost()) {
unit->setCurrSkill(act_forenemy->getAttackSkillType());
unit->setTarget(enemy);
}
//aiInterface->giveCommand(i, act_forenemy, beingAttacked.second->getPos());
}
else {
const AttackStoppedCommandType *asct_forenemy = unit->getType()->getFirstAttackStoppedCommand(enemy->getCurrField());
if(asct_forenemy != NULL) {
//aiInterface->giveCommand(i, asct_forenemy, beingAttacked.second->getCenteredPos());
if(unit->getEp() >= asct_forenemy->getAttackSkillType()->getEpCost()) {
unit->setCurrSkill(asct_forenemy->getAttackSkillType());
unit->setTarget(enemy);
}
}
}
}
}
break;
case tsBlocked:
if(unit->getPath()->isBlocked()){
unit->finishCommand();
}
break;
default:
unit->finishCommand(); unit->finishCommand();
}
break;
default:
unit->finishCommand();
} }
} }
} }