Colobot Forum - International Colobot Community

Full Version: Thread Modes mysterious try...catch block
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried try...catch block.
And saw strange work that block.
I have two flags: BlueFlag and VioletFlag, for example.
Distance between two flags about 100m.
My Bot moves between these flags.
Code:
extern void object::test()
{
   try
   {
       while(true)
       {
           goto(radar(VioletFlag).position);
           goto(radar(BlueFlag).position);
       }
   }
   catch(energyCell.energyLevel < 0.8)
   {
       message("Energy low");
       goto(radar(PowerStation).position);
   }
}

When Energy is lower 0.8, message "Energy low" appears, but the Bot continues to moves to one of the flags,
and then moves to the PowerStation.

The goto(radar(xxxFlag).position) command is not interrupted
Why?
It's a known bug. That's why it was never officially documented in original Colobot. See https://github.com/colobot/colobot/issues/474