-Fix-ish: make clear the AI/GS List's Begin and Next return the item, not the value


git-svn-id: svn://svn.openttd.org@26734 6aa0318a-3be1-0310-93fa-89fd2396df07
-Fix (rmakefilerewrite): for profiling CFLAGS got a -p (for prof) and LDFLAGS got -pg (for gprof), but in the end gprof would be used (via make run-prof). Furthermore -pg isn't compatible with -fomit-frame-pointer on certain architectures (most importantly x86(_64)), so simply don't enable that flag when profiling is enabled


git-svn-id: svn://svn.openttd.org@26735 6aa0318a-3be1-0310-93fa-89fd2396df07
-Fix [Script]: infinite loop (by scripts; always returning the same item) when sorted by item in descending order by oddly constructed FindNext that uses forward iterators. Simply use the same code as the ascending item sort but use the reverse iterator instead of the forward. Also do this same trick for the descending value sort even though I couldn't trigger the problem there


git-svn-id: svn://svn.openttd.org@26736 6aa0318a-3be1-0310-93fa-89fd2396df07
-Fix (r26735): one = too many... why can't all languages use the same basic definition for comparisons?


git-svn-id: svn://svn.openttd.org@26737 6aa0318a-3be1-0310-93fa-89fd2396df07