Page 1 of 1

NoGo Question: Company Expending categories

Posted: 25 Mar 2020 06:03
by Monty_Montana
Hi all

I have a question about NoGo scripting, and i would be grateful if someone answers it :D :

Is there a way for getting how much money did a company expend only on construction or new vehicles?

I have searched into NoGo documentation (https://docs.openttd.org/gs-api/classGSCompany.html) but those categories are not covered.
Maybe I am missing something, or there is a way to compute it.

Thanks in advance,
Montana

Re: NoGo Question: Company Expending categories

Posted: 25 Mar 2020 07:22
by jfs
You're right, that's not possible. It would be a pretty easy enhancement.

Re: NoGo Question: Company Expending categories

Posted: 22 Apr 2020 11:36
by Monty_Montana
Hi

Well, i downloaded OpenTTD source code just for taking a glance... The improvement seems not so simple XD.

Let me explain. All the methods i have seen where economy of companies are consulted ("get" in company source code classes) does not split costs. The only moment where they are treated as different ones is when showed in the GUI when you click on "manteinance cost"; and, of course, internal cost accounting.

However classes used when managing interaction with scripts are far away from that. They get the information for interact with the script from other methods and, therefore, costs are not splited.

Disclaimer 1: I looked to OpenTTD class and methods in the documentation, but they were not much explanatory for my purpose, so I could not get an idea of the structure of the code. I just "sailed" over the code inside the IDE.
Disclaimer 2: its a bit (at least 4 years) long since I do not write a C++ line of code, and I have never get such knowlegde (C++ programming mastering) to fully underestand OpenTTD code.

So i would like to confirm the previous information. Where can i corroborate? This forum Github, IRC OpenTTD channel?
And who can i contact to that could give me a brief comment about how feasible is it and which cost at? If it is relatively easy, I would like to try it :)

Thanks in advance,

Montana.

EDIT: it would be interesting not only script interaction, but also including this feature in admin port company information queries.

Re: NoGo Question: Company Expending categories

Posted: 22 Apr 2020 14:00
by jfs
If you mean the information displayed in the company finances window, those figures definitely exist somewhere. Many things in OpenTTD are accessed directly as fields, not via getter/setter methods. (Part of this is due to the legacy as a C program that was converted to C++.)

You're always welcome on the IRC channel, during European afternoon/evening someone can usually answer your questions quickly.

Re: NoGo Question: Company Expending categories

Posted: 24 Apr 2020 10:54
by HGus
IRC chat using #openttd on irc.oftc.net (more info about our irc channel)