<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39476 >
This seems better to remain an indexing iterator (almost all usage is the
index number, no pointer needed), but the name translation and other
standard accessors were needed. Several obscure bugs fixed!
Others that seem better to remain indexing iterators, side-effects removed:
Committed revision 13169.
At this point, all the "_index" overloading has been eliminated or
qualified (usually _tile##_index, where _tile is a variable parameter).
Of course, there are more that use other (unqualified) overloading.
Both base and specialist had (minor) name translation problems --
converted to use the new translation structure.
Also, in client/tilespec, citizen specialist names were accessed
(they don't exist, so it generated a random memory location) and then a
quick test skipped using the bad value. When I added more tests, and
returned NULL instead of something random, it became a reliable crash!
So, I changed the order of the enum, and run the for loop only up to
CITIZEN_SPECIALIST. I don't see any problem with the change, but the
code assumptions aren't well documented. So, we'll wait and see....
Meanwhile, I added some error checking in client/packhand for passed
array sizes, matching similar stuff in server/ruleset. Lots more to do
in that regard.
Folks, you cannot trust data that comes over the network!
Freeciv-dev mailing list