News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Remove the Goods-Tab in powerplants that don't require goods

Started by Leartin, December 15, 2020, 04:53:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leartin

There are several powerplants in the game that don't require any goods to function - solar, wind, geothermic etc.
Currently, they all still show a goods-tab with an empty diagram. This patch removes the goods tab if there is neither an input nor an output, similar to how the details-tab is optional.

It does so by getting the input and output count a bit earlier and packing everything in an if clause for when either is larger zero.

I attached the patch more or less for completions sake - probably faster to just do it manually then to try and see what I changed (due to indentation, many lines were changed, while practically 5 lines were moved and an if-clause added)


prissi

Your patch is not even C++ but I get the idea. In in r9502

Leartin

Could you be more specific so I don't make the same mistake in the future?

Are you referring to the file itself (I thought a git diff is what's required) or is it the use of "or" instead of "||"? (It's part of the language, it should work with any compiler, but since it's not what C-programmers normally use, I can see it as a style problem)

prissi

or is neither a reserved keyword nor an existing operator in vanilla C++ Maybe boost defines or, but my compiler just gives the error message for undefined symbol.


prissi

Ok, I did know about trigraph (or rather their lack of support in GCC), but this was new to me.

It seems, their usage is only safe when including the header file <iso646.h> resp. <ciso646>. Cxx++ Compilers do not need to natively support them, if I completely follow this, although I could not really find the statement when this xx actually changed. (Which makes sense, I even have written C programs where "or" stood for over_range (and "ur" for under_range), and I vaguely remember some numerical recipes code [which predates C95 of course].) So having these keywords optional is a good idea.