- more bugfixes for attack-boost check (and now in debug mode if unit selected show his attack-boost radius as well as the units affected)

This commit is contained in:
Mark Vejvoda 2011-06-25 14:18:53 +00:00
parent b0f8675a65
commit 86743e2718
3 changed files with 36 additions and 3 deletions

View File

@ -3109,6 +3109,27 @@ void Renderer::renderSelectionEffects() {
glColor4f(unit->getEpRatio()/2.f, unit->getEpRatio(), unit->getEpRatio(), 0.5f);
renderSelectionCircle(currVec, unit->getType()->getSize(), magicCircleRadius);
}
// Render Attack-boost circles
if(showDebugUI == true) {
const std::pair<const SkillType *,std::vector<Unit *> > &currentAttackBoostUnits = unit->getCurrentAttackBoostUnits();
if(currentAttackBoostUnits.first->isAttackBoostEnabled() == true) {
glColor4f(MAGENTA.x,MAGENTA.y,MAGENTA.z,MAGENTA.w);
renderSelectionCircle(currVec, unit->getType()->getSize(), currentAttackBoostUnits.first->getAttackBoost()->radius);
for(unsigned int i = 0; i < currentAttackBoostUnits.second.size(); ++i) {
// Remove attack boost upgrades from unit
Unit *affectedUnit = currentAttackBoostUnits.second[i];
Vec3f currVecBoost = affectedUnit->getCurrVectorFlat();
currVecBoost.y += 0.3f;
renderSelectionCircle(currVecBoost, affectedUnit->getType()->getSize(), 1.f);
}
}
}
}
if(selectedResourceObject!=NULL)
{

View File

@ -1018,6 +1018,18 @@ void Unit::kill() {
void Unit::undertake() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to undertake unit id = %d [%s] [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->id, this->getFullName().c_str(),this->getDesc().c_str());
// Remove any units that were previously in attack-boost range
if(currentAttackBoostUnits.second.size() > 0) {
for(unsigned int i = 0; i < currentAttackBoostUnits.second.size(); ++i) {
// Remove attack boost upgrades from unit
Unit *affectedUnit = currentAttackBoostUnits.second[i];
affectedUnit->deapplyAttackBoost(currentAttackBoostUnits.first->getAttackBoost(), this);
//printf("!!!! DE-APPLY ATTACK BOOST from unit [%s - %d]\n",affectedUnit->getType()->getName().c_str(),affectedUnit->getId());
}
currentAttackBoostUnits.second.clear();
}
UnitUpdater *unitUpdater = game->getWorld()->getUnitUpdater();
//unitUpdater->clearUnitPrecache(this);
unitUpdater->removeUnitPrecache(this);
@ -1233,8 +1245,7 @@ bool Unit::update() {
}
}
//if(currSkill != currentAttackBoostUnits.first) {
// First remove any units that were previosuly in range
// Remove any units that were previously in range
if(currentAttackBoostUnits.second.size() > 0) {
for(unsigned int i = 0; i < currentAttackBoostUnits.second.size(); ++i) {
// Remove attack boost upgrades from unit
@ -1245,7 +1256,6 @@ bool Unit::update() {
}
currentAttackBoostUnits.second.clear();
}
//}
currentAttackBoostUnits.first = currSkill;
if(currSkill->isAttackBoostEnabled() == true) {

View File

@ -352,6 +352,8 @@ public:
static void setGame(Game *value) { game=value;}
const std::pair<const SkillType *,std::vector<Unit *> > & getCurrentAttackBoostUnits() const { return currentAttackBoostUnits; }
//queries
void setIgnoreCheckCommand(bool value) { ignoreCheckCommand=value;}
bool getIgnoreCheckCommand() const {return ignoreCheckCommand;}