Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Feb 27, 2017 4:31 am

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Jan 07, 2013 5:52 pm 
Offline
Engineer
Engineer

Joined: Mon Jan 07, 2013 5:19 pm
Posts: 4
An attempt to implement "Change the "give money to" function so that money is donated to the company and not a specific player" (from the TODO list) raises some questions which I would like to hear your opinions on. My implementation basically adds a button to the company gui and removes the give money selection from the client list.

This allows giving money to a company which has no player. However, since the original implementation of the "give money" feature uses the "send to team" network chat functionality to notify the players, and since there is no player in that team, the message is not displayed for any player (also not at the giver). So, there is no confirmation, that the action succeeded (other than the decreased money...). The question is now, whether this is desireable and, if not, what would be the best solution.

The easiest one is not to display the button, if there is no player in the company, but i doubt that this is a good solution, since it relates the company finance to the network status.

A second also rather easy option would be to change the type of the message not to be a team chat, but a broadcast, making it available to all players (incl. spectators), so it is not "secret" any more. This is also very easy to implement, but still does not convince me to 100%.

The third option, that comes to my mind is to make a newspaper message of the company information category of it. This also would make it an "official" notification, not related to the network at all, and would allow to include the give-money feature also in offline/singleplayer mode (e.g., to finacially support an AI). (Potentially, this would alo require a notification to the AI so it can react. (Are there even notification callbacks for the AI? This is IMHO already an additional step/patch on top then.))


Any other ideas? What are your thoughts on this? I would be interested in your opinions.


Top
   
PostPosted: Mon Jan 07, 2013 6:00 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9001
Location: Sol d
estys wrote:
The third option, that comes to my mind is to make a newspaper message of the company information category of it. This also would make it an "official" notification, not related to the network at all, and would allow to include the give-money feature also in offline/singleplayer mode (e.g., to finacially support an AI). (Potentially, this would alo require a notification to the AI so it can react. (Are there even notification callbacks for the AI? This is IMHO already an additional step/patch on top then.))


I think that makes most sense, especially also for the reasons you outlined with AI and single player. News events can be parsed by AIs. And having a global message in MP that company A transfers money to company B is not too bad either.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Mon Jan 07, 2013 8:14 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4516
Location: /home/sweden
To inform AIs you would issue an AI Event. All subclasses of AIEvent in the API doc is different events that the AI can receive: http://noai.openttd.org/api/1.2.3/classAIEvent.html

Pick one of them of your choice and take a look how it is implemented in OpenTTD.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Tue Jan 08, 2013 8:05 pm 
Offline
Engineer
Engineer

Joined: Mon Jan 07, 2013 5:19 pm
Posts: 4
Please find attached two patches, to move the give money command to the company gui and to change the notification to use a news item. There is no additional event for the AI implemented for now.

In the process of moving the command, to stay clean, it was necessary to rename some strings. E.g., STR_NETWORK_CLIENTLIST_GIVE_MONEY should rather be STR_COMPANY_VIEW_GIVE_MONEY_BUTTON. I renamed them in all src/lang/*.txt files and removed the obsolete strings (that's why the diff files are so big). There are some new ones (for the newspaper), which were added just to english.txt.


Attachments:
File comment: -Add: Move giving money from client list to company view.
0001-Add-Move-giving-money-from-client-list-to-company-vi.patch [142.18 KiB]
Downloaded 73 times
File comment: -Add: Use news item for notification of company giving money instead of team chat.
0002-Add-Use-news-item-for-notification-of-company-giving.patch [66.89 KiB]
Downloaded 53 times
Top
   
PostPosted: Sun Mar 31, 2013 9:25 am 
Offline
Engineer
Engineer

Joined: Mon Jan 07, 2013 5:19 pm
Posts: 4
Update for r25127.


Attachments:
0001-Add-Move-giving-money-from-client-list-to-company-vi.patch [145.37 KiB]
Downloaded 72 times
0002-Add-Use-news-item-for-notification-of-company-giving.patch [70.16 KiB]
Downloaded 66 times
Top
   
PostPosted: Wed Dec 24, 2014 3:56 pm 
Offline
Engineer
Engineer

Joined: Mon Jan 07, 2013 5:19 pm
Posts: 4
Update for r27088


Attachments:
0001-Add-Move-giving-money-from-client-list-to-company-vi.patch [160.11 KiB]
Downloaded 46 times
0002-Add-Use-news-item-for-notification-of-company-giving.patch [73.19 KiB]
Downloaded 36 times
Top
   
PostPosted: Sun Feb 26, 2017 1:21 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Fri Jun 16, 2006 5:18 pm
Posts: 320
Location: Somwhere near a computer
Updated the move diff to be against R27748


Attachments:
0001-Add-Move-giving-money-from-client-list-to-company-R27748.patch [138.42 KiB]
Downloaded 3 times

_________________
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.