News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

[patch] reduce size of warenbauer_t::max_catg_index

Started by gerw, December 08, 2008, 09:40:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gerw

This patch will reduce the size of warenbauer_t::max_catg_index. The decrease depends on the used pakset (for both pak/ and pak.german/ it's 3). Now warenbauer_t::load_nichts gets no catg_index, I think it will never be used (who will transport nothing?) - but I don't overlooking the whole code.

As a result this code will save some memory in haltestelle_t.

prissi

Many engines transport nothing, as well as tenders ...

gerw

Yes, but do they need the catg_index of nichts?

Edit:
An other suggestion: Is it possible to set the pointer of vehicles, wich can't transport something, to NULL? Then there is no longer a need for warenbauer_t::nichts.

prissi

Yes, everything is possible. For connections a connection for nothing is not needed anyway. But I think somewhere indexes where hardcodes to 0, 1, and 2.

gerw

Quote from: prissi on December 09, 2008, 09:30:09 PM
But I think somewhere indexes where hardcodes to 0, 1, and 2.
But this is not very OOP ;)

Edit:
You can neglect the changes of lines 61,63 and 67. Then load_nichts.catg_index is 2 and everything is fine.

prissi

Nothing against clean up the code and remove those hardcoded entries ... (if I have not done this already, I am getting old ... )