Skip to content

Commit

Permalink
Partial revert "Fixing warnings and cleaning some docs" #3
Browse files Browse the repository at this point in the history
SHA1 50ff00c

Seem that regression with disapearing tokens has been introduced by this
commit. Since I cannot catch it on unit test I prefer reverting.
  • Loading branch information
Lecrapouille committed May 29, 2022
1 parent c844276 commit c99743d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/utils/Animation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ struct AnimatedToken
speed = magnitude / arc.duration;
}

// I dunno why the code in the #else branch seems to make buggy animations with
// tokens that disapear. Cannot catch it by unit tests.
// https://github.com/Lecrapouille/TimedPetriNetEditor/issues/2
# if 1

//--------------------------------------------------------------------------
//! \brief Hack needed because of references
//--------------------------------------------------------------------------
AnimatedToken& operator=(const AnimatedToken& obj)
{
this->~AnimatedToken(); // destroy
new (this) AnimatedToken(obj); // copy construct in place
return *this;
}

AnimatedToken(const AnimatedToken&) = default;
AnimatedToken(AnimatedToken&&) = default;
AnimatedToken& operator=(AnimatedToken&&) = default;

#else

//--------------------------------------------------------------------------
//! \brief Hack needed because of references
//--------------------------------------------------------------------------
Expand Down Expand Up @@ -86,6 +107,7 @@ struct AnimatedToken
new (this) AnimatedToken(other); // copy construct in place
return *this;
}
#endif

//--------------------------------------------------------------------------
//! \brief Update position on the screen.
Expand Down

0 comments on commit c99743d

Please sign in to comment.