Industry tile var 60 problems

Got a problem with TTDPatch? Get help here.

Moderator: TTDPatch Moderators

Post Reply
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Industry tile var 60 problems

Post by DaleStan »

One or more of four different things seems to be broken:
- Callback 2F (I doubt it)
- Advanced var2s
- Industry tile var 60
- My brain

I suspect it's probably the last; that is not unprecedented, especially when attempting to report bugs in Csaba's features.

But anyway:

Code: Select all

   97 * 34	 02 09 EB 81 60 00 33 1F 00 60 00 60 FF 0F 10 01 60 10 33 1F 01 60 10 40 FF 0F 10 01 01 FF 00 00 00 FF
   98 * 15	 02 09 EC 81 60 10 08 01 01 01 FF 00 00 EB 00
   99 * 34	 02 09 ED 81 60 00 33 1F 00 60 00 60 FF 0F 10 01 60 01 33 1F 01 60 01 40 FF 0F 10 01 EC 00 00 00 00 FF
  100 * 15	 02 09 EE 81 60 01 08 01 01 EC 00 00 00 ED 00
  101 * 15	 02 09 EF 81 60 00 00 10 01 EE 00 00 00 00 FF
is executed in callback 2F, but isn't doing what I think it should.

Sprite 101 is correctly failing the construction on steep slopes, but sprites 97..100 don't seem to be working correctly.

100: If tile at 01 is the part of the same industry as the current tile, goto 99, else goto 98.
99: If high corner of current tile and tile at 01 are at the same height, goto 97, else fail:
-- 60 00 33 1F: height level (0..16; each landscape step is 1) of low corner of current tile
-- 00 60 00 60 FF 0F 10: add 1 if this tile is sloped
-- 01 60 01 33 1F: subtract height level of low corner of tile at 01
-- 01 60 01 60 FF 0F 10: subtract another 1 if tile at 01 is sloped
-- 01 EC 00 00 00 00 FF: goto 98 if the result is 0, else fail construction.
98,97: repeat 100,99 for tile at 10; except "permit construction" instead of "goto".

Checking the tiles at (+1,0) and (0,+1) should be sufficient for enforcing "Industry must end up flat", but something's clearly wrong, because the only rule that actually gets enforced is "Industry must not be built on steep slopes."

If I set the "01 FF" in sprite 98 to "00 FF", construction will always fail. The same is *not* true of the "01 FF" in sprite 97; AFAICT, the same thing happens regardless of what values sprite 97 returns.

GRF attached (win version)
Attachments
desal.grf
(22.03 KiB) Downloaded 36 times
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

Don't worry, the problem is with my documentation, not your brain :)

What I forgot to mention explicitly that TTD first runs the land shape check on all proposed tiles, and starts putting the tiles only if the check passed. This means, it's useless to check if other industry tiles are nearby, since no industry tiles are there yet. That bit is useful only when the industry is already there, e.g. for drawing the tiles, you can decide not to draw foundations in a given direction if the industry continues in that direction.

/me goes to the wiki and clarifies.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Then can variable 43 be made available? I currently see no way to determine which tiles should be checked and which shouldn't.

That limitation does make sense, now that you point it out.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

DaleStan wrote:Then can variable 43 be made available?
Yes. Now that you mentioned it, I put a special case into variable 43 code to make it work during callback 2F. It will work in the next alpha.

If you would like trying it sooner, I can email you my latest build.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Post Reply

Return to “Problems with TTDPatch”

Who is online

Users browsing this forum: No registered users and 14 guests