Skip to content

Commit

Permalink
Fix compilation for Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed Dec 17, 2023
1 parent 2258a0b commit 1005a4b
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src/Net/TimedTokens.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,6 @@ struct TimedToken
//--------------------------------------------------------------------------
TimedToken(Arc& arc_, size_t const tokens_, TypeOfNet const type_);

// 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
//--------------------------------------------------------------------------
TimedToken& operator=(const TimedToken& obj)
{
this->~TimedToken(); // destroy
new (this) TimedToken(obj); // copy construct in place
return *this;
}

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

#else

//--------------------------------------------------------------------------
//! \brief Hack needed because of references
//--------------------------------------------------------------------------
Expand All @@ -82,14 +61,14 @@ struct TimedToken
//! \brief Needed to remove compilation warnings
//--------------------------------------------------------------------------
TimedToken(TimedToken const& other)
: TimedToken(other.arc, other.tokens)
: TimedToken(other.arc, other.tokens, other.type)
{}

//--------------------------------------------------------------------------
//! \brief Needed to remove compilation warnings
//--------------------------------------------------------------------------
TimedToken(TimedToken&& other)
: TimedToken(other.arc, other.tokens)
: TimedToken(other.arc, other.tokens, other.type)
{}

//--------------------------------------------------------------------------
Expand All @@ -102,8 +81,6 @@ struct TimedToken
return *this;
}

#endif

//--------------------------------------------------------------------------
//! \brief Update position on the screen.
//! \param[in] dt: the delta time (in seconds) from the previous call.
Expand Down

0 comments on commit 1005a4b

Please sign in to comment.