News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Weirdness in reading numbers from simuconf.tab

Started by jamespetts, December 13, 2008, 04:28:21 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

The mainanacne cost is devided by three for historic reasons ...

jamespetts

Quote from: prissi on December 13, 2008, 08:51:34 PM
The mainanacne cost is devided by three for historic reasons ...

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

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.