Skip to content

Commit

Permalink
Fix auto repair trying to repair systems that can't be repaired furth…
Browse files Browse the repository at this point in the history
…er (#2144)
  • Loading branch information
GinjaNinja32 authored Aug 23, 2024
1 parent 49b3b71 commit 0115b9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/repairCrew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ void RepairCrew::update(float delta)
if (ship->systems[system].hacked_level < 0.0f)
ship->systems[system].hacked_level = 0.0;
}
if (ship->auto_repair_enabled && pos == target_position && (system == SYS_None || !ship->hasSystem(system) || ship->systems[system].health == 1.0f))
if (ship->auto_repair_enabled && pos == target_position && (system == SYS_None || !ship->hasSystem(system) || ship->systems[system].health >= ship->systems[system].health_max))
{
int n=irandom(0, SYS_COUNT - 1);

if (ship->hasSystem(ESystem(n)) && ship->systems[n].health < 1.0f)
if (ship->hasSystem(ESystem(n)) && ship->systems[n].health < ship->systems[n].health_max)
{
for(unsigned int idx=0; idx<ship->ship_template->rooms.size(); idx++)
{
Expand Down

0 comments on commit 0115b9b

Please sign in to comment.