Important change to call/acall/pcall (2 juni 2009)
Moderator: OpenTTD Developers
Important change to call/acall/pcall (2 juni 2009)
Because I assume not everyone reads the changelog:
(svn r16502) -Fix [FS#2935]: when an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall.
IMPORTANT FOR AI WRITERS: AIs can no longer call any DoCommand functions (change anything, build vehicles, etc.) in a function called (indirectly) via call/acall/pcall. Where possible, please rewrite your code so it doesn't use call/acall/pcall.
This change will also be in 0.7.1-RC3 and later. Please test your AIs using the latest nightly / 0.7.1-RC3 when it comes out and report all crashes. Thanks to fanioz for reporting this problem.
(svn r16502) -Fix [FS#2935]: when an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall.
IMPORTANT FOR AI WRITERS: AIs can no longer call any DoCommand functions (change anything, build vehicles, etc.) in a function called (indirectly) via call/acall/pcall. Where possible, please rewrite your code so it doesn't use call/acall/pcall.
This change will also be in 0.7.1-RC3 and later. Please test your AIs using the latest nightly / 0.7.1-RC3 when it comes out and report all crashes. Thanks to fanioz for reporting this problem.
Re: Important change to call/acall/pcall (2 juni 2009)
I remembered sometimes ago there are thread about un-ability of AIList.Valuate() function to call DoCommand, and there is replacement that is made using ".call/.acall/.pcall" methode. Now, these methods is no longer could call a DoCommand
and we only can use a normal function with a little trick as shown by yexo.
==================
Forget it,
However, the program stability should be on the first place.
Thanks to yexo for fixing
(and Rubidium - who make me confident to report the bug
)

Code: Select all
this = your_this;
Forget it,
However, the program stability should be on the first place.

Thanks to yexo for fixing


Re: Important change to call/acall/pcall (2 juni 2009)
Hmm, so then placing debug signs in valuators will not work anymore. And I see my PAXLink have become pretty broken due to this. Not sure how much to change though. But I think there is at least one DoCommand that is not a debug call in it.
Thanks for the notice though.
Thanks for the notice though.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Important change to call/acall/pcall (2 juni 2009)
Well, you can place debug signs into some array and then put contents of the array on the map once the valuator is finishedZuu wrote:Hmm, so then placing debug signs in valuators will not work anymore.
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: Important change to call/acall/pcall (2 juni 2009)
You can write a valuate replacement in squirrel without using call. I've attached the version I use in AdmiralAI.Zuu wrote:Hmm, so then placing debug signs in valuators will not work anymore.
Edit: now I have (.nut files are not allowed as attachment)
- Attachments
-
- valuator.txt
- (3.43 KiB) Downloaded 178 times
Last edited by Yexo on 15 Jun 2009 13:09, edited 2 times in total.
Re: Important change to call/acall/pcall (2 juni 2009)
No, you haven't.Yexo wrote:I've attached the version I use in AdmiralAI.
Re: Important change to call/acall/pcall (2 juni 2009)
Found ...in : Admiral21.tar/utils/valuator.nut 

Re: Important change to call/acall/pcall (2 juni 2009)
I noticed that the current release disallows commands even in test mode. That seems reasonable since it might be hard to know the difference in a callback. It would be nice to allow valuators to try operations in test mode, though. Unless of course this would also cause a crash...
Re: Important change to call/acall/pcall (2 juni 2009)
Maybe not a crash, but it does give problems with suspending the AI. Since there are working replacements for call/acall/List::aluate written in squirrel I see no need to enable it.Dustin wrote:I noticed that the current release disallows commands even in test mode. That seems reasonable since it might be hard to know the difference in a callback. It would be nice to allow valuators to try operations in test mode, though. Unless of course this would also cause a crash...
Who is online
Users browsing this forum: Ahrefs [Bot], Jaume and 5 guests