Station's name from nearby industry (new version: 1.2.1)

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Station's name from nearby industry (new version: 1.2.1)

Post by a.locritani » 15 Nov 2008 16:18

Hi. After about a week and with a huge help of Michael Blunk (once again, thanks) , I want to release a simple grf about station's name.
Inspired by this Roujin's patch for OTTD, this grf names a station with the name of nearby industry, where "nearby" means within 3 tiles. It only works with default industries, in all climates.
station_name.png
station_name.png (22.89 KiB) Viewed 13687 times
it also has a sort of "special feature" (I don't call it a bug :roll: because it's indeed useful)

if the industry you are servicing is in "city A" territory, but the station is in "city B" territory, the station will be named "industry city B", as the city beneficing of transfered cargo (I'm talking of local authority rating improvements, here).
please note the station authority of the tile where the station is built
please note the station authority of the tile where the station is built
station_name_special.png (41.63 KiB) Viewed 15918 times
please note the station authority of the tile where the station is built

Because of this, can be possible to have that situation, where 2 station are servicing the same industry, but they are built in different local authority areas:
station_name_special2.png
station_name_special2.png (4.89 KiB) Viewed 13681 times
the power station is named "Panley power station"

Positional constraints:

Oil refinery: Near coast (distance configurable; does not apply in scenario editor)
Oilrig: At sea level and far from coast (distance configurable; both do not apply in scenario editor)

Only Arctic:
Forest: above snowline
Farm in arctic. Below snowline.

Only Tropic:
Fruit/rubber plantation: Not in desert
farm/factory: Not in desert
Water supply/tower: Only in desert
Lumbermill: Only in rain forest

Only Toyland
Bubble generator: Only for height <= 4

Please note that, since it's not possible to fully recreate default positional constraints, this constraints are (a bit) different from (OTTD's) original one: in particular now oil refinery can be placed also far from map edge but always near water. the same for oil rigs.
also consider that this new version is not fully tested in TTDPatch.

this grf needs TTD patch version 2.6 alpha 0 r1782 or better.
regarding OTTD, it works starting from revision 14598

Please note that this grf is not intended to be used with another industries' grf - only use it with default industries (thanks Michael for pointing it out)

Please let me know of any problem/strange behavior different from signaled ones.

Feel free to improve this grf, if you want; simply let me know

the actual GRF is in the following post (and now also on BANANAS)

--------------------------------------------
HISTORY:
version 1.1 : added feature to disable oil wells only-decreasing-production behavior on temperate (by SirkoZ)
version 1.2: positional constraints added
version 1.2.1: fixed a issue with farm and industries in tropical climate

PARAMETERS:
#1: 1 oil wells can increase production on temperate climate; 0 normal behavior (default)
#2: max distance from coast for oil refineries (default 16)
#3: min distance from coast for oil rigs (default 16)
Param #3 can be omitted and in this case param #2 is used for both refineries and oil rigs
Last edited by a.locritani on 11 Mar 2010 18:55, edited 11 times in total.

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Station's name from nearby industry

Post by a.locritani » 15 Nov 2008 16:19

station_name.grf
v. 1.2.1
(4.88 KiB) Downloaded 627 times
Last edited by a.locritani on 11 Mar 2010 18:53, edited 9 times in total.

michael blunck
Tycoon
Tycoon
Posts: 5271
Joined: 27 Apr 2005 07:09
Contact:

Re: Station's name from nearby industry

Post by michael blunck » 15 Nov 2008 19:35

a.locritani wrote: [...] Please let me know of any problem/strange behavior [...]
IMO, a major problem would be that you cannot use both your .grf and any other industry .grf simultaneously because it´s not possible to override an already overriden industry.

regards
Michael
Image

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Station's name from nearby industry

Post by a.locritani » 15 Nov 2008 19:50

michael blunck wrote:
a.locritani wrote: [...] Please let me know of any problem/strange behavior [...]
IMO, a major problem would be that you cannot use both your .grf and any other industry .grf simultaneously because it´s not possible to override an already overriden industry.

well, it's true, but I think that who develops another grf about industries can use property 24 to name the station.
in that case you can disable this grf and only use it when playing with default industries.
anyway, now I report you point in first post, thanks!

User avatar
Dave
Moderator
Moderator
Posts: 17205
Joined: 26 Dec 2005 20:19
Location: Harringay, North London
Contact:

Re: Station's name from nearby industry

Post by Dave » 16 Nov 2008 19:53

Good effort, I like :)
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...

User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Station's name from nearby industry

Post by CommanderZ » 16 Nov 2008 20:14

There was and OpenTTD patch that did exactly this some time ago. A grf is certainly better solution, thank you :)

User avatar
Chrill
Moderator
Moderator
Posts: 15287
Joined: 18 Dec 2004 17:35
Location: Stockholm, Sweden
Contact:

Re: Station's name from nearby industry

Post by Chrill » 16 Nov 2008 23:46

A neat feature! I often rename my stations so that I know exactly what they are when looking through orders. Sweet, this'll do it for me :P
Image
Newest screenshots published January 9, 2019
Chrill's scenarios:
Archipiélago Hermoso
(Latest Release: Version 3.2)
Turnpike Falls (Latest Release: Version 0.91)

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Station's name from nearby industry

Post by JacobD88 » 17 Nov 2008 10:32

Regarding OTTD; i'm having trouble getting this GRF to work...

I'm using the latest nightly r14583 and when i load the grf i get the following error...

Image

OTTD 0.7.0 is not out yet, is this error caused by the GRF been incompatible with OTTD or is there another problem??

Cheers
Attachments
snfni_error1.png
Error
(265.74 KiB) Downloaded 1394 times

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Station's name from nearby industry

Post by a.locritani » 17 Nov 2008 10:42

JacobD88 wrote:Regarding OTTD; i'm having trouble getting this GRF to work...
quoting from my first post:
at the moment this GRF is not compatible with OTTD (because used property is not yet implemented) but if you try to use it on OTTD it will complain telling that you need version 0.7 (this because the implementation of the used property is forecast due 0.7) - the exact revision will be inserted when property is implemented.
I've inserted this error message so that if you try to use it on OTTD you'll be warned that it doesn't work. without this error, you may erroneous believe that it's usable and when not working you may complain.

anyway, thanks for your post: I've now edited the first one in order to better stress this point.

to others, thanks for appreciate my work. It's my first GRF and I'm glad that you like it.
Last edited by a.locritani on 17 Nov 2008 10:49, edited 1 time in total.

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 675
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Station's name from nearby industry

Post by JacobD88 » 17 Nov 2008 10:48

a.locritani wrote:
JacobD88 wrote:Regarding OTTD; i'm having trouble getting this GRF to work...
quoting from my first post:
at the moment this GRF is not compatible with OTTD (because used property is not yet implemented) but if you try to use it on OTTD it will complain telling that you need version 0.7 (this because the implementation of the used property is forecast due 0.7) - the exact revision will be inserted when property is implemented.
I've inserted this error message so that if you try to use it on OTTD you'll be warned that it doesn't work. without this error, you may erroneous believe that it's usable and when not working you may complain.

Dang! Sorry scanned through readme/1st post at the end so missed that but got the rest about city areas... :| :mrgreen:

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Station's name from nearby industry

Post by Roujin » 17 Nov 2008 14:42

Nice effort, congratulations. I am the author of the patch CommanderZ mentioned; I discontinued my patch when it was pointed out to me that this feature exists in the newgrf specs (but is not yet implemented in OpenTTD).

Indeed, it is better to solve this by a newgrf, than with a patch that hardcodes it like mine did. I only wonder if the incompatibility with NewIndustry grfs can be solved somehow.


Oh and on the plus side, now that we have such a nice newgrf (mainly/exclusively) featuring the said newgrf action not yet implemented in OpenTTD, maybe some dev is inspired to go and implement it using this grf as a test case. :)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Station's name from nearby industry

Post by DJ Nekkid » 17 Nov 2008 14:50

Roujin wrote:I only wonder if the incompatibility with NewIndustry grfs can be solved somehow.
well, with a proper "recipy", it probably will be easy to add this to the NewIndustry NewGrfs for the saied authors... ???
Member of the
ImageImage

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Station's name from nearby industry

Post by Yexo » 17 Nov 2008 14:55

Roujin wrote:Nice effort, congratulations.
I can only agree with that, nice grf :)
Oh and on the plus side, now that we have such a nice newgrf (mainly/exclusively) featuring the said newgrf action not yet implemented in OpenTTD, maybe some dev is inspired to go and implement it using this grf as a test case. :)
In fact, I was yesterday: http://bugs.openttd.org/task/1822 . Now waiting for a dev to apply it to trunk.

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Station's name from nearby industry

Post by a.locritani » 17 Nov 2008 15:15

Roujin wrote:Nice effort, congratulations. I am the author of the patch CommanderZ mentioned; I discontinued my patch when it was pointed out to me that this feature exists in the newgrf specs (but is not yet implemented in OpenTTD).
Hi, Roujin. As I wrote in my first post, was your patch to inspire me. I've also posted in your patch's topic to signal this GRF.
Roujin wrote:I only wonder if the incompatibility with NewIndustry grfs can be solved somehow.
as DJ Nekkid (if I don't misunderstood him) said, and as I wrote responding to Michael Blunk, in third post, will be "responsability" of NewIndustries GRF 's authors to implement this property in their grf. this should not be difficult at all.
also, the request to implement property 24 in ottd was originally posted by george, in order to use this property in ECS, so maybe ECS already support this.
Yexo wrote:In fact, I was yesterday: http://bugs.openttd.org/task/1822 . Now waiting for a dev to apply it to trunk.
oh, Yexo, well done! i'll try your patch this evening, if I have time: I want to see how my grf works on ottd !!!

edit: Yexo's patch tried, it works great. But a not-patch-related problem appears: italian cities' names generator creates long city's names and also italian translations of industries' names are long. So adding the former and the latter, the station's name is too long and is clipped. But this is another problem...
Last edited by a.locritani on 17 Nov 2008 21:17, edited 1 time in total.

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Station's name from nearby industry

Post by Roujin » 17 Nov 2008 21:14

a.locritani wrote:Hi, Roujin. As I wrote in my first post, was your patch to inspire me. I've also posted in your patch's topic to signal this GRF.
Yes, seeing your post there is how I got into this topic in the first place. I also read your initial post here, but inbetween reading it and posting my answer here I seem to have forgotten that you mentioned me already. Probably because CommanderZ mentioned my patch again without mentioning me :lol: well, nevermind that - by now everyone's informed that I'm the author of that patch. :lol: :lol: (PS: I did _not_ want to advertise my lousy archievements! :shock: )

a.locritani wrote:as DJ Nekkid (if I don't misunderstood him) said, and as I wrote responding to Michael Blunk, in third post, will be "responsability" of NewIndustries GRF 's authors to implement this property in their grf. this should not be difficult at all.
also, the request to implement property 24 in ottd was originally posted by george, in order to use this property in ECS, so maybe ECS already support this.
He at least needs this for his fishing grounds, as those are currently mislabled as "oil fields". This was already "fixed" with my hack/patch (I only found that out by chance and found it quite amusing), and as soon as this property is implemented, he can fix it itself in his newgrf.
Yexo wrote:In fact, I was yesterday: http://bugs.openttd.org/task/1822 . Now waiting for a dev to apply it to trunk.
Nice one! Now from reading your code (not applied it yet), it seems to take the industry's town as base for the station name (or am I wrong here), as opposed to how it works in TTDPatch, and with the standard station names. Now the question is what to do - as a.locritani said in his initial post here, he does not regard it as a bug, but as a "special feature", because the service you provide at the station will influence your rating at the station's town, not at the industry's.
This obviously tells us we should do it the way it's done in TTDPatch - however it might also lead to confusion and people complaining about "bugs" like "My station built next to 'Alphaville Sawmill' is called 'Betatown Sawmill'". So what to do?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Station's name from nearby industry

Post by a.locritani » 17 Nov 2008 21:34

Roujin wrote:Nice one! Now from reading your code (not applied it yet), it seems to take the industry's town as base for the station name (or am I wrong here), as opposed to how it works in TTDPatch, and with the standard station names. Now the question is what to do - as a.locritani said in his initial post here, he does not regard it as a bug, but as a "special feature", because the service you provide at the station will influence your rating at the station's town, not at the industry's.
This obviously tells us we should do it the way it's done in TTDPatch - however it might also lead to confusion and people complaining about "bugs" like "My station built next to 'Alphaville Sawmill' is called 'Betatown Sawmill'". So what to do?
Please consider that also in TTDPatch implementation strange things may happen: for example, if an industry is outside any local authority areas, nearby station is still named from nearest town but nevertheless this town doesn't benefit of any (industry based) local rating increasing. And this is also valid for normal stations (ie: not nearby any industry) outside local authority area, both in OTTD and TTDPatch. So we can have a station named "Town A Heights" but not increasing Town A's local rating nor any other town's local rating. Or am I wrong?

GRF updated: no more errors on loading in ottd < 0.7, but only a warning about the need of Yexo's patch

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Station's name from nearby industry

Post by Roujin » 17 Nov 2008 21:50

Okay, I now tested it and as I have some experiences from my patch, of course I know where the little problems are - I had some nice deja vus of problems I already found back when I made my hack/patch. :P
These problems here are issues with Yexo's patch, not with a.locritani's grf, so this post is directed at Yexo ;)

1)
Building an industry station in e.g. "Tonningville" -> e.g. "Tonningville Iron Ore Mine", then renaming the town to something else results in the station keeping its name "Tonningville Iron Ore Mine". This is opposed to how the standard station names work.

2)
Renaming the nearby town first to something long (something near the maximum length you can enter) results in the station name getting cut off. For example, I renamed "Tonningville" to "Tonningvillestantonviriiili" first, then built the station, resulting in "Tonningvillestantonviriiili I" instead of "Tonningvillestantonviriiili Iron Ore Mine". This is opposed to the standard names again who are written out correctly despite being longer than the maximum user enterable name" (e.g. "Tonningvillestantonviriiili Valley". You can easily see that you can't enter such a long name by hand by clicking the rename button on that station.)

3)
Just for completeness' sake I've tested what I already found by reading your code and indeed the town included in the station's name is the industry's town, not the station's town. Still the question remains what to do here.


---
Oh and here's a note / random find for a.locritani, but I suppose it's neither something one can do anything about, nor does it do any harm: As the query tool ("?") in OpenTTD nowadays displays newgrf related information, it states that the industry I just queried originates from your NewGrf "station's name from nearby industries". This may be correct from some coding point of view since you probably sort of redefined them or so (sorry, I'm not into newgrf), but it's also kind of wrong on the other hand. Maybe you could rename the grf to something like "Default industry station names" (since this grf also only works without any new industry sets).
Last edited by Roujin on 17 Nov 2008 22:04, edited 1 time in total.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Station's name from nearby industry

Post by Yexo » 17 Nov 2008 22:00

Roujin wrote:Nice one! Now from reading your code (not applied it yet), it seems to take the industry's town as base for the station name (or am I wrong here), as opposed to how it works in TTDPatch, and with the standard station names.
You're right, thanks for pointing it out.
Now the question is what to do - as a.locritani said in his initial post here, he does not regard it as a bug, but as a "special feature", because the service you provide at the station will influence your rating at the station's town, not at the industry's.
This obviously tells us we should do it the way it's done in TTDPatch - however it might also lead to confusion and people complaining about "bugs" like "My station built next to 'Alphaville Sawmill' is called 'Betatown Sawmill'". So what to do?
I think the way TTDPatch does it is ok, as that is the same way it happens now. I uploaded a new patch to FS that does fix this.

Note that this grf names the stations exactly the same as the industry but there is no need for that. Someone might create a newgrf that names stations near forests like "TOWN's lumber supply".

Edit:
Roujin wrote:Okay, I now tested it and as I have some experiences from my patch, of course I know where the little problems are - I had some nice deja vus of problems I already found back when I made my hack/patch. :P
These problems here are issues with Yexo's patch, not with a.locritani's grf, so this post is directed at Yexo ;)
Thanks for testing it :).
1) Building an industry station in e.g. "Tonningville" -> e.g. "Tonningville Iron Ore Mine", then renaming the town to something else results in the station keeping its name "Tonningville Iron Ore Mine". This is opposed to how the standard station names work.
That one is impossible to fix with the current approach. how does TTDPatch behave in this case?
2)Renaming the nearby town first to something long (something near the maximum length you can enter) results in the station name getting cut off. For example, I renamed "Tonningville" to "Tonningvillestantonviriiili" first, then built the station, resulting in "Tonningvillestantonviriiili I" instead of "Tonningvillestantonviriiili Iron Ore Mine". This is opposed to the standard names again who are written out correctly despite being longer than the maximum user enterable name" (e.g. "Tonningvillestantonviriiili Valley". You can easily see that you can't enter such a long name by hand by clicking the rename button on that station.)
In consider the behavior with default names a bug, instead of what my patch does. It's easy to change it so names are not cut off, but the maximum name length is there for a reason.

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Station's name from nearby industry

Post by Roujin » 17 Nov 2008 22:35

Yexo wrote:
1) Building an industry station in e.g. "Tonningville" -> e.g. "Tonningville Iron Ore Mine", then renaming the town to something else results in the station keeping its name "Tonningville Iron Ore Mine". This is opposed to how the standard station names work.
That one is impossible to fix with the current approach. how does TTDPatch behave in this case?
Yes, I never managed to fix that in my patch either. Might be possible with a new string though. Dalestan pointed something in that direction out to me here, but I was too unknowledgable of the string system in OpenTTD to make anything out of it back then.
Regarding TTDPatch, I'm also curious about that. Could anyone with a copy to hand test this for us and post his results?
2)Renaming the nearby town first to something long (something near the maximum length you can enter) results in the station name getting cut off. For example, I renamed "Tonningville" to "Tonningvillestantonviriiili" first, then built the station, resulting in "Tonningvillestantonviriiili I" instead of "Tonningvillestantonviriiili Iron Ore Mine". This is opposed to the standard names again who are written out correctly despite being longer than the maximum user enterable name" (e.g. "Tonningvillestantonviriiili Valley". You can easily see that you can't enter such a long name by hand by clicking the rename button on that station.)
In consider the behavior with default names a bug, instead of what my patch does. It's easy to change it so names are not cut off, but the maximum name length is there for a reason.
Well, maybe it's a soft limit? Like "We don't want the user to be able to type in anything longer than xy (30?) letters, but names put together by OpenTTD itself and/or newGrfs can actually be up to yx (say 63) letters long without any harm"?
We should get an official word on this (devs) before assuming things ;)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Station's name from nearby industry

Post by Yexo » 17 Nov 2008 22:48

Roujin wrote:Yes, I never managed to fix that in my patch either. Might be possible with a new string though. Dalestan pointed something in that direction out to me here, but I was too unknowledgable of the string system in OpenTTD to make anything out of it back then.
Using such a string will only introduce more problems, like what should happen if the industry closes down?
Well, maybe it's a soft limit? Like "We don't want the user to be able to type in anything longer than xy (30?) letters, but names put together by OpenTTD itself and/or newGrfs can actually be up to yx (say 63) letters long without any harm"?
We should get an official word on this (devs) before assuming things ;)
The limit is not about the amount of characters, but about the width (in pixels) of the string. Long labels (so also station names) can cause graphical glitches. I don't know what the exact limit is before glitches can occur, so maybe the current implementation is a bit too strict on the length.

Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 5 guests