Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sun Nov 19, 2017 6:55 am

All times are UTC




Post new topic  Reply to topic  [ 47 posts ]  Go to page 1 2 3 Next
Author Message
PostPosted: Fri Jan 04, 2008 8:09 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
I've decided to drop the version with numbering, now it will only name one station after this scheme and then fall back to default names.
No new features, just updated to current trunk and renamed to "v1"...

Download:
Attachment:
File comment: industry stationnames v1 for r12436
industry_stationnames_v1_r12436.diff [7.4 KiB]
Downloaded 521 times

Screenshots:
Attachment:
File comment: with standard industries
stationnames_1.png
stationnames_1.png [ 70.4 KiB | Viewed 20523 times ]

Attachment:
File comment: with newgrf industries
stationnames_2.png
stationnames_2.png [ 91.01 KiB | Viewed 20526 times ]


---
older post:

Alpha 5 updated to revision 11859 (it was broken due to changes in trunk regarding unlimited custom names)
please read features and known bugs at this post:
viewtopic.php?f=33&t=35613&p=653770#p653770

I made two versions - the "nonumbering" one names only the one station after the industry, after that falls back to normal OTTD station naming.

With numbering:


Without numbering:


Screenshots:


---
Just a little information for everyone: There is a newGrf feature that will probably make this patch somewhat obsolete once it is implemented in OpenTTD. See http://wiki.ttdpatch.net/tiki-index.php ... tation_24_
Belugas told me that seeing my little patch here inspired him to go work on that - I don't know how complicated that matter is, but maybe soon you will see something in trunk that will make this patch useless.

Until then, you're free to use this little patch, but don't expect it to be included in trunk for the reason i just stated.
---

original post:
---

Hi everyone,

I am currently working on a little patch that changes station naming: when built near an industry, the station will be named after it.

For example there's a city called Slundington, and it has a Coal Mine, namely Slundington Coal Mine. A station built within three tiles of the industry will automatically be named "Slundington Coal Mine".

This is compatible with any newgrf industries. If you have an ECS Machinery Vector loaded that defines Vehicle factories, you will be able to get a station called "Slundington Vehicles factory" and so on...


The patch is currently WIP, I have to deal with some stuff I appearently can't solve right now, but soon I'll post a first alpha version and I'd appreciate if you comment on my idea.
I hope someone else likes this idea; i always found the built-in station naming "Woods", "Mines" and so on not exact enough for my likes, so i got this idea.

---
In my current build the stations are already named after the industry correctly, but the town names give me some trouble if they are generated ones (not set by hand).

If anyone experienced with OTTD coding could give me a quick hand.. how can I get the name of a Town Object properly as a string? I found no function that would help me :/

_________________
* @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


Last edited by Roujin on Thu Mar 27, 2008 12:11 am, edited 24 times in total.

Top
   
PostPosted: Fri Jan 04, 2008 8:38 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9022
Location: Sol d
I think it's a great idea and is exactly the naming convention I apply at those times when I care about names (e.g. when things get more complex). Eager to see results.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Fri Jan 04, 2008 10:03 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
okay, first alpha version is here.

Features:
- Station naming after Industries that are near. (Currently this has almost highest naming priority, only standard names "Airport", "Docks" etc. are higher. This may change sometime)
- Is a name already taken, it will append a "2", "3" and so on, up to "9" (e.g. "Coal Mine 2"). After that, it will fall back to the usual names.

Known bugs:
- Town Name does NOT work yet for standard named towns. The stations should right now be called "Coal Mine", "Coal Mine 2", and so on. However IF you change a town name to something user defined, the naming should also include the town name from then on: "[Town] [Industry] [Number(optional)]"
- It is not yet checked if a generated name is too long (resulting from long town and/or industry name). In this case the name will just be cut off at the end. This can result in multiple stations with the same name, which is normally prohibited.

If you encounter any behavior differing from what i described or any bugs other than i mentioned, please report. Also, if you are experienced with OTTD coding, i could use a hint on how to get the name from a town :/

Thanks, download is in first post.

_________________
* @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


Top
   
PostPosted: Sat Jan 05, 2008 10:23 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
again changed something, newest version is alpha 4. (download in first post)

Changelog:
- Bug fixed: Town names don't work for standard town names.
- Change: changed radius to 4 tiles since AI loves to build stations 4 tiles away from industry (station coverage == 4 tiles aswell)

Features:
- Station naming after an Industriy that is near (<= 4 tiles away). It will be named after the following scheme: "[Town name] [Industry name]"
- If a name is already taken, it will append a "2", "3" and so on, up to "9" (e.g. "Slundborough Coal Mine 2"). After that, it will fall back to the usual names.
- It works with all languages and newgrf Industries

