Page 1 of 1

Broken vactrain lines

Posted: 29 Oct 2019 07:57
by arag_cf
After playing with NewGRFs I got broken vactrain lines.

Before that I had no road vehicles and decided to add some new NewGRFs to play with buses and trucks and to remove pipeline and trackbed rail types, but I noticed my broken trains too late (no savegames left with old NewGRF set).

So I have no idea how to convert bad rail lines under the existing trains since they have «No power».

Here is a saved game: https://thesystem.pro/file/81d

Can somebody help me please?

Re: Broken vactrain lines

Posted: 29 Oct 2019 09:08
by planetmaker
Sorry to hear. However you have been warned. When you modified NewGRFs on an existing savegame, you did both of these things:

* activated developer settings
* you clicked ok on a big red warning box that said that changing NewGRFs mid-game can damage your game beyond repair

Always make backups when you do a surgical operation with a swiss army knife.
Maybe you can undo the damage by going back to your previous choice of NewGRFs

Re: Broken vactrain lines

Posted: 29 Oct 2019 15:19
by arag_cf
Yes you're right. I was warned.

Maybe I have a chance to recompile the game temporary removing the no power limitation? Then I'll have a chance to move stuck trains.

The rail type is changed from vacuum tube to pipeline (why?) for now so I need to make any trains move by any rail type. Is it possible?

I am a VB6, php and JS programmer so maybe you can tell me where to comment some if-then-else etc in the code... I can understand C/C++/C#/Java syntax.

Re: Broken vactrain lines

Posted: 29 Oct 2019 15:37
by planetmaker
If you really want to go to that length, start in
src/train_* and start messing with the power of the vehicles or in src/rail* and starting to return 'compatible railtype' in all cases.

Re: Broken vactrain lines

Posted: 29 Oct 2019 15:44
by _dp_
Also may be a good idea to look up a string name for that error message in english.txt and then find it in a code.

Re: Broken vactrain lines

Posted: 29 Oct 2019 16:56
by arag_cf
Aha cool! Thank you. I'll come back with the results soon (I hope).
Love this game since 90's (was playing it on P1-120, lol this PC is still operating with 14'' CRT dispaly lol)
So I hope I can survive this savegame. ))

Re: Broken vactrain lines

Posted: 29 Oct 2019 18:20
by arag_cf
I found this:

RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
{
/* Loop through each rail type until the label is found */
for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
const RailtypeInfo *rti = GetRailTypeInfo(r);
if (rti->label == label) return r;
}

if (allow_alternate_labels) {
/* Test if any rail type defines the label as an alternate. */
for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
const RailtypeInfo *rti = GetRailTypeInfo(r);
if (rti->alternate_labels.Contains(label)) return r;
}
}

/* No matching label was found, so it is invalid */
return INVALID_RAILTYPE;
}


So which railtype do I need to return to allow moving vactrain/maglev vehicles on universal rail?

Re: Broken vactrain lines

Posted: 30 Oct 2019 00:54
by arag_cf
Okay now I made some modifications in code and trying to compile it.

Visual Studio seems to be too redundant for me so I decided to use mingw/msys64.

And I get the following error:

