Skip to main content
Topic: [patch] reduce size of warenbauer_t::max_catg_index (Read 4384 times) previous topic - next topic

[patch] reduce size of warenbauer_t::max_catg_index

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.

Re: [patch] reduce size of warenbauer_t::max_catg_index

Reply #1
Many engines transport nothing, as well as tenders ...

Re: [patch] reduce size of warenbauer_t::max_catg_index

Reply #2
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.

Re: [patch] reduce size of warenbauer_t::max_catg_index

Reply #3
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.

Re: [patch] reduce size of warenbauer_t::max_catg_index

Reply #4
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.

Re: [patch] reduce size of warenbauer_t::max_catg_index

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