← Back to team overview

widelands-dev team mailing list archive

Re: [Bug 530646] Re: Idle military people


Am Monday 08 March 2010 11:10:33 schrieb Timowi:
> I had a look at the code again and I think it's the following problem:
> A soldier launched from a militarysite has a task "buildingwork" and then
> task "attack" or "defense". Soldiers launched from a headquarter (or
> warehouse?) only have task "defense". If pop_task is called in the first
> case task "buildingwork" takes the solider home (or to a warehouse). In the
> second case the solider is forever at his last position without any task
> (But he is a worker of his building).
> Either calling pop_task without being home or something with the sending
> of soldiers from a headquarter is wrong. I am not completely familiar
> with the task system but I think pop_task should no be called if the
> worker is not at his building.

Keep in mind that's it's been a long time since I was really deep in that 
code. However: The case of an empty task stack is supposed to be handled by 
init_auto_task. Unless the soldier has 0 hit points left, this should be 
handled by Worker::init_auto_task which should start the gowarehouse task. 
However, it seems that the gowarehouse task then incorporates the worker 
without checking whether it is actually at the warehouse's position. That is 
bound to cause problems later on.

I suggest to add a check in gowarehouse_update which, instead of incorporating 
the worker, will zero out her location if she's not actually at the warehouse 
position. What do you think?

Idle military people
You received this bug notification because you are a member of Widelands
Developers, which is subscribed to widelands.

Status in Widelands: Confirmed

Bug description:
Full description here, only tracked here to be markes as show stopper for rc1


Follow ups