Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

Commit

Permalink
Change the default command for attacking units to attack.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammyjamjamman authored and andy5995 committed Jan 27, 2018
1 parent 018581a commit 2c4fc34
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/glest_game/type_instances/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ void Unit::born(const CommandType *ct) {
checkItemInVault(&this->hp,this->hp);
int original_hp = this->hp;


//set hp from start hp
checkItemInVault(&this->ep,this->ep);
if(type->getStartHpType() == UnitType::stValue) {
Expand Down Expand Up @@ -2251,9 +2251,10 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
}
}

//default command is move command
// Default command is the class of the unit (i.e. attack for attackers, walk for walkers.
if(commandType == NULL) {
commandType= type->getFirstCtOfClass(ccMove);
// Is the unit class warrior? if yes, attack by default, else walk.
commandType = type->getFirstCtOfClass(this->getType()->isOfClass(ucWarrior) ? ccAttack : ccMove);
}

return commandType;
Expand Down Expand Up @@ -2731,7 +2732,7 @@ bool Unit::update() {
int64 heightFactor = getHeightFactor(ANIMATION_SPEED_MULTIPLIER);
int64 speedDenominator = speedDivider *
game->getWorld()->getUpdateFps(this->getFactionIndex());

// Override the animation speed for attacks that have upgraded the attack speed
int animSpeed = currSkill->getAnimSpeed();
if(currSkill->getClass() == scAttack) {
Expand Down

0 comments on commit 2c4fc34

Please sign in to comment.