Skip to content

Commit

Permalink
feat(UI): Include free cargo space in entire fleet in harvesting mess…
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeTroglodyte authored Aug 19, 2024
1 parent e2a970e commit af6ba79
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions source/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2434,12 +2434,21 @@ void Engine::DoCollection(Flotsam &flotsam)
}

// Unless something went wrong while forming the message, display it.
if(!message.empty())
{
int free = collector->Cargo().Free();
message += " (" + Format::CargoString(free, "free space") + " remaining.)";
Messages::Add(message, Messages::Importance::High);
}
if(message.empty())
return;

int free = collector->Cargo().Free();
int total = 0;
for(const shared_ptr<Ship> &ship : player.Ships())
if(!ship->IsParked() && ship->GetSystem() == player.GetSystem())
total += ship->Cargo().Free();

message += " (" + Format::CargoString(free, "free space") + " remaining";
if(free == total)
message += ".)";
else
message += ", " + Format::MassString(total) + " in fleet.)";
Messages::Add(message, Messages::Importance::High);
}


Expand Down

0 comments on commit af6ba79

Please sign in to comment.