Skip to content

Commit

Permalink
Dealing with merge conflicts yaaaaaaay
Browse files Browse the repository at this point in the history
  • Loading branch information
DPavonis committed Oct 13, 2024
1 parent 05fb2b1 commit 4c331c6
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10874,31 +10874,36 @@ bool item::uses_energy() const

units::energy item::energy_remaining( const Character *carrier ) const
{
if( !uses_energy() ) {
return 0_kJ;
}
units::energy ret = 0_kJ;
return energy_remaining( carrier, false );
}

// Future energy based batteries
if( is_vehicle_battery() ) {
ret += energy;
}
units::energy item::energy_remaining( const Character *carrier, bool ignoreExternalSources ) const
{
units::energy ret = 0_kJ;

// Magazine in the item
const item *mag = magazine_current();
if( mag ) {
ret += mag->energy_remaining( carrier );
}

// Power from bionic
if( carrier != nullptr && has_flag( flag_USES_BIONIC_POWER ) ) {
ret += carrier->get_power_level();
}
if( !ignoreExternalSources ) {

// Extra power from UPS
if( carrier != nullptr && has_flag( flag_USE_UPS ) ) {
ret += carrier->available_ups();
}
// Future energy based batteries
if( is_vehicle_battery() ) {
ret += energy;
}

// Power from bionic
if( carrier != nullptr && has_flag( flag_USES_BIONIC_POWER ) ) {
ret += carrier->get_power_level();
}

// Extra power from UPS
if( carrier != nullptr && has_flag( flag_USE_UPS ) ) {
ret += carrier->available_ups();
}
};

// Battery(ammo) contained within
if( is_magazine() ) {
Expand Down

0 comments on commit 4c331c6

Please sign in to comment.