77#define TIME_STEP 32
88
99int main (int argc , char * * argv ) {
10- bool configured = false, received = false;
1110 ts_setup (argv [0 ]);
1211
13- while (!configured ) { // receive message sent by the robot window.
12+ const char * configure_message ;
13+ for (;;) { // receive message sent by the robot window.
1414 wb_robot_step (TIME_STEP );
15- const char * configure_message ;
16- while ((configure_message = wb_robot_wwi_receive_text ())) {
15+ if ((configure_message = wb_robot_wwi_receive_text ())) {
1716 if (strcmp (configure_message , "configure" ) == 0 ) {
18- configured = true;
1917 wb_robot_wwi_send_text ("test wwi functions from robot_window_html controller." );
2018 break ;
2119 } else
@@ -25,14 +23,13 @@ int main(int argc, char **argv) {
2523
2624 printf ("CONFIGURED!!!!\n" );
2725
28- while (!received ) { // receive message sent by Webots.
26+ const char * test_message ;
27+ for (;;) { // receive message sent by Webots.
2928 wb_robot_step (TIME_STEP );
30- const char * test_message ;
31- while ((test_message = wb_robot_wwi_receive_text ())) {
32- if (strcmp (test_message , "Answer: test wwi functions from robot_window_html controller." ) == 0 ) {
33- received = true;
29+ if ((test_message = wb_robot_wwi_receive_text ())) {
30+ if (strcmp (test_message , "Answer: test wwi functions from robot_window_html controller." ) == 0 )
3431 break ;
35- } else
32+ else
3633 ts_send_error_and_exit ("Wrong test message received from the HTML robot-window: %s" , test_message );
3734 }
3835 }
0 commit comments