Changeset 9782e20 for src/Bond


Ignore:
Timestamp:
Mar 16, 2024, 10:22:34 AM (23 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, Candidate_v1.7.1, stable
Children:
19832d
Parents:
ad0929
git-author:
Frederik Heber <frederik.heber@…> (03/16/24 09:26:59)
git-committer:
Frederik Heber <frederik.heber@…> (03/16/24 10:22:34)
Message:

BondifyAction: added undo/redo.

  • DOC: fixed small typo in Action's explanation.
  • TEST: added regression test (also undo/redo).
Location:
src/Bond
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Bond/BondInfo.cpp

    rad0929 r9782e20  
    8585}
    8686
    87 void BondInfo::RemoveBond() const
     87bool BondInfo::RemoveBond() const
    8888{
    8989  atom * const leftatom = World::getInstance().getAtom(AtomById(leftid));
    9090  atom * const rightatom = World::getInstance().getAtom(AtomById(rightid));
    91   leftatom->removeBond(rightatom);
     91  if (leftatom->IsBondedTo(rightatom)) {
     92    leftatom->removeBond(rightatom);
     93    return true;
     94  }
     95  return false;
    9296}
  • src/Bond/BondInfo.hpp

    rad0929 r9782e20  
    3939  /** Removes the bond whose state is contained in this BondInfo.
    4040   *
     41   * @return true - bond removed, false - bond does not exist
    4142   */
    42   void RemoveBond() const;
     43  bool RemoveBond() const;
    4344
    4445  //!> id of left bond partner
Note: See TracChangeset for help on using the changeset viewer.