Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Allow AIs to query noise level of depricated airport types if they have such airports #4704

Closed
DorpsGek opened this issue Jul 30, 2011 · 3 comments
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

Zuu opened the ticket and wrote:

I would classify this fix as something that would be very useful if it could be backported as it is critical when upgrading old airports to know how much noise the old airport contributed. It is much better to deny upgrading before the old airport has been removed than trying and take the risk to not be able to rebuild it again if upgrading fails.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/4704
@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2011

Zuu wrote:

In the NoAI API for airports, there are two levels of "validity" of airport types:

    • IsValidAirportType: A more strict version which checks if the airport type is valid AND buildable
    • IsAirportInformationAvailable: A less strict version which only require that the airport type is valid and is either buildable OR that the company have at least one airport of the given type.

The later case was added later to the API because it was found in practice that AIs need to access some of the AIAirport functions like the ones for getting the dimension of an airport type for airports that are no longer buildable. This is because that is the only way of getting the size of an airport other than requesting a list of all tiles and iterating through to figure out the size.

What this patch does is that it makes it possible to get noise information for an airport that is no longer buildable, but the AI have one or more built (and remaining).

I should note that I haven't yet compiled this patch in a release build in order to within feasible time verify that it works.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4704#comment10138

@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2011

frosch closed the ticket.

Reason for closing: Fixed

in r22710


This comment was imported from FlySpray: https://bugs.openttd.org/task/4704

@DorpsGek DorpsGek closed this as completed Aug 1, 2011
@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2011

Zuu wrote:

I have now playtested this patch with an AI that each game-day prints the noise level of the small airport.

On a build with the patch applied:

  1. Start in 1950
  2. Start AI (and open AI debug window)
  3. Cheat to the AI company
  4. Build small airport
  5. AI now prints noise level = 3
  6. Use year cheat to 1980 (a year when small airport is no longer available)
  7. AI now prints noise level = 3
  8. Remove airport
  9. AI now prints noise level = 3

On a build without the patch applied: (I used 1.1.2-RC2)
1 - 6 as above
7. AI now prints noise level = -1

At step 7 the patch work as intended. That the AI still get information about the airport which is different from what how I understood from Yexo that it would work with IsAirportInformationAvailable. The behavior in step 9 can however also be observed for other AIAirport APIs that use IsAirportInformationAvailable to validate the airport type - so nothing unique for this patch.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4704#comment10139

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant