Station Name Patch?
Moderator: OpenTTD Developers
Station Name Patch?
I'm just asking if any1 knows where the station name "list" is kept, I'm looking to write a patch (or just edit the list) to have many stations in one "town"
If anyone know where the list is kept in the source code (if it is) or how i'd go about over-riding it?
If anyone know where the list is kept in the source code (if it is) or how i'd go about over-riding it?
- Toni Babelony
- Tycoon
- Posts: 1389
- Joined: 07 Jul 2006 09:34
- Skype: toni_babelony
- Location: Sagamihara-shi, Japan
- Contact:
Re: Station Name Patch?
Well the “list” is in english.txt and in all the other language files for other languages. But I think what your looking for is the function GenerateStationName in station_cmd.c.Salvo_guy wrote:I'm just asking if any1 knows where the station name "list" is kept, I'm looking to write a patch (or just edit the list) to have many stations in one "town"
If anyone know where the list is kept in the source code (if it is) or how i'd go about over-riding it?
Just one small point, I found when I started my first patch for OTTD, that a good way to learn the code is to search for things yourself

Re: Station Name Patch?
I agree. This is I started when I wrote my Italian town generator patchmart3p wrote: Just one small point, I found when I started my first patch for OTTD, that a good way to learn the code is to search for things yourself.
Sidewinder
Italian Town names patch for OTTD (R5266) now in trunk since 0.4.8
For typo, errors or bug on OTTD italian translation, please PM me.
unofficial italian TTD/OpenTTD forum: http://wolf01.game-host.org/forum/index.php
Italian Town names patch for OTTD (R5266) now in trunk since 0.4.8
For typo, errors or bug on OTTD italian translation, please PM me.
unofficial italian TTD/OpenTTD forum: http://wolf01.game-host.org/forum/index.php
I third that statement.
I also found that looking at patch files to see how the portion of the code I was interested in was also a fantastic way to get to know the code I cared about. Even if you don't speak Italian, if your interested in changing town name generation, I recommend that you look at the Italian names generation patch too.
-Hazelrah
I also found that looking at patch files to see how the portion of the code I was interested in was also a fantastic way to get to know the code I cared about. Even if you don't speak Italian, if your interested in changing town name generation, I recommend that you look at the Italian names generation patch too.
-Hazelrah
Well, best thing is just to experiment; try something, see if it works, if not, modify, repeat until perfectSalvo_guy wrote:Okay... so i've found the code i'm looking for... and what i'm planning to do is basically recode the entire function... but i don't really understand it that well... is there a way/place i can teach myself?

OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
okay... i'm completely stuffed...
this is my code:
CODE: (starting line 333)
#define M(x) ((x) - STR_SV_STNAME)
int stnum = 1
#define Str_stnum == stnum
static bool GenerateStationName(Station *st, TileIndex tile, int flag)
{
static const uint32 _gen_station_name_bits[] = {
0, /* 0 */
1 << M(STR_SV_STNAME_AIRPORT && str_stnum) , /* 1 */
1 << M(STR_SV_STNAME_OILFIELD && str_stnum) , /* 2 */
1 << M(STR_SV_STNAME_DOCKS && str_stnum) , /* 3 */
0x1FF << M(STR_SV_STNAME_BUOY_1), /* 4 */
1 << M(STR_SV_STNAME_HELIPORT && str_stnum) , /* 5 */
And this is the error...
ERROR:
station_cmd.c
c:\openttd(source)\station_cmd.c(336) : error C2143: syntax error : missing ';' before 'type'
c:\openttd(source)\station_cmd.c(336) : error C2059: syntax error : 'type'
c:\openttd(source)\station_cmd.c(1041) : warning C4013: 'GenerateStationName' undefined; assuming extern returning int
this is my code:
CODE: (starting line 333)
#define M(x) ((x) - STR_SV_STNAME)
int stnum = 1
#define Str_stnum == stnum
static bool GenerateStationName(Station *st, TileIndex tile, int flag)
{
static const uint32 _gen_station_name_bits[] = {
0, /* 0 */
1 << M(STR_SV_STNAME_AIRPORT && str_stnum) , /* 1 */
1 << M(STR_SV_STNAME_OILFIELD && str_stnum) , /* 2 */
1 << M(STR_SV_STNAME_DOCKS && str_stnum) , /* 3 */
0x1FF << M(STR_SV_STNAME_BUOY_1), /* 4 */
1 << M(STR_SV_STNAME_HELIPORT && str_stnum) , /* 5 */
And this is the error...
ERROR:
station_cmd.c
c:\openttd(source)\station_cmd.c(336) : error C2143: syntax error : missing ';' before 'type'
c:\openttd(source)\station_cmd.c(336) : error C2059: syntax error : 'type'
c:\openttd(source)\station_cmd.c(1041) : warning C4013: 'GenerateStationName' undefined; assuming extern returning int
hi again.
yes i know what you've wanted to do. but this way it's not working
i'm not really a programmer myself, but i've got my few patch codes working so far.
if you want to define a variable outside you could try
static int _stnum = 1;
don't forget to do the semicolon after the int static int etc.
that's why your compiler complaint about missing ';' before type
read other parts of the code, i've done the same for my patches.
maybe you'll find similar functions in the code.
i'm not sure if this defining a variable outside a function is a good solution
and if your modification works.
but there are others here with more programming experience. i'm sure they will help you if you ask them. also try the irc channel.
i'm sure you'll get a working patch if you keep up your work
yes i know what you've wanted to do. but this way it's not working

i'm not really a programmer myself, but i've got my few patch codes working so far.
if you want to define a variable outside you could try
static int _stnum = 1;
don't forget to do the semicolon after the int static int etc.
that's why your compiler complaint about missing ';' before type

read other parts of the code, i've done the same for my patches.
maybe you'll find similar functions in the code.
i'm not sure if this defining a variable outside a function is a good solution
and if your modification works.
but there are others here with more programming experience. i'm sure they will help you if you ask them. also try the irc channel.
i'm sure you'll get a working patch if you keep up your work

The line
is wrong. And there's a missing ';' as TrueSatan said.
Code: Select all
#define Str_stnum == stnum
i know how you feel. i have been trying to get a station provides thing to work when your building a station and have tried atleast 3 differnt ways and none have worked. i think i will give up on it for awhile and come back to it in a couple of weeks with a fresh mind.
This weekend i will have a look at the station naming and waypoint naming to see if i can give you any ideas on the subject.
This weekend i will have a look at the station naming and waypoint naming to see if i can give you any ideas on the subject.
Code: Select all
tmp = free_names & ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<12)|(1<<26)|(1<<27)|(1<<28)|(1<<29)|(1<<30));
if (tmp == 0) {
- _error_message = STR_3007_TOO_MANY_STATIONS_LOADING;
- return STR_SV_STNAME ;
+found = M(STR_0130_RENAME);
+goto done;
- Attachments
-
- Station named Rename when over the set limit of station names.
- Rename.PNG (137.37 KiB) Viewed 7268 times
Could you change that code above to a that what svn diff would create, or create a diff file by using svn diff.l_Blue_l wrote:The message of TOO MANY STATIONS are gone forever with this but this basicaly forces you to Rename the Stations if i knew alittle more about how strings work i would beable to do something better but currently i know very little about strings.Code: Select all
....
How about asking other people things about the string usage in openttd? But there is no question so i do not answer anything. I think others will to it the same way, so feel free to ask

Who is online
Users browsing this forum: No registered users and 13 guests