Signal Error Message
Moderator: OpenTTD Developers
Signal Error Message
This isn't really a problem so I put it here. When you try and connect a piece of track to one with signals on, you can't. Fair enough. But the error message is 'impossible track combination'. The track combination is perfectly fine... this error message bear no relevance to the actual error. How about 'Can't place track here... signals must be removed first,' which is based on the error message you get when building over a building.
- SwissFan91
- Tycoon
- Posts: 2401
- Joined: 08 Feb 2009 18:36
- Location: Alberta, Canada
Re: Signal Error Message
I always thought it was saying "impossible track combination" due to the combination of a junction and a signal on the same track piece.
Re: Signal Error Message
Well that's not a track combination that's impossible...
Re: Signal Error Message
iirc you get the same error also when you try to combine two different railtypes at a single tile. In that case, it seems like an impossible track combination to me 

Re: Signal Error Message
Yeah... but that's a different error.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Signal Error Message
I agree that Wasila has a point there. It's a different thing if a piece of track cannot be placed as two track types cannot be combined on one tile (that might be called "track combination" but is IMO slightly inaccurate or mis-understandable, too) or if a track cannot be placed as a signal blocks you from building there.
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
Re: Signal Error Message
I agree, it would be more helpful to players if the error message says it is because of the signal.
"A script is what you give the actors. A program is what you give the audience."
-Larry Wall
-Larry Wall
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: Signal Error Message
This is sometimes pretty annoying, as it also makes it impossible to build a rail type next to a different one diagonally, even though that actually would work perfectly.you get the same error also when you try to combine two different railtypes at a single tile.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
Re: Signal Error Message
I agree with neg, but with mainlines it's rarely needed. Also, devs, how hard can this be to implement? If I knew where the message was I'd change it myself...
Re: Signal Error Message
IMHO that is something entirely different and should be reported as being a bug or not yet programmed.neg wrote:This is sometimes pretty annoying, as it also makes it impossible to build a rail type to a different one diagonally, even though that actually would work perfectly
As for the original problem, when building rail it should say "impossible track combination" but maybe extended to say why.(As mentioned before)
EDIT:
Wasila:
You may want to search english.txt for the excact error mesage but It might be that the error message is used multiple times, so then in the other cases it will be incorrect.
In that case a new string needs to be added and the code itself needs to be changed.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Signal Error Message
I found:
STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Impossible track combination
So I would need to create a new string and change something somewhere else to refer to it?
STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Impossible track combination
So I would need to create a new string and change something somewhere else to refer to it?
Re: Signal Error Message
Those files starting with rail is maybe somewhere to start?
Search for the part before ":". Try to find out if it is used once or multiple times.
If multiple times you need to make a new string for example:
STR_ERROR_IMPOSSIBLE_TRACK_SIGNAL_COMBINATION :{WHITE}Impossible track combination because a signal is in the way.
Then you use the first part of the new string in the correct place instead of the old one.
You may need to replace some more code if the part where the "check for this condition" is checks for multiple conditions at once.
Good luck and take your time.
Search for the part before ":". Try to find out if it is used once or multiple times.
If multiple times you need to make a new string for example:
STR_ERROR_IMPOSSIBLE_TRACK_SIGNAL_COMBINATION :{WHITE}Impossible track combination because a signal is in the way.
Then you use the first part of the new string in the correct place instead of the old one.
You may need to replace some more code if the part where the "check for this condition" is checks for multiple conditions at once.
Good luck and take your time.

