FS#6667 - Incorrect costs in bridge list after joining an AI company

Attached to Project: OpenTTD
Opened by Chaos (Chaos03) - Sunday, 21 January 2018, 10:07 GMT
Type Bug
Category Core
Status New
Assigned To No-one
Operating System Windows
Severity Very Low
Priority Normal
Reported Version 1.7.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


After I start the simpleAI and join his company, the bridge selection window shows incorrect (too high) prices. The prices are right when I am in a separate company.
This task depends upon

Comment by frosch (frosch) - Sunday, 11 March 2018, 12:41 GMT
Caused by an optimisation when calculating cost of all bridges:
/* for human player that builds the bridge he gets a selection to choose from bridges (DC_QUERY_COST)
* It's unnecessary to execute this command every time for every bridge. So it is done only
* and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated
Company *c = Company::GetIfValid(company);
if (!(flags & DC_QUERY_COST) || (c != NULL && c->is_ai)) {