The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: gerw on December 08, 2008, 09:40:58 pm

Title: [patch] reduce size of warenbauer_t::max_catg_index
Post by: gerw on December 08, 2008, 09:40:58 pm
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.
Title: Re: [patch] reduce size of warenbauer_t::max_catg_index
Post by: prissi on December 08, 2008, 10:13:38 pm
Many engines transport nothing, as well as tenders ...
Title: Re: [patch] reduce size of warenbauer_t::max_catg_index
Post by: gerw on December 08, 2008, 10:27:47 pm
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.
Title: Re: [patch] reduce size of warenbauer_t::max_catg_index
Post by: prissi on December 09, 2008, 09:30:09 pm
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.
Title: Re: [patch] reduce size of warenbauer_t::max_catg_index
Post by: gerw on December 10, 2008, 09:03:50 am
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.
Title: Re: [patch] reduce size of warenbauer_t::max_catg_index
Post by: prissi on December 10, 2008, 07:46:39 pm
Nothing against clean up the code and remove those hardcoded entries ... (if I have not done this already, I am getting old ... )