Skip to content

Commit 897d479

Browse files
committed
Fix grid staying in red
1 parent 2be68fe commit 897d479

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/Editor/Editor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,10 @@ bool Editor::switchOfNet(TypeOfNet const type)
568568
std::vector<Arc*> arcs;
569569
std::string error_msg;
570570
if (convertTo(net(), type, error_msg, arcs))
571+
{
572+
simulation().validateReceptivities();
571573
return true;
574+
}
572575

573576
m_messages.setError(error_msg);
574577
return false;

src/PetriNet/Simulation.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ void Simulation::handleSimulatingState(float const dt)
246246
bool Simulation::compileReceptivities()
247247
{
248248
if (m_net.type() != TypeOfNet::GRAFCET)
249+
{
250+
m_has_receptivity_errors = false;
249251
return true;
252+
}
250253

251254
// Save existing sensor values
252255
std::map<std::string, int, std::less<>> saved_values;
@@ -306,6 +309,12 @@ bool Simulation::validateReceptivities()
306309
return all_ok;
307310
}
308311

312+
//------------------------------------------------------------------------------
313+
bool Simulation::hasReceptivityErrors() const
314+
{
315+
return m_net.type() == TypeOfNet::GRAFCET && m_has_receptivity_errors;
316+
}
317+
309318
//------------------------------------------------------------------------------
310319
bool Simulation::compileReceptivity(Transition const& transition)
311320
{

src/PetriNet/Simulation.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class Simulation
153153
//--------------------------------------------------------------------------
154154
//! \brief Check if there are any receptivity parsing errors (GRAFCET).
155155
//--------------------------------------------------------------------------
156-
inline bool hasReceptivityErrors() const { return m_has_receptivity_errors; }
156+
bool hasReceptivityErrors() const;
157157

158158
//--------------------------------------------------------------------------
159159
//! \brief Validate receptivities without starting simulation.

0 commit comments

Comments
 (0)