-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi,
I have a question about the usage of restart() when subclassing Simulation.
The main loop in simulation.cpp starts like this:
while ( ( noGraphics || !viewer->done()) &&
(!simulation_time_reached || restart(odeHandle,osgHandle,globalData)) ) {
Two issues. First of all, setting restart() to return TRUE doesn't always exit this look, because of the logic of the condition. Secondly, restart() is often not called at all! I think that's because if C++ figure that !simulation_time_reached is TRUE then there's no point in executing restart().
I would propose the following:
while ( ( noGraphics || !viewer->done()) &&
(!simulation_time_reached && restart(odeHandle,osgHandle,globalData)) ) {
This seems to work for me. If I return TRUE, the main loop exits. If I return FALSE it doesn't. The restart() function always gets executed (unless the loop is exitting for some other reason).
What do you think?
Thanks
Simon
Metadata
Metadata
Assignees
Labels
No labels