The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: neroden on April 12, 2010, 12:14:39 am

Title: What is the status of the conditional compilation directives?
Post by: neroden on April 12, 2010, 12:14:39 am
Which of these still really have both versions used?

# DOUBLE_GROUNDS: Enables two height tiles
I'm particularly wondering about this.  There's a *lot* of code with two different versions here.  Is the DOUBLE_GROUNDS version
currently used by anyone; planned to be used for the future; or a leftover from a project which has been abandoned?

I was thinking of translating ribi.h and the files using it into English, but I realized I have to translate two different versions of it, one with DOUBLE_GROUNDS and one without, and make sure that both compile correctly.  :-/  Unless DOUBLE_GROUNDS is either obsolete or can be turned on permanently.

# OTTD_LIKE: Enables half height tiles and crossconnected industries; defaul folder pak.ttd/
Cross-connected factories can be enabled in the pak config file, and the default pak folder is no longer used now that there's a pak selector.  And the half height tiles are enabled by HALF_HEIGHT.  Can this be removed?

# STEPS16: 16 steps per tile - nicer on pak64
And this one seems to be always on -- and it doesn't seem to do anything any more!  Is there a reason it's still in the config file -- can it be removed?
Title: Re: What is the status of the conditional compilation directives?
Post by: Dwachs on April 12, 2010, 05:07:46 am
DOUBLE_GROUNDS: this is an incomplete implementation of a double-height system. Afaik it does not compile. Imho this can be deleted. (If you want to translate ribi,h please also translate the corner1..4 macros, they should go into ribi.h anyway I think)

HALF_HEIGHT is mandatory if one wants to use TTD-Graphics, since in TTD (and its relatives) heights are half the heigts as in simutrans. Should not get removed.

STEPS16 can be deleted. Not used anymore.
Title: Re: What is the status of the conditional compilation directives?
Post by: neroden on April 12, 2010, 07:00:54 am
DOUBLE_GROUNDS: this is an incomplete implementation of a double-height system. Afaik it does not compile. Imho this can be deleted. (If you want to translate ribi,h please also translate the corner1..4 macros, they should go into ribi.h anyway I think)
OK, thanks.... I'll wait to see if anyone else thinks DOUBLE_GROUNDS should stay....

Quote
HALF_HEIGHT is mandatory if one wants to use TTD-Graphics, since in TTD (and its relatives) heights are half the heigts as in simutrans. Should not get removed.
I was referring to removing the OTTD_LIKE define, not HALF_HEIGHT.

Quote
STEPS16 can be deleted. Not used anymore.
OK thanks!
Title: Re: What is the status of the conditional compilation directives?
Post by: Dwachs on April 12, 2010, 08:24:14 am
Imho OTTD_LIKE can stay, as there is no gain in removing it. It is there for convenience of those who want to compile Simutrans with opentdd-settings: half height slopes and industries interconnected (as goods have no destinations in openttd).
Title: Re: What is the status of the conditional compilation directives?
Post by: prissi on April 12, 2010, 11:16:44 am
DOUBLE_GROUNDS was working fine; the only problem is that the rendering code is not extended to two height steps. If you do that (and can live with the many transition images) then DOUBLE_GOURNDS could be restored easily.

OTTD_LIKE is just an abbreviation. I would lkie to keep it in.

STEPS_16 is only needed for the old system, which is no longer in the code and can go.
Title: Re: What is the status of the conditional compilation directives?
Post by: Dwachs on April 12, 2010, 11:37:18 am
Simutrans does not compile with DOUBLE_GROUNDS anymore though.

@prissi: did you test the double-height code with the clipping routines?
Title: Re: What is the status of the conditional compilation directives?
Post by: prissi on April 12, 2010, 02:38:20 pm
No, as there are no suitable textures for double ground mode. I would need to use the old standard ground (which would be easy to add again, though).

However, there might be some other places that need a fix; espeically some underground mode stuff. But double grounds worked fine back then.
Title: Re: What is the status of the conditional compilation directives?
Post by: neroden on April 12, 2010, 05:59:14 pm
DOUBLE_GROUNDS was working fine; the only problem is that the rendering code is not extended to two height steps. If you do that (and can live with the many transition images) then DOUBLE_GOURNDS could be restored easily.

It looks like it makes some heavily used data structures significantly larger.  I guess this is not a practical problem for performance?

I can certainly do my best to update both compilation alternatives, but the codebase doesn't compile with DOUBLE_GROUNDS right now, and in a pretty serious way (missing subroutines) so it may be already badly bitrotted:

boden/brueckenboden.cc:100: error: ���rotate90��� is not a member of ���hang_t���

EDIT: Attached is a patch to clean up STEPS16, and remove the dead code related to the now-irrelevant default pak.

(EDIT: The patch is also on my git repository at github at neroden/simutrans in the 'standard' branch.  EDiT: not anymore.... only copy is here now...)
Title: Re: What is the status of the conditional compilation directives?
Post by: prissi on April 15, 2010, 10:01:25 am
As rotation came after double step heights, missing rotation routines for double heights are not so surprising ...
Title: Re: What is the status of the conditional compilation directives?
Post by: neroden on April 18, 2010, 06:55:36 pm
I found another one: USE_16BIT_DIB.  It seems to be turned on unconditionally -- repeatedly.  It's turned on in the Makefile for SDL targets -- which don't care about it.  Then it's turned on again by a #define in simsys_w16.cc. 

Even when it's turned off, much of the code appears to be the same, notably this:
Code: [Select]
#ifdef USE_16BIT_DIB
    settings.dmBitsPerPel = 16;
#else
    settings.dmBitsPerPel = 16;
#endif

It's also turned on, always, in simsys_w8.cc, which appears to be used only if COLOUR_DEPTH=8.  These are the only two files which use it at all.

I don't really understand the code (it seems to be Windows-only), but it looks like this switch may be entirely obsolete; I can prepare a patch to eliminate the switch (leaving it on all the time).  If not, perhaps I could at least take it out of the Makefile.
Title: Re: What is the status of the conditional compilation directives?
Post by: VS on April 18, 2010, 07:52:17 pm
I have just glanced at the code so far, but this feels a lot like the latter number should be 15 (so it's a bug).

Of course, if it's dead, the point is moot :)
Title: Re: What is the status of the conditional compilation directives?
Post by: prissi on April 18, 2010, 08:19:02 pm
Actually, you can have either 15 or 16 bit per pixels; the latter is always supported, but slower and less pretty. Thus I have either 15 or 16 bit per pixel.