Known bugs:
- It is not yet checked if a generated name is too long (resulting from long town and/or industry name). In this case the name will just be cut off at the end. This can result in multiple stations with the same name, which is normally prohibited.
- The surrounding 4 tiles are checked only beginning from the northeastmost tile (that is how it's handled by original code, tho)

Notes:
- Take note that the station will not be named after the nearest town, but the town the industry in question belongs to and is named after. This should normally be the same town though.
- The station names are static. This means if you change the name of the town the industry belongs to, or change the game language while playing so the industry has another name, the station names generated by this patch will NOT update to the changes.

Credits:
Thanks to Noldo for your kind help.
----------

If you encounter any bugs not listed or otherwise strange behavior; or if you have a feature request, please post it.

And a little information for everyone: There is a newGrf feature that will probably make this patch somewhat obsolete once it is implemented in OpenTTD. See http://wiki.ttdpatch.net/tiki-index.php ... tation_24_
Belugas told me that seeing my little patch here inspired him to go work on that - I don't know how complicated that matter is, but maybe soon you will see something in trunk that will make this patch useless.

Until then, you're free to use this little patch, but don't expect it to be included in trunk for the reason i just stated.

_________________
* @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


Top
   
PostPosted: Sun Jan 06, 2008 12:31 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Oct 14, 2004 8:08 pm
Posts: 192
Location: Brazil
Nice patch! I hope it gets in the trunk even if the grf feature is implemented (for when you're not using
ECS/PBI).

A suggestion: have an option so that if there's already a station with that name, normal TTD naming
takes over? First station "Slunn Coal Mine", second "Slunn Heights/Valley/Transfer/whatever(not Mines!)".


Top
   
PostPosted: Sun Jan 06, 2008 4:32 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
okay, alpha 5 is released (download in first post)
I made two versions of it - the one with "nonumbering" in its filename does what you suggested, rbenevid.

Changelog:
- Bug fixed: It was not checked if a generated name is too long; that could lead to multiple stations with the same name.
- Bug fixed: the tile check only checked 4 tiles each direction starting from the northeasternmost tile of the station. Now it checks 4 tiles in each direction with the whole station as center (makes a difference for big railway stations and airports)
(- Change: in "nonumbering" version, no more numbering of stations, just one per industry)

Features:
- Station naming after an Industry that is near (<= 4 tiles away). It will be named after the following scheme: "[Town name] [Industry name] [Number]*"
*Number only for number >= 2; "nonumbering" version disables numbers altogether
- It works with all languages and newgrf Industries

Known bugs:
- For docks, it doesn't check the 4 tiles radius with the whole dock as center yet, but only with land tile as center.

Notes:
- Take note that the station will not be named after the nearest town, but the town the industry in question belongs to and is named after. This should normally be the same town though.
- The station names are static. This means if you change the name of the town the industry belongs to, or change the game language while playing so the industry has another name, the station names generated by this patch will NOT update to the changes.

Credits:
Thanks to Noldo for your kind help.
----------

If you encounter any bugs not listed or otherwise strange behavior; or if you have a feature request, please post it.

_________________
* @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


Top
   
PostPosted: Sun Jan 06, 2008 7:26 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Roujin wrote:
- The station names are static. This means if you change the name of the town the industry belongs to, or change the game language while playing so the industry has another name, the station names generated by this patch will NOT update to the changes.

You should be able to borrow the "{TOWN} {INDUSTRY}" text, and add a "{TOWN} {INDUSTRY} {NUMBER}" text, in order to fix those two issues. And to no longer consume the quite limited custom-texts space.

_________________
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


Top
   
PostPosted: Sun Jan 06, 2008 7:02 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
Roujin wrote:
- Change: changed radius to 4 tiles since AI loves to build stations 4 tiles away from industry (station coverage == 4 tiles aswell)


Not always. Bus/truck stops have only 3 tiles, dock have 5 tiles and large airports can have even larger coverage areas.

_________________
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)


Top
   
PostPosted: Sun Jan 06, 2008 7:19 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
@Bilbo: That again depends on your patch settings ;)

Well, the proper way to make it were checking the acceptance tiles for industry. That would also nullify the need to make another ugly hack for the dock. (see known bugs) :rolly: I'll make a note of that for a possible future version.

(but this patch here is halted right now because i'm working on another one)
---
Feature Requests:
- Use StringIDs instead of custom text
- Replace the static check radius by a check over the station's acceptance tiles

_________________
* @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


Top
   
PostPosted: Mon Jan 07, 2008 6:58 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
DaleStan wrote:
Roujin wrote:
- The station names are static. This means if you change the name of the town the industry belongs to, or change the game language while playing so the industry has another name, the station names generated by this patch will NOT update to the changes.

You should be able to borrow the "{TOWN} {INDUSTRY}" text, and add a "{TOWN} {INDUSTRY} {NUMBER}" text, in order to fix those two issues. And to no longer consume the quite limited custom-texts space.


I wonder how often are such dynamic texts resoved - if resolving the {INDUSTRY} part would be costly and strings got resoved much more than once per map, we may have some performance degradation.

But still the string could be at least something like "{TOWN} Mines {NUMBER}". Ideal would be to unlimit the limited custom-texts space, but I am not sure how easy/hard would that be.

_________________
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)


Top
   
PostPosted: Mon Jan 07, 2008 7:17 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
Bilbo wrote:
But still the string could be at least something like "{TOWN} Mines {NUMBER}".
Except that there would then have to be a nearly infinite number of such names, since newindustries can specify a nearly infinite number of names for an industry. (I think the theoretical limit is somewhere around 97^65525. And yes, I got those numbers in the correct order; the larger one is the exponent.)

