Comment 4 for bug 583985

Revision history for this message
Nicolai Hähnle (nha) wrote :

Some more explanations to the short list above.

1. It's very plain why the current returning code fails: it tries to walk directly onto the position of the building, which would only work with forceonlast == true, but that would be incorrect, because we need to enter buildings via their flag. That's why that kind of stuff should be left to the existing 'return' task.

2. Every program action needs to increment the program counter (state.ivar1) unless it needs to be run again on next act(). This is what was causing the infinite Start/Update scout loop.

3. When time values wrap around, they are no longer growing monotonically. Rewrite that test as if (static_cast<int32_t>(state.ivar1 - game.get_gametime()) > 0), and everybody will live in peace.

4. Only ever ignore signals if you know where they're coming from. This doesn't seem to be the case here.

5. A persist == 0 findpath will *never* give up unless it has visited *all* fields of the map that are accessible from the starting point. So if you have a huge map, and there happens to be a small island in undiscovered country, you will have a call to findpath() for *every* *field* of that island that will look at *every* *field* of the huge map. Congratulations, you've just utterly killed performance.