Андрей@arag_portable MINGW64 /c/54/openttd/s
$ make
make[1]: Entering directory '/c/54/openttd/s/objs/lang'
[LANG] Compiling and Linking strgen.exe
C:/MinGW/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: strgen_base.o:strgen_base.cpp:(.text+0x28e): undefined reference to `__memcpy_chk'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:67: strgen.exe] Error 1
make[1]: Leaving directory '/c/54/openttd/s/objs/lang'
make: *** [Makefile:56: all] Error 1

How to fix that?

Re: Broken vactrain lines

Posted: 30 Oct 2019 02:34
by Emperor Jake
Congratulations, that's the biggest most chaotic vactrain network I've ever seen :D

Like planetmaker said, I had a go at fixing your save simply by re-adding the planning track and Pipe GRFs, and it mostly works fine again. Although the track conversions led to paths messing up which resulted in a lot of train accidents, the save should be salvageable without resorting to editing the game code.

Re: Broken vactrain lines

Posted: 30 Oct 2019 17:46
by arag_cf
Emperor Jake wrote: 30 Oct 2019 02:34 Congratulations, that's the biggest most chaotic vactrain network I've ever seen :D

Like planetmaker said, I had a go at fixing your save simply by re-adding the planning track and Pipe GRFs, and it mostly works fine again. Although the track conversions led to paths messing up which resulted in a lot of train accidents, the save should be salvageable without resorting to editing the game code.
Wow cool! Thanks for the congrats )))) lol :D

I am still fighting with the gcc mingw compiler. Now downloading VS2019 but maybe I don't need to do that anymore...

Could you please drop me back the survived savegame after your touch? And when it can happen? :oops: Thanks man!

Re: Broken vactrain lines

Posted: 30 Oct 2019 19:37
by arag_cf
Btw I've got it compiled in VS2019 finally... OK let's hack it now. :twisted:

Re: Broken vactrain lines

Posted: 30 Oct 2019 19:55
by arag_cf
Yes I moved these stuck trains! :shock: :P

Re: Broken vactrain lines

Posted: 30 Oct 2019 22:34
by arag_cf
OMG I almost fixed these crazy lines and trains... Imagine what if this could happen in the real life...

Re: Broken vactrain lines

Posted: 30 Oct 2019 23:16
by kamnet
arag_cf wrote: 30 Oct 2019 22:34 OMG I almost fixed these crazy lines and trains... Imagine what if this could happen in the real life...
That's why men are not allowed to play God! ;) Glad you got your mess sorted out. Be lucky you could reverse it. My longest-ever played save game (I started playing it in 2009) became corrupted sometime in 2014 because I kept swapping around NewGRFs. It resulted in some vehicles becoming stuck between a road tile and a station tile. It will never be fixed, and it will assuredly happen again in the future. All I can do is eliminate the tiles around it and rebuild some things, but it's forever broken. I still play it, though, because I've literally put thousands of hours of work into it.

Re: Broken vactrain lines

Posted: 31 Oct 2019 22:39
by arag_cf
Thanks everybody in this topic for your help! :wink:

Re: Broken vactrain lines

Posted: 31 Oct 2019 22:44
by arag_cf
kamnet wrote: 30 Oct 2019 23:16
arag_cf wrote: 30 Oct 2019 22:34 OMG I almost fixed these crazy lines and trains... Imagine what if this could happen in the real life...
That's why men are not allowed to play God! ;) Glad you got your mess sorted out. Be lucky you could reverse it. My longest-ever played save game (I started playing it in 2009) became corrupted sometime in 2014 because I kept swapping around NewGRFs. It resulted in some vehicles becoming stuck between a road tile and a station tile. It will never be fixed, and it will assuredly happen again in the future. All I can do is eliminate the tiles around it and rebuild some things, but it's forever broken. I still play it, though, because I've literally put thousands of hours of work into it.
Thank you kamnet.
I can give you my patched version of OpenTTD and you will be able to move your stuck trains.
Advantages is:
1. You can modify rail type under the vehicles directly.
2. You can start unpowered vehicles (with 0hp lol but they are still movable) but you'll need to fix your lines anyways (see point 1).
3. Better coverage of stations.

Disadvantages:
Trying to remove the rail or depot or station with the vehicle on it leads to fatal error (and you can restart and go on with the latest savegame).

Do you need my binary?

Re: Broken vactrain lines

Posted: 01 Nov 2019 01:46
by kamnet
Well, my issue isn't with trains, but road vehicles. Also, this was in a game using ChillCore's Patch Pack, back in 2013. If you want to take a look at it, the thread starts here along with a save game: viewtopic.php?f=33&t=47622&p=1083487&hi ... n#p1083487

ChillCore was never able to find a solution, but good thing is that nobody else has ever reported that problem since, either.

Re: Broken vactrain lines

Posted: 02 Nov 2019 01:31
by arag_cf
Well OK I got ya.

I'll take a look at the savegame. Thank you for link.

I'll come back shortly (in a few days).

Re: Broken vactrain lines

Posted: 02 Nov 2019 03:22
by arag_cf
I checked the savegame and it tells me "Savegame is made with newer version". (((

Re: Broken vactrain lines

Posted: 02 Nov 2019 03:52
by kamnet
arag_cf wrote: 02 Nov 2019 03:22 I checked the savegame and it tells me "Savegame is made with newer version". (((
Yes, you'll need to use ChillCore's Patch Pack v 14.7 r2555, found here: download/file.php?id=169156