Skip to content

Commit

Permalink
Merge pull request #159 from RoboCup-SSL/bugfix/restart-simulation-flag
Browse files Browse the repository at this point in the history
Reset flag for restarting simulation after consumption
  • Loading branch information
mahi97 authored Apr 17, 2021
2 parents efc2621 + 1124f3d commit 206c8dc
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,19 @@ void MainWindow::changeBallDamping()

void MainWindow::restartSimulator()
{
delete glwidget->ssl;
glwidget->ssl = new SSLWorld(glwidget,glwidget->cfg,glwidget->forms[FORMATION_INSIDE_1],glwidget->forms[FORMATION_INSIDE_1]);
glwidget->ssl->glinit();
glwidget->ssl->visionServer = visionServer;
glwidget->ssl->commandSocket = commandSocket;
glwidget->ssl->blueStatusSocket = blueStatusSocket;
glwidget->ssl->yellowStatusSocket = yellowStatusSocket;
glwidget->ssl->simControlSocket = simControlSocket;
glwidget->ssl->blueControlSocket = blueControlSocket;
glwidget->ssl->yellowControlSocket = yellowControlSocket;
auto newWorld = new SSLWorld(glwidget,glwidget->cfg,glwidget->forms[FORMATION_INSIDE_1],glwidget->forms[FORMATION_INSIDE_1]);
newWorld->glinit();
newWorld->visionServer = visionServer;
newWorld->commandSocket = commandSocket;
newWorld->blueStatusSocket = blueStatusSocket;
newWorld->yellowStatusSocket = yellowStatusSocket;
newWorld->simControlSocket = simControlSocket;
newWorld->blueControlSocket = blueControlSocket;
newWorld->yellowControlSocket = yellowControlSocket;

auto oldWorld = glwidget->ssl;
glwidget->ssl = newWorld;
delete oldWorld;
}

void MainWindow::ballMenuTriggered(QAction* act)
Expand Down Expand Up @@ -600,6 +603,7 @@ void MainWindow::simControlSocketReady()
{
glwidget->ssl->simControlSocketReady();
if (glwidget->ssl->restartRequired) {
glwidget->ssl->restartRequired = false;
restartSimulator();
}
}
Expand Down

0 comments on commit 206c8dc

Please sign in to comment.