NoGo Question: Company Expending categories

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
Monty_Montana
Engineer
Engineer
Posts: 59
Joined: 15 Oct 2014 21:41
Contact:

NoGo Question: Company Expending categories

Post 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
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NoGo Question: Company Expending categories

Post by jfs »

You're right, that's not possible. It would be a pretty easy enhancement.
Monty_Montana
Engineer
Engineer
Posts: 59
Joined: 15 Oct 2014 21:41
Contact:

Re: NoGo Question: Company Expending categories

Post 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.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NoGo Question: Company Expending categories

Post 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.
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: NoGo Question: Company Expending categories

Post by HGus »

IRC chat using #openttd on irc.oftc.net (more info about our irc channel)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 11 guests