sources » UnitClass » Reload
void UnitClass::Reload() {
if ( !this->UnitType->MobileFire ) {
if ( this->Locomotion->IsMoving() ) {
reloadStartFrame = this->ReloadTimer.StartingFrame;
reloadDuration = this->ReloadTimer.Duration;
if ( reloadStartFrame != -1 ) {
if ( CurrentFrame - reloadStartFrame >= reloadDuration ) {
TechnoClass::Reload(this);
return;
}
reloadDuration -= CurrentFrame - reloadStartFrame;
}
if ( reloadDuration > 0 ) {
reloadStartFrame = this->ReloadTimer.StartingFrame;
reloadDuration = this->ReloadTimer.Duration;
if ( reloadStartFrame != -1 ) {
if ( CurrentFrame - reloadStartFrame >= reloadDuration )
reloadDuration = 0;
else
reloadDuration -= CurrentFrame - reloadStartFrame;
}
this->ReloadTimer.StartingFrame = CurrentFrame;
this->ReloadTimer.Duration = reloadDuration + 1;
}
}
}
TechnoClass::Reload(this);
}