Suggestion::AI Debug panel

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Suggestion::AI Debug panel

Post by fanioz »

Yesterday, I've made some misstype in my code. My AI doesn't do any progress without any info on AI Debug Panel. :(
And then, I tried to restart with ./openttd -d ai=5. Now the console said :

dbg: [ai] ERROR: HasNext() is invalid as Begin() is never called

for me, (maybe other too :?: ) it would be hard to find ( if there are tons of HasNext() statement arround your code :D ) in wich line of code is that error occured. And it looks like that this kind of error doesn't make the program stop, because the console now full-filled with the above error message.

So, the suggestion is :
1. the error message is included with the line number
2. the error message displayed in the debug panel

The misstyped code is similiar like this (error on line 5)

Code: Select all

local list = AIList();
for(local i = list.Begin(); list.HasNext(); i = list.Next()){
  //do some stuff
  local list2 = AIList();
  for(local i = list.Begin(); list2.HasNext(); i = list2.Next()){
    //do some stuff that make a further decission
   // as the looping is not give the actual value of .Next() , the decission is never made
  }
}
I'm using r15603, today I'll download r1647 and try with that.

And.. correct me if that was just because my miss understanding of squirrel/API :D
:bow: thanks
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Suggestion::AI Debug panel

Post by Yexo »

Valid suggestion, I'll try to change the behavior, but it will require rewriting some code in AIAbstractList.
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: Suggestion::AI Debug panel

Post by fanioz »

Thanks, that sounds good :D
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests