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

Possibly infinite loop in Production Callback #2787

Closed
DorpsGek opened this issue Apr 2, 2009 · 3 comments
Closed

Possibly infinite loop in Production Callback #2787

DorpsGek opened this issue Apr 2, 2009 · 3 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Apr 2, 2009

frosch opened the ticket and wrote:

IndustryProductionCallback() calls the industry production callback multiple times, if the newgrf request it.

However, the number of calls is not limited by OTTD, which can cause an infinte loop like in http://www.tt-forums.net/viewtopic.php?f=31&t=42623 (all newgrfs available through BaNaNaS :) ).

The number of calls already done is provided to the newgrf using 16 bit. So 65536 would be a sane limit to abort calling the callback and trigger an newgrf error message instead.

Reported version: trunk
Operating system: All


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

DorpsGek commented Apr 5, 2009

mizipzor wrote:

This patch does pretty much what's proposed in the details of this ticket. It halts the loop at 65536, displays an error message and breaks the loop.
A new string was added to english.txt stating the file it occurred in and the local_id to help the user report the bug to the grf creator.

Although small, this is the very first patch I've made for OpenTTD. Big thanks to frosch123 on irc for lending a hand. :)

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2787#comment5894

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 5, 2009

frosch wrote:

Slightly changed the error message. Very nice elsewise :)

Btw.: The newgrf caused the infinite loop by never assigning the 'again' value :/


This comment was imported from FlySpray: https://bugs.openttd.org/task/2787#comment5896

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 5, 2009

frosch closed the ticket.

Reason for closing: Fixed

in r15958


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

@DorpsGek DorpsGek closed this as completed Apr 5, 2009
@DorpsGek DorpsGek added NewIndustries flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant