This small patch (against r2848 relative to the trunk folder) fixes a small bug :
ctg should actually be
add_catg_index[ctg].
It also changes the warenziele building loops so as to reduce the number of iterations required.
We must invent a new "Code diver" batch for you :)
Edit: Thanks for finding all these quirks and fixing them!
Yeah, this code review is indeed extremely helpful. Thank you.
It is just a small contribution, and it is my honour to be able to help :)
@ Prissi
Sorry for asking, but may I know why there are 2 loops that increment
ctg??
Does the inner do-while loop serve some special purpose?
Because if goods are enabled, this means all goods are accepted there. p****=0, mail=1, all other goods>=2. THus the additional test above is not needed.
However, the category indices in both add_catg_index (of lineless convoys) and goods_catg_index (of lines) are not sorted. Bulk goods may be processed before pax/mail, and if unfortunately pax/mail are not supported by the halt, warenziele will be wrong. Thus, there is no guarantee that the inner do-while loop works correctly under all circumstances.
Incidentally, you may just declare add_catg_index as a minivec instead of vector like a line's goods_catg_index.