News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[Patch] Fixed monthly maintenance cost

Started by jamespetts, April 20, 2009, 08:13:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

As requested here, attached is a patch for adding a fixed, monthly maintenance cost for vehicles, in addition to the existing per kilometre cost. This patch requires a change to the translation files for the depot window: a sample en.tab file is attached. Below are the changes that need to be made to the [language].tab files:


LOCO_INFO
%s\nPrice: %d$\nMaint.: %1.2f$/km, %1.2f$/month\nPower: %dkW, %dkm/h\nWeight: %dt\n


and


WAGGON_INFO
%s\nPrice:     %d$\nMaint.: %1.2f$/km, %1.2f$/month\nCapacity: %d%s %s\nWeight: %dt\nTop speed: %dkm/h\n


I hope that this is helpful.
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.

z9999

#1
I think fixed_maintenance must depend on bits_per_month.
All kind of monthly maintenance are the same.


[edit]
Another suggestion
I think all monthly maintenance must be shown at 'This month' on Finances window.
Buy => add_maintenance(+), Sell => add_maintenance(-), are the correct behavior, I believe.


void convoi_t::new_month()
...
// Deduct monthly fixed maintenance costs.
// @author: jamespetts
for(unsigned j=0;  j<get_vehikel_anzahl();  j++ ) {
add_running_cost(-fahr[j]->get_besch()->get_fixed_maintenance());
}



Is this a running_cost ? I doubt.

prissi

z9999 I was thinking along the same line; especially the maintenance is corrected automatically. Also since we have building maintenance, way maintenance and vehicle maintenace, they should get their own internal statistics too. Or at least their seperate number display ...

jamespetts

I understand the part about bits per month - what do you suggest that the formula should be for that? I am not sure that I fully understand the other part, though: the maintenance comes out of the player's account at the end of every month. It is treated as part of the "running costs", and is logged accordingly. (The code uses the phrase "running costs", but the phrase used in the English translation of the game is "operation costs"). I am not sure that I understand how buying and selling vehicles should add or deduct maintenance in this regard, since it is the ending of a month that is the event that gives rise to the cost.
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.

jamespetts

#4
Attached is a revised version of the patch, with the bits_per_month setting implemented. I am still not sure that I fully understand what Z9999 suggested about showing the cost in the money window, however: as stated before, this is part of "operation costs".

Edit: The previous version omitted to include the bits_per_month setting in the depot window display: update attached.
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.

jamespetts

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.

jamespetts

Might I ask - is this patch likely to make it into the trunk? It would be helpful to know for the purposes of balancing paksets currently in development, such as PakBritain.
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

Modified it might enter. I am not too keen with the curretn way of setting this.

jamespetts

Ahh - would you like me to modify it, or are you going to do it yourself? Might I ask what modifications that you think ought be made?
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.

colonyan

Umm, are there any chance this patch will incorporated into the main build in near future? I think this one has been in considered section for a quite long time.

Ters

As far as I can tell, it's in. But maybe no paksets have started using the feature.

Dwachs

Afaict, fixed costs can be specified in the dat/pak, but are not used at the moment...
Parsley, sage, rosemary, and maggikraut.

VS

To document this a bit...

fixed_cost
loading_time
axle_load

These values seem to be correctly transferred all the way from dat file to pak and then to actual game, but don't do anything so far.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

colonyan

Quote from: VS on June 28, 2012, 11:30:01 AM
To document this a bit...

fixed_cost
loading_time
axle_load

These values seem to be correctly transferred all the way from dat file to pak and then to actual game, but don't do anything so far.
You mean, the game informs player the fixed cost exist but the game does not deduct the amout from player credit account?

Edit: If loading_time actually work as well, it will be really helpful variating vehicle performance overall.
Regardless, I appreciate for all coding works. Those are just magic for me.

VS

This:
Quote from: VS on June 28, 2012, 11:30:01 AM
don't do anything so far.
... including gui and everything. The numbers just exist.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Ters

Quote from: VS on June 28, 2012, 11:30:01 AM
These values seem to be correctly transferred all the way from dat file to pak and then to actual game, but don't do anything so far.

I had just noticed that there was a good deal fixed cost code in the game. I never considered that the tiny bit of code for subtracting the cost from the bank account had been omitted, as well as the GUI aspect.

prissi

It requires some pak-set balancing. Thus it was not done before the release of the stable. Some changes (loading_time and fixed_cost) would be indeed very small.

paco_m

I was waiting always for something like that, finally there could be some need to optimize networks instead of  just throwing out 300 vehicles from teh depot that wait for loading in endless loops :D
Is this feature now activated in the last stable from december?

Quote from: prissi on June 30, 2012, 08:30:14 AM
It requires some pak-set balancing. Thus it was not done before the release of the stable. Some changes (loading_time and fixed_cost) would be indeed very small.
Why does it require pakset balancing before activating the option? Isn't the default (I mean if no monthly cost is defined in the dat file) 0?

prissi

Completely forgot this. Fixed maintenance is now booked.