_________________
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


Top
   
PostPosted: Mon Jan 07, 2008 8:05 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
DaleStan wrote:
Bilbo wrote:
But still the string could be at least something like "{TOWN} Mines {NUMBER}".
Except that there would then have to be a nearly infinite number of such names, since newindustries can specify a nearly infinite number of names for an industry. (I think the theoretical limit is somewhere around 97^65525. And yes, I got those numbers in the correct order; the larger one is the exponent.)


So there is limit of 65525 characters? Well, you'll run out of RAM anyway somewhere around 97^5 so the limit is really theoretical, also you have lower limit 2^32 or 2^64 depending on CPU architecture. And you can't stuff more than about million stations on 2048*2048 map anyway ...

_________________
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)


Top
   
PostPosted: Mon Jan 07, 2008 2:14 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
The actual limit is that an action 4, in total, cannot exceed 65535 bytes. I was figuring about 10 bytes of overhead, leaving about 65525 for the name. But I did forget about the printables in the 80..FF range.

The point is that you cannot put things that can be set by newgrf in the language files, because you cannot possibly get all the possibilities into the language file.

_________________
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


Top
   
PostPosted: Mon Jan 07, 2008 11:07 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 23, 2005 12:09 am
Posts: 3138
Reading all the posts, I am urged to request the following:
Can something similar be done with industries?
EG: London Coal Mine A, London Coal Mine B, ...

_________________
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.


Top
   
PostPosted: Tue Jan 08, 2008 12:58 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
DaleStan wrote:
The point is that you cannot put things that can be set by newgrf in the language files, because you cannot possibly get all the possibilities into the language file.


No, but as I saw some support for localized messages in some parts of NewGRF specs (so newGRF author can stuff localized messages in the file, although he is unlikely to have localization for all 39 languages available in openttd or 13 or so available in TTDPatch)

_________________
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)


Top
   
PostPosted: Thu Jan 10, 2008 1:36 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
erm.. appearently I messed around with the .diff that has numbering and broke it before uploading. I'll reupload a fixed .diff for newest revision some time later or tomorrow.. now i only have a combined diff with all 3 of my patches currently in development for r11804.

includes:
- advanced terraform unify step (some minor improvements for terraforming)
- station delivered cargo (shows a "delivers" line in station placement window, like "accepts")
- industry station naming - numbering version (this patch)

enjoy.

edit: new patch pack for r11861.
edit: new patch pack for r11929.
edit: new patch pack for r11987.
edit: new patch pack for r12036.
edit: new patch pack for r12066.
edit: new patch pack (thanks to Gonozal) for r12166.
edit: patch pack version 2 for r12320.


Attachments:
File comment: Patch pack for r12066
Includes advanced_terraform_v3, station_supplies_v3 and industry_stationnames_v1

patchpack_roujin_r12066.diff [50.2 KiB]
Downloaded 286 times
File comment: Patch pack for r12166
Includes advanced_terraform_v3, station_supplies_v3 and industry_stationnames_v1

patchpack_roujin_r12166.patch [51.18 KiB]
Downloaded 264 times
File comment: Patch pack v2 for 12320
Includes: adv.terraform v3, station supplies v3, industry stationnames v1, traffic lights alpha2.1, random road construction v1.

patchpack_roujin_v2_r12320.diff [85.61 KiB]
Downloaded 388 times

_________________
* @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


Last edited by Roujin on Fri Feb 29, 2008 9:56 pm, edited 7 times in total.
Top
   
PostPosted: Tue Jan 15, 2008 11:23 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
updated the patch to revision 11859. (old version was broken since the naming stuff was changed severely in trunk - now unlimited number of custom station/town/etc. names are possible)

download in first post.

_________________
* @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


Top
   
PostPosted: Sun Feb 03, 2008 2:57 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
updated to r12044, see first post.

_________________
* @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


Top
   
PostPosted: Mon Feb 04, 2008 7:35 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Mar 30, 2005 9:43 am
Posts: 1505
Still hooks directly into the string system :(

_________________
He's like, some kind of OpenTTD developer.


Top
   
PostPosted: Mon Feb 04, 2008 8:27 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
erm.. yes, sorry :oops: Haven't had time to look into how I could make this properly. Worked more on my other patches than on this. At the moment this is just "working", far from being "proper" or "clean"...
Actually I don't know if I want to invest time in this patch since there is action 00 industries, prop 24 - nearby station names. And at least the foundation for its implementation is already in trunk now:
Quote:
Revision: 12041
Author: belugas
Date: 04:23:26, Samstag, 2. Februar 2008
Message:
-Codechange: Add the loader and the property for action 00 industries, prop 24, nearby station name.
No assignation yet, no real work either.


I'm thinking of that as the more sophisticated implementation of the same idea (naming station after nearby industry), so once that's here I think it will kind of depreciate my patch - that's why i'm reluctant to making this properly in the beginning.. :?

_________________
* @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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 47 posts ]  Go to page 1 2 3 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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.