/**\brief Assignment constructor - copies all fields. */ Engine& Engine::operator= (const Engine& other) { Outfit(*this) = Outfit(other); name = other.name; thrustsound = other.thrustsound; forceOutput = other.forceOutput; foldDrive = other.foldDrive; flareAnimation = other.flareAnimation; return *this; }
/**\brief Ship constructor that initializes default values. */ Ship::Ship() { model = NULL; engine = NULL; flareAnimation = NULL; /* Initalize ship's condition */ damageBooster=1.0; engineBooster=1.0; shieldBooster=1.0; status.hullDamage = 0; status.shieldDamage = 0; status.lastWeaponChangeAt = 0; memset(status.lastFiredAt, 0, sizeof(status.lastFiredAt)); status.selectedWeapon = 0; status.cargoSpaceUsed = 0; status.isAccelerating = false; status.isRotatingLeft = false; status.isRotatingRight = false; status.isDisabled = false; for(int a=0;a<max_ammo;a++){ ammo[a]=0; } shipStats = Outfit(); SetRadarColor( RED ); SetAngle( float( rand() %360 ) ); }
/**\brief Assignment operator (Copy fields) */ Weapon& Weapon::operator=(const Weapon& other) { Outfit(*this) = Outfit(other); name = other.name; image = other.image; weaponType = other.weaponType; payload = other.payload; velocity = other.velocity; acceleration = other.acceleration; ammoType = other.ammoType; ammoConsumption = other.ammoConsumption; fireDelay = other.fireDelay; lifetime = other.lifetime; tracking = other.tracking; sound = other.sound; return *this; }