The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on December 13, 2008, 04:28:21 pm

Title: Weirdness in reading numbers from simuconf.tab
Post by: jamespetts on December 13, 2008, 04:28:21 pm
I have been working on a patch to increase vehicle maintenance of obsolete vehicles by a certain percentage value. After some difficulties, I have managed to get the basic code to work, but I have a rather odd problem: the values of the numbers being read from simuconf.tab do not seem to bear any meaningful relationship with the numbers that I have actually put into simuconf.tab. When, for testing purposes, I set it to multiply the costs by 400, it actually multiplied them by about 145. Even more weirdly, when I set the value in simuconf.tab to 800 instead of 400, it multiplied the costs by only about 33.

Are there any special considerations of which I am not aware that should be taken into account when reading numerical data from simuconf.tab? All that I know so far is that only integers can be read from that file. Any help would be much appreciated.

Edit: Incidentally, I tested the code by replacing "umgebung_t::obsolete_running_cost_increase_percent" with the actual numerical literal  (i.e. "400"), and the code worked as expected, so it is not the code for multiplying the cost itself that is the problem.
Title: Re: Weirdness in reading numbers from simuconf.tab
Post by: prissi on December 13, 2008, 08:51:34 pm
The mainanacne cost is devided by three for historic reasons ...
Title: Re: Weirdness in reading numbers from simuconf.tab
Post by: jamespetts on December 13, 2008, 08:53:33 pm
The mainanacne cost is devided by three for historic reasons ...

Ahh, excellent, thank you for telling me! I'll modify my code now.