Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. //Finds the ship with a right name and removes it from ships_ vector
  2. void Galaxy::removeShip(std::shared_ptr<Common::Ship> ship){
  3. if (!ships_.empty()){
  4. for (auto &i : ships_){
  5. std::shared_ptr<Common::Ship> temp = ships_[i];
  6. if ( temp->getName() == ship->getName())
  7. {
  8. ships_.erase(i);
  9. return;
  10. }
  11. }
  12. }
  13. throw( Common::StateException("Ship does not exist. Can not be removed."));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement