distance from edge

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
Vanderbildt
Engineer
Engineer
Posts: 31
Joined: 24 Feb 2016 16:40

distance from edge

Post by Vanderbildt »

Hello
is there any posibility to say Industry XY max distance to (map) edge?
there is a option in the settings: Maximum distance from edge for Oil industrys. It has a range from 12 to 128 tiles
but It won't work.

Thanks for help
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: distance from edge

Post by jfs »

There actually isn't any way to replicate that functionality in NewGRF, no. There is no way to request using one of the original check functions, the game setting isn't available to read from NewGRF, and industry callbacks don't have any way of getting distance from map edge.

However the game setting does work, just only for the built-in industries.

What you can do in NewGRF is check property 43 (in NML called water_distance) to test the distance from water/land, if you want to make coastal or non-coastal industries.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: distance from edge

Post by Eddi »

well, you can sorta do this, by checking industry var 0x62 (or industrytile var 0x60) for tile type MP_VOID
Vanderbildt
Engineer
Engineer
Posts: 31
Joined: 24 Feb 2016 16:40

Re: distance from edge

Post by Vanderbildt »

hey jfs
However the game setting does work, just only for the built-in industries.
i try it with a vanilla 1.11 and i can place a refinery everwhere

and "build many random industrys" place the refinerys far away form the edge

so the game settings dosn't work.

i like to have the port etc on the coast not in the "lakes" but sea and lake water is the same.
property 43 check only the next land tile.

i hope that some day the edge function return to the game.

thanks for the answer
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: distance from edge

Post by jfs »

Check you don't have any NewGRF loaded that overrides the default industries, such as OpenGFX+.

It works perfectly well when I tested just now.
Version 20210225-master-gd4583fa64c067c (you probably won't find a binary of this exact version, it's my own build)
No NewGRF loaded.
512x512 map
Maximum distance from edge for Oil industries: 32 tiles

With this setup I can build oil refineries at the edge of the map, but not away from the edge.
Remember that oil wells don't have the restriction, they can be built anywhere. Only oil rigs and refineries have the restriction.
Attachments
Unnamed, 1994-04-30.sav
(91.27 KiB) Downloaded 63 times
Vanderbildt
Engineer
Engineer
Posts: 31
Joined: 24 Feb 2016 16:40

Re: distance from edge

Post by Vanderbildt »

setting.JPG
setting.JPG (50.25 KiB) Viewed 1973 times
Unnamed, 08-01-2000.sav
(56.12 KiB) Downloaded 63 times
grf.JPG
grf.JPG (70.48 KiB) Viewed 618 times
there is no active GRF
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: distance from edge

Post by jfs »

Okay you left out one important detail: Scenario editor.

When in the scenario editor, apparently this setting is ignored. I'm not sure why, and that does seem like a bug.
During gameplay, the setting/restriction is fully functional.

Edit: No this restriction has been ignored (for oil refineries) in the scenario editor since the earliest available version of OpenTTD source code. You can test the same thing in version 0.4.5 of OpenTTD if you will, and find the same behaviour. It's not a bug, it's intentional that the restriction is ignored in the scenario editor.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 5 guests