Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Sep 25, 2017 5:09 pm

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Autorenew issues
PostPosted: Mon Dec 19, 2005 10:15 am 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5184
Location: The Moon
I'm trying to write some autorenews for the AI (don't ask why), but things are just not working out.

Here's the NFO code:

Code:
// AI Autoreplaces
// 5+ unit pax d elec trains (321 14 pendo 39 (future?))
 1783 * 18    02 00 B8 81 10 00 FF 02
 39 80 00 00
 14 80 01 01
 AA 00
// 5+ unit pax elec single trains (AL6 18 91 1A)
 1784 * 18    02 00 B7 81 10 00 FF 02
 1A 80 00 00
 18 80 01 01
 AA 00
// 5+ unit pax single trains (express 03 pannier 01 4mt 2E type3 0E 67 04)
 1785 * 30    02 00 B6 81 10 00 FF 05
 04 80 00 00
 0E 80 01 01
 2E 80 02 02
 01 80 03 03
 03 80 04 04
 AA 00
// 5+unit goods trains (jinty 00 pannier 01 4mt 2E type3 0E type5 17 (future?))
 1786 * 30    02 00 B5 81 10 00 FF 05
 17 80 00 00
 0E 80 01 01
 2E 80 02 02
 01 80 03 03
 00 80 04 04
 AA 00
// 4-unit elec double trains (AM10 06 321 14 pendo 39 (future?))
 1787 * 22    02 00 B4 81 10 00 FF 03
 39 80 00 00
 14 80 01 01
 06 80 02 02
 AA 00
// 4-unit pax single trains (express 03 pannier 01 4mt 2E type2 0D (future?))
 1788 * 26    02 00 B3 81 10 00 FF 04
 0D 80 00 00
 2E 80 01 01
 01 80 02 02
 03 80 03 03
 AA 00
// 4-unit pax double trains (DMU 0B sprinter 0C voyager 2F)
 1789 * 22    02 00 B2 81 10 00 FF 03
 2F 80 00 00
 0C 80 01 01
 0B 80 02 02
 AA 00
// 4-unit goods trains (jinty 00 pannier 01 4mt 2E type1 05 (future?))
 1790 * 26    02 00 B1 81 10 00 FF 04
 05 80 00 00
 2E 80 01 01
 01 80 02 02
 00 80 03 03
 AA 00

// it's 4 pax non-elec, is it double?       d           no
 1791 * 15    02 00 F3 81 60 2F 00 FF 01 B2 00 01 FF B3 00
 1792 * 15    02 00 F2 81 60 0C 00 FF 01 B2 00 01 FF F3 00
 1793 * 15    02 00 F1 81 60 0B 00 FF 01 B2 00 01 FF F2 00
// it's 6 pax, is it electric?              e/d         no
 1794 * 15    02 00 E7 81 60 39 00 FF 01 B8 00 01 FF B6 00
 1795 * 15    02 00 E6 81 60 14 00 FF 01 B8 00 01 FF E7 00
 1796 * 15    02 00 E5 81 60 1A 00 FF 01 B7 00 01 FF E6 00
 1797 * 15    02 00 E4 81 60 18 00 FF 01 B7 00 01 FF E5 00
// it's 4 pax, is it electric?              e           no
 1798 * 15    02 00 E3 81 60 39 00 FF 01 B4 00 01 FF F1 00
 1799 * 15    02 00 E2 81 60 14 00 FF 01 B4 00 01 FF E3 00
 1800 * 15    02 00 E1 81 60 06 00 FF 01 B4 00 01 FF E2 00
// it's 6+, is it goods or pax?          p           g
 1801 * 14    02 00 A4 82 42 00 FF 01 E4 00 01 03 B5 00
// it's 4, is it goods or pax?           p           g
 1802 * 14    02 00 A3 82 42 00 FF 01 E1 00 01 03 B1 00
// how long is the train?                4           5
 1803 * 14    02 00 A2 81 40 10 FF 01 A3 00 00 03 A4 00
// only continue if we are an AI company: otherwise, just autorenew
// 1804 * 14    02 00 A1 81 43 10 FF 01 AA 00 00 00 A2 00
// time to autorenew!
 1804 * 14    02 00 A0 81 0C 00 FF 01 A2 00 34 34 AA 00
 1805 * 6    03 00 00 00 A0 00


And here's the test: For the purposes of the test, all vehicle lifespans are reduced to two years. I set the year to 1966, and build a Pannier Tank (id 01), a mail van and a passenger car. If my action 2s are correct, this should be recognised as a 4 car, non-electric, non-double, passenger train, and should run this autoreplace:

Code:
// 4-unit pax single trains (express 03 pannier 01 4mt 2E type2 0D (future?))
 1788 * 26    02 00 B3 81 10 00 FF 04
 0D 80 00 00
 2E 80 01 01
 01 80 02 02
 03 80 03 03
 AA 00


And indeed, when it comes time for the train to be replaced, it is replaced with ID 0D. Note that this is the only place in the entire scheme that id 0D appears, thus proving that it's reading this action 2.

Now comes the fun bit.

Another two years roll around, and the new 0D loco is autoreplaced with... ID 05! This is where I start to question my sanity. When that train gets old, it continues to be replaced with ID 05.

Now, I send the train to the depot, sell the locomotive, and build an ID 05 (so it's basically exactly the same train, just with a loco bought by me rather than by the autorenew). When that train gets old, the loco is replaced with...

ID 0D. The correct autoreplacement. Which of course is then autoreplaced by ID 05 again, and so on...

thoughts ???

_________________
Pikkarail.com blog Image
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API
32bpp NewGRFs: Pineapple Trains (10cc) - Graphics Development


Top
   
 Post subject:
PostPosted: Mon Dec 19, 2005 10:19 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Oct 02, 2002 6:57 pm
Posts: 5552
Location: Ithaca, New York
It seems to think that trains with ID 05 are goods trains. What's the cargo type and capacity of ID 05? I'm thinking this might be a bug in var.42 rather than autoreplace, though.

_________________
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.


Top
   
 Post subject:
PostPosted: Mon Dec 19, 2005 10:58 am 
Offline
Graphics Moderator
Graphics Moderator
User avatar

Joined: Mon Sep 13, 2004 1:21 pm
Posts: 5184
Location: The Moon
Patchman wrote:
It seems to think that trains with ID 05 are goods trains. What's the cargo type and capacity of ID 05? I'm thinking this might be a bug in var.42 rather than autoreplace, though.


Capacity is "N/A". I haven't explicitly set the capacity or cargo in the grf file.

But nevertheless, the issue is that it's replacing locos built by me (whether ID 05 or 0D) correctly, but locos built by the autoreplace (whether 05 or 0D) incorrectly.

_________________
Pikkarail.com blog Image
Dev reference: NML Specs - NewGRF Specs - Savegame Internals - NoAi API - NoGo API
32bpp NewGRFs: Pineapple Trains (10cc) - Graphics Development


Top
   
 Post subject:
PostPosted: Mon Dec 19, 2005 11:03 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Oct 02, 2002 6:57 pm
Posts: 5552
Location: Ithaca, New York
I think I'll need a test .grf to see what happens in the debugger then.

_________________
Josef Drexler



TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker

No private messages please, you'll only get the answering machine there. Send email instead.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: kulacskarcsi and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.