-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Signal Error Message
Found the string twice in rail_cmd:
Code: Select all
static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags)
{
_error_message = [b]STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION;[/b]
if (!IsPlainRail(tile)) return false;
/* So, we have a tile with tracks on it (and possibly signals). Let's see
* what tracks first */
TrackBits current = GetTrackBits(tile); // The current track layout.
TrackBits future = current | to_build; // The track layout we want to build.
/* Are we really building something new? */
if (current == future) {
/* Nothing new is being built */
_error_message = STR_ERROR_ALREADY_BUILT;
return false;
}
/* Let's see if we may build this */
if ((flags & DC_NO_RAIL_OVERLAP) || HasSignals(tile)) {
/* If we are not allowed to overlap (flag is on for ai companies or we have
* signals on the tile), check that */
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
} else {
/* Normally, we may overlap and any combination is valid */
return true;
}
}
Code: Select all
switch (GetTileType(tile)) {
case MP_RAILWAY: {
if (!CheckTileOwnership(tile)) return CMD_ERROR;
if (!IsPlainRail(tile)) return CMD_ERROR;
if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error([b]STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION[/b]);
if (!CheckTrackCombination(tile, trackbit, flags) ||
!EnsureNoTrainOnTrack(tile, track)) {
return CMD_ERROR;
}
Re: Signal Error Message
As you can see the function for checking if there is a signal on the rail is in the first block:
But it also checks for DC_NO_RAIL_OVERLAP sepperated from HasSignals by "or" = "||".
We are only interested in the signal part since that is what we want to change.(We as in he who wants to change it.)
The first thing to do is to seperate the checks so they can behave differently.
That means instead of
You want your code to look something like this:
Now compile and see if the code behaves the way you want.
If it does, you have just written your first patch.
If it does not yet, you may have to dig a bit deeper in the code.
Also there are some comments surrounding the code. You may want to change those for them to stay correct.
Now that you have come this far you may want to download the docs, you can find them near the binaries on openttd.org.
Inside you will find all sorts of information, for example what DC_NO_RAIL_OVERLAP means and much more.(Start with index.html)
ps:
No there is no easier way and it is what Devs and patchwriters do all the time to fix stuff or to make feature requests happen.
EDIT:
Corrected sample code to not confuse he who follows. please read below.
Code: Select all
/* Let's see if we may build this */
if ((flags & DC_NO_RAIL_OVERLAP) || HasSignals(tile)) {
/* If we are not allowed to overlap (flag is on for ai companies or we have
* signals on the tile), check that */
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
...
We are only interested in the signal part since that is what we want to change.(We as in he who wants to change it.)
The first thing to do is to seperate the checks so they can behave differently.
That means instead of
Code: Select all
if ((condition) || (condition)) {
do something;
} else {
do something else;
}
Code: Select all
if (condition) {
behave like before;
} else if (condition) {
_error_message = my new string;
behave like before;
} else {
behave like before;
}
If it does, you have just written your first patch.
If it does not yet, you may have to dig a bit deeper in the code.
Also there are some comments surrounding the code. You may want to change those for them to stay correct.
Now that you have come this far you may want to download the docs, you can find them near the binaries on openttd.org.
Inside you will find all sorts of information, for example what DC_NO_RAIL_OVERLAP means and much more.(Start with index.html)
ps:
No there is no easier way and it is what Devs and patchwriters do all the time to fix stuff or to make feature requests happen.
EDIT:
Corrected sample code to not confuse he who follows. please read below.
Last edited by ChillCore on 21 Feb 2010 21:34, edited 1 time in total.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Signal Error Message
Perhaps unsurprisingly, I have encountered a problem. This is what I did:
Of course, I haven't changed the comments yet. But the point is, while the game compiled successfully, nothing has changed in-game. The version number does have an 'M' on the end, but I still get the same error message. What have I done wrong?
Also I've found another problem. What do I do about the other language files? Do I just leave the strings out? Or is there something I have to put in?
Also I couldn't find the docs on the website.
Code: Select all
/* Let's see if we may build this */
if (flags & DC_NO_RAIL_OVERLAP) {
/* If we are not allowed to overlap (flag is on for ai companies or we have
* signals on the tile), check that */
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
} else if (HasSignals(tile)) {
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
_error_message = STR_ERROR_MUST_REMOVE_SIGNALS;
} else {
/* Normally, we may overlap and any combination is valid */
return true;
}
Also I've found another problem. What do I do about the other language files? Do I just leave the strings out? Or is there something I have to put in?
Also I couldn't find the docs on the website.
Re: Signal Error Message
Due to the "return" on the first line the second line is never executed. Try reversing those lines.Wasila wrote:Perhaps unsurprisingly, I have encountered a problem. This is what I did:
Code: Select all
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT; _error_message = STR_ERROR_MUST_REMOVE_SIGNALS;
[/quote]Try http://docs.openttd.org/, you can view them online.Also I couldn't find the docs on the website.
Re: Signal Error Message
Thanks Yexo, it works!
Since the patch is so small, I was wondering how much I need to upload. Does it need to be the source code, the compiled folder or just the necessary files?
As said, I don't know how to deal with other translations either.
Since the patch is so small, I was wondering how much I need to upload. Does it need to be the source code, the compiled folder or just the necessary files?
As said, I don't know how to deal with other translations either.
- Attachments
-
- rail_cmd.cpp
- (100.35 KiB) Downloaded 112 times
-
- english.txt
- (328.11 KiB) Downloaded 102 times
Re: Signal Error Message
Just upload a diff created with "svn diff > file.diff".Wasila wrote:Since the patch is so small, I was wondering how much I need to upload.
Re: Signal Error Message
Cool. You also may want to ask for your thread to be moved to development as it is no longer a suggestion.Wasila wrote:Thanks Yexo, it works!
Congratulations.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Signal Error Message
I guess it no longer needs to be moved, because it was implemented in r19190.
Who is online
Users browsing this forum: No registered users and 4 guests