The International Simutrans Forum

Development => Patches & Projects => Topic started by: neroden on July 11, 2010, 04:10:28 AM

Title: [cleanup patch] move #include directive to top of file
Post by: neroden on July 11, 2010, 04:10:28 AM
It's not good form to put an #include directive in the middle of a file, but such a thing was introduced recently.  This patch fixes this.

(Intended to be applied after the compilation / const correctness fix.)  EDIT: But can be applied independently.
Title: Re: [cleanup patch] move #include directive to top of file
Post by: prissi on July 11, 2010, 09:18:44 PM
Since all those stettings are pretty much independent, I did it this way (to show that this is only needed to climate_stats). I intended it to do it this way also for forest and citystats. You give a valid argument, and a comment could achieve the same. I feel this warrants a little more discussion on how to proceed. (Although I actually nearly convinced (together with a comment).
Title: Re: [cleanup patch] move #include directive to top of file
Post by: neroden on July 11, 2010, 10:17:10 PM
Quote from: prissi on July 11, 2010, 09:18:44 PM
Since all those stettings are pretty much independent, I did it this way (to show that this is only needed to climate_stats). I intended it to do it this way also for forest and citystats. You give a valid argument, and a comment could achieve the same. I feel this warrants a little more discussion on how to proceed. (Although I actually nearly convinced (together with a comment).

Comments are good.  :-)  Actually, perhaps each of the #include lines should have a comment right above it explaining why that header is needed.  That's what I do in my own code sometimes.