- disabled the stopcommand throttling for now to see if performance is still ok

This commit is contained in:
Mark Vejvoda 2011-03-28 21:10:49 +00:00
parent 3ed636aae2
commit 56bc84923a
1 changed files with 19 additions and 18 deletions

View File

@ -37,6 +37,7 @@ namespace Glest{ namespace Game{
const int UnitPathBasic::maxBlockCount= GameConstants::updateFps / 2;
const int updateUnitForStopCommandFrameCount = 40;
const bool updateUnitForStopCommandFrameCountEnabled = false;
UnitPathBasic::UnitPathBasic() {
this->blockCount = 0;
@ -1106,17 +1107,18 @@ bool Unit::needToUpdate() {
if(newProgress >= 1.f) {
return_value = true;
if(currSkill->getClass() != scDie) {
if(currSkill->getClass() == scStop) {
return_value = false;
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
if(this->getLastStopCommandCheckFrame() <= 0 ||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
return_value = true;
if(updateUnitForStopCommandFrameCountEnabled == true) {
if(currSkill->getClass() != scDie) {
if(currSkill->getClass() == scStop) {
return_value = false;
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
if(this->getLastStopCommandCheckFrame() <= 0 ||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
return_value = true;
}
}
}
}
}
}
return return_value;
@ -1210,18 +1212,17 @@ bool Unit::update() {
if(currSkill->getClass() != scDie) {
progress = 0.f;
return_value = true;
if(currSkill->getClass() == scStop && this->anyCommand() == false) {
return_value = false;
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
if(this->getLastStopCommandCheckFrame() <= 0 ||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
this->setLastStopCommandCheckFrame(game->getWorld()->getFrameCount());
return_value = true;
if(updateUnitForStopCommandFrameCountEnabled == true) {
if(currSkill->getClass() == scStop && this->anyCommand() == false) {
return_value = false;
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
if(this->getLastStopCommandCheckFrame() <= 0 ||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
this->setLastStopCommandCheckFrame(game->getWorld()->getFrameCount());
return_value = true;
}
}
}
//if(return_value == true) {
// printf("\n\n\n@@@@@@@@@@@@@@@ Unit [%s - %d] current skill [%s]\n",this->getFullName().c_str(),this->getId(),currSkill->getName().c_str());
//}
}
else {
progress= 1.f;