- 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:
parent
b0f8675a65
commit
86743e2718
|
@ -3109,6 +3109,27 @@ void Renderer::renderSelectionEffects() {
|
||||||
glColor4f(unit->getEpRatio()/2.f, unit->getEpRatio(), unit->getEpRatio(), 0.5f);
|
glColor4f(unit->getEpRatio()/2.f, unit->getEpRatio(), unit->getEpRatio(), 0.5f);
|
||||||
renderSelectionCircle(currVec, unit->getType()->getSize(), magicCircleRadius);
|
renderSelectionCircle(currVec, unit->getType()->getSize(), magicCircleRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render Attack-boost circles
|
||||||
|
if(showDebugUI == true) {
|
||||||
|
const std::pair<const SkillType *,std::vector<Unit *> > ¤tAttackBoostUnits = 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)
|
if(selectedResourceObject!=NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1018,6 +1018,18 @@ void Unit::kill() {
|
||||||
void Unit::undertake() {
|
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());
|
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 *unitUpdater = game->getWorld()->getUnitUpdater();
|
||||||
//unitUpdater->clearUnitPrecache(this);
|
//unitUpdater->clearUnitPrecache(this);
|
||||||
unitUpdater->removeUnitPrecache(this);
|
unitUpdater->removeUnitPrecache(this);
|
||||||
|
@ -1233,8 +1245,7 @@ bool Unit::update() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(currSkill != currentAttackBoostUnits.first) {
|
// Remove any units that were previously in range
|
||||||
// First remove any units that were previosuly in range
|
|
||||||
if(currentAttackBoostUnits.second.size() > 0) {
|
if(currentAttackBoostUnits.second.size() > 0) {
|
||||||
for(unsigned int i = 0; i < currentAttackBoostUnits.second.size(); ++i) {
|
for(unsigned int i = 0; i < currentAttackBoostUnits.second.size(); ++i) {
|
||||||
// Remove attack boost upgrades from unit
|
// Remove attack boost upgrades from unit
|
||||||
|
@ -1245,7 +1256,6 @@ bool Unit::update() {
|
||||||
}
|
}
|
||||||
currentAttackBoostUnits.second.clear();
|
currentAttackBoostUnits.second.clear();
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
currentAttackBoostUnits.first = currSkill;
|
currentAttackBoostUnits.first = currSkill;
|
||||||
|
|
||||||
if(currSkill->isAttackBoostEnabled() == true) {
|
if(currSkill->isAttackBoostEnabled() == true) {
|
||||||
|
|
|
@ -352,6 +352,8 @@ public:
|
||||||
|
|
||||||
static void setGame(Game *value) { game=value;}
|
static void setGame(Game *value) { game=value;}
|
||||||
|
|
||||||
|
const std::pair<const SkillType *,std::vector<Unit *> > & getCurrentAttackBoostUnits() const { return currentAttackBoostUnits; }
|
||||||
|
|
||||||
//queries
|
//queries
|
||||||
void setIgnoreCheckCommand(bool value) { ignoreCheckCommand=value;}
|
void setIgnoreCheckCommand(bool value) { ignoreCheckCommand=value;}
|
||||||
bool getIgnoreCheckCommand() const {return ignoreCheckCommand;}
|
bool getIgnoreCheckCommand() const {return ignoreCheckCommand;}
|
||||||
|
|
Loading…
Reference in New Issue