News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Code cleanup: Use obj_besch_timelined::is_available()

Started by eipi, October 19, 2013, 08:40:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eipi

Hi,

here's a small patch adding an is_available() method to obj_besch_timelined_t, and crossing_besch_t is now derived from obj_besch_timelined_t.
This should reduce code duplication in a lot of places.


prissi

Indeed, looks fine. Please use double space for && || etc. in if/while/for ...

kierongreen

#3
Committing with minor changes to formatting (actually lines in this patch mainly had double spaces it was several around that I noticed).

Edit: Or would have if I could get trunk to compile to test...

Edit2: Attached patch which may (or may not) work as I can't test currently.

Ters

Quote from: kierongreen on October 19, 2013, 09:52:08 PM
Committing with minor changes to formatting (actually lines in this patch mainly had double spaces it was several around that I noticed).

Edit: Or would have if I could get trunk to compile to test...

Edit2: Attached patch which may (or may not) work as I can't test currently.

My eyes for details report that there is still inconsistent use of spaces in your patch (by that I mean in modified lines, not old code). Not that I care much about that.

kierongreen

Quote from: Ters on October 19, 2013, 10:47:15 PM
My eyes for details report that there is still inconsistent use of spaces in your patch (by that I mean in modified lines, not old code). Not that I care much about that.

Well one problem is this:
Do not forget brackets along comparisons and use double spaces around
logical operators. Avoid spaces before the comparison operator:
Quoteif((i&3)==1   &&  ptr==NULL) {

You may also use double spaces after/before the brackets:
if(  (i&3)==1   &&  ptr==NULL  ) {

No space between if/while/for and bracket is allowed.
Which is not consistent with the frequent use of padding comparison operators with single spaces. I tried correcting some but really it would need a far bigger tidy to get them all.

eipi

Patch updated to r6833. I think I have found and fixed all the wrong whitespace in the last patch.  :)

kierongreen