Scout fails to scout properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Medium
|
Unassigned |
Bug Description
I ran into an endless loop with the scout being home, the tooltip telling me there were no ration while the building dialog showed it full and the debug message showing Starting / Updating scout endlessly at 20ms intervals.
I brwosed the sources and came up with this patch.
The patch apply against revision 5348 and, while the code structure might have changed a bit, it only add the following changes :
- After having tried undiscovered locations and then the old location, the scout will try to reach randomly all the locations on the closet frindge around him ; in the hope that a new reachable undiscovered location will be detected.
- If no reachable locations are found, it will fail.
I noticed than it never find a path to go home, but then the fail signal is emitted and it always manage to reach it at last. I don't know if it's an exploited workaround, but thats the reason why i added this call when no reachable locations are found.
I am wondering if the pathfinding algorythm in the start_task_movepath function is reliable, although i didn't manage to prove it wrong.
This is still not perfect, the scout might move randomly for some time, but at least it do not get stuck in his hut anymore. A possible fast improvment might be, when falling back to a random move, to try larger fringue first then closer ones if no reachable location can be found.
Best regards,
Charly
In fact that could be as easy as :MapFringeRegio n<>(map, Area<>( get_position( ), radius_size));
for (int radius_size=10; radius_size>1; radius_size--) {
mr = Widelands:
...
}