Are Industry IDs Recycled After Closure?

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
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Are Industry IDs Recycled After Closure?

Post by Zutty »

Hi all,

Quick question: Are old IDs from closed industries re-used for new industries?

That is to say, if I maintain a reference to an industry ID after it closes, will the ID always be invalid by AIIndustry.IsValidIndustry(), or could it suddenly spring back into life when a new industry opens?

I want to know if I need to handle this explicitly.

Thanks.
PathZilla - A networking AI - Now with tram support.
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: Are Industry IDs Recycled After Closure?

Post by Morloth »

They do get recycled. Every now and then I get messages like:

Industry 0x00000 has been closed (this is a good thing, as I ask for the name of an industry which isn't there anymore). But I also get messages like:

Industry 'Fieldberg Farm' has been closed.

... and a little later.

New Industry: 'Fieldberg Farm' opened.

So the old ID has been reused for a new industry.
Last edited by Morloth on 07 Apr 2009 00:36, edited 1 time in total.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: Are Industry IDs Recycled After Closure?

Post by Zutty »

Cheers Morloth. Thats another thing to add to the list then!
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 15 guests