@todo TODO Refactor this entirely
| 194 | } |
| 195 | /// @todo TODO Refactor this entirely |
| 196 | void UnitImpl::updateData() |
| 197 | { |
| 198 | BW::CUnit *o = getOriginalRawData; |
| 199 | self->isUnderDarkSwarm = false; |
| 200 | self->isUnderDWeb = false; |
| 201 | if (canAccess()) |
| 202 | { |
| 203 | self->positionX = _getPosition.x; //getPosition |
| 204 | self->positionY = _getPosition.y; //getPosition |
| 205 | //------------------------------------------------------------------------------------------------------ |
| 206 | //getAngle |
| 207 | int d = o->currentDirection1; |
| 208 | d -= 64; |
| 209 | if (d < 0) |
| 210 | d += 256; |
| 211 | |
| 212 | self->angle = (double)d * 3.14159265358979323846 / 128.0; |
| 213 | self->velocityX = (double)o->current_speed.x / 256.0; //getVelocityX |
| 214 | self->velocityY = (double)o->current_speed.y / 256.0; //getVelocityY |
| 215 | //------------------------------------------------------------------------------------------------------ |
| 216 | self->groundWeaponCooldown = o->getGroundWeaponCooldown(); //getGroundWeaponCooldown |
| 217 | self->airWeaponCooldown = o->getAirWeaponCooldown(); //getAirWeaponCooldown |
| 218 | self->spellCooldown = o->spellCooldown; //getSpellCooldown |
| 219 | |
| 220 | self->isAttacking = o->isAttacking(); |
| 221 | |
| 222 | // startingAttack |
| 223 | int airWeaponCooldown = o->getAirWeaponCooldown(); |
| 224 | int groundWeaponCooldown = o->getGroundWeaponCooldown(); |
| 225 | bool startingAttack = (airWeaponCooldown > lastAirWeaponCooldown || groundWeaponCooldown > lastGroundWeaponCooldown) && o->isAttacking(); |
| 226 | lastAirWeaponCooldown = airWeaponCooldown; |
| 227 | lastGroundWeaponCooldown = groundWeaponCooldown; |
| 228 | |
| 229 | self->isStartingAttack = startingAttack; //isStartingAttack |
| 230 | |
| 231 | //isAttackFrame |
| 232 | self->isAttackFrame = false; |
| 233 | const BW::CUnit* damageDealer = o->getDamageDealer(); |
| 234 | if (damageDealer->sprite && damageDealer->sprite->pImagePrimary) |
| 235 | { |
| 236 | int restFrame = _getType.isValid() ? AttackAnimationRestFrame[_getType] : -1; |
| 237 | self->isAttackFrame = startingAttack || |
| 238 | (self->isAttacking && |
| 239 | restFrame != -1 && |
| 240 | (damageDealer->sprite->pImagePrimary->frameSet != restFrame || |
| 241 | lastFrameSet != restFrame) ); |
| 242 | lastFrameSet = damageDealer->sprite->pImagePrimary->frameSet; |
| 243 | } |
| 244 | |
| 245 | self->isBurrowed = o->statusFlag(BW::StatusFlags::Burrowed); //isBurrowed |
| 246 | self->isCloaked = o->statusFlag(BW::StatusFlags::Cloaked) && !o->statusFlag(BW::StatusFlags::Burrowed); //isCloaked |
| 247 | self->isCompleted = _isCompleted; //isCompleted |
| 248 | self->isMoving = o->movementFlag(BW::MovementFlags::Moving | BW::MovementFlags::Accelerating) || |
| 249 | self->order == Orders::Move; //isMoving |
| 250 | } |
| 251 | else |
| 252 | { |
| 253 | self->positionX = BWAPI::Positions::Unknown.x; //getPosition |
nothing calls this directly
no test coverage detected