Yeh, basically I changed (or rather, removed) the data part of the game because the code was old and not well written. Also is was tangled up with the graphics engine, so now it's lot more separated. The yield code is a good example of that. basically, the regions in the game are stored as a python dictionary:

Code:

regions = {}regions["greece"] = some_region_data

However, the graphics engine needs to see this as a flat list to iterate over. To do this we provide the helper routine:

Code:

def iterRegions(self): for i in regions.itertools(): yield i

That lets us use the code:

Code:

for i in iterRegions():

The yield statement returns the next region every time the function is called, so the whole function becomes an iterator.

Now you might say, why don't we just say for i in regions.itertools() in the GUI engine, but doing it this way means we can re-write the data part in the future any way we like, just so long as iterRegions() works. That is, this way we don't expose the way that the data code works to the gui engine.

It's sure more stable now and it seems like you corrected all the highlight issues. It feels like a game now The only think I couldn't understand is how moving units without making battles work?I hope you conclude 0.3.8 soon

pygasos wrote:It's sure more stable now and it seems like you corrected all the highlight issues. It feels like a game now The only think I couldn't understand is how moving units without making battles work?I hope you conclude 0.3.8 soon

Yeh, I THINK I have solved the highlighting stuff, although I'm sure a few more issues will appear.

The battle code is not yet finished, so expect more code later. Actually, I've still got a lot of other things to do in real life, but I will try to commit an evening to SPQR a week, to keep moving forward. I would suggest that 0.3.8 is almost here, maybe one or more weeks?