The International Simutrans Forum

 

Author Topic: Crash when replacing vehicles  (Read 4722 times)

0 Members and 1 Guest are viewing this topic.

Offline ivansanchez

  • *
  • Posts: 10
Crash when replacing vehicles
« on: December 31, 2009, 02:47:28 AM »
Hi all,

It seems that I'm able to crash simutrans experimental when trying to upgrade horses to light tractors. The crash looks like this:

Then, when pressing any key, simutrans crashes.

In order to reproduce this crash, download http://ivan.sanchezortega.es/foo34.sve, and bulk-replace all the horses with tractors. Then fast-forward until you hit a new year.

If that doesn't crash, try http://ivan.sanchezortega.es/foo35-replaced.sve - it should crash instantly.

Edit: I've fiddled with this for a bit, and it seems that there is no need for replacing - the bug triggers with a "withdraw all" on any road line carrying piece goods, and then waiting until next year, or trying to save.

Edit: Weird. You don't need to do anything at all. Just wait until the next year or try to save.
« Last Edit: December 31, 2009, 03:17:37 AM by ivansanchez »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20188
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Crash when replacing vehicles
« Reply #1 on: December 31, 2009, 11:22:24 AM »
Ivan,

thank you very much for your report. I am currently away from home and not able to get to my copy of the development code or a fast enough computer to test this, but I'll look into this when I get home next week, and try to reproduce/fix it.

Offline Bernd Gabriel

  • *
  • Posts: 230
  • Addicted to Simutrans: since 2003
    • Fast Function Factory
  • Languages: DE, EN, C++
Re: Crash when replacing vehicles
« Reply #2 on: December 31, 2009, 01:05:22 PM »
Ivan,

I can't load http://ivan.sanchezortega.es/foo35-replaced.sve, too.

In http://ivan.sanchezortega.es/foo34.sve withdrawing all convoys from "Newcastle-Cambridge cattle convoy" crashes the game. I continue investigating this...

Congradulations: 800 convoys in 1 line could be a new world record!  :award:

Offline Bernd Gabriel

  • *
  • Posts: 230
  • Addicted to Simutrans: since 2003
    • Fast Function Factory
  • Languages: DE, EN, C++
Re: Crash when replacing vehicles
« Reply #3 on: December 31, 2009, 02:33:29 PM »
Fixed 2 errors in the "withdraw" related code.
Will be fixed in Exp.7.2.

Offline ivansanchez

  • *
  • Posts: 10
Re: Crash when replacing vehicles
« Reply #4 on: December 31, 2009, 02:53:52 PM »
Congratulations: 800 convoys in 1 line could be a new world record!  :award:

What can I say, cattle drovers were the only way to make a profit in a 1830 game :-)

By the way: did you try to load foo34.sve and just fast-forward until next year?

Offline Bernd Gabriel

  • *
  • Posts: 230
  • Addicted to Simutrans: since 2003
    • Fast Function Factory
  • Languages: DE, EN, C++
Re: Crash when replacing vehicles
« Reply #5 on: December 31, 2009, 03:05:35 PM »
Yes: I'm getting an error while autosaving the fabconnection of an ai_good "Kohle". :(

Offline ivansanchez

  • *
  • Posts: 10
Re: Crash when replacing vehicles
« Reply #6 on: December 31, 2009, 03:11:06 PM »
The goods AIs in that game behaved a bit strange. They just build roads and then bulldoze them, without building stations or convoys for them.

I'm just guessing here: maybe it's because the AI plotted a route from an industry that got closed afterwards? Several sheep farms and orchards have already been closed down in that game.

Well, that's two bug reports for the price of one. Ain't you happy? :-D

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20188
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Crash when replacing vehicles
« Reply #7 on: December 31, 2009, 03:14:58 PM »
Ivan,

thank you very much for your further report.

Bernd,

thank you very much for the fix!

Offline Bernd Gabriel

  • *
  • Posts: 230
  • Addicted to Simutrans: since 2003
    • Fast Function Factory
  • Languages: DE, EN, C++
Re: Crash when replacing vehicles
« Reply #8 on: December 31, 2009, 03:34:15 PM »
@jamespetts
Closing fabs is an experimental feature, isn't it?
Is so, can you give me a hint, where I can find the closing code?

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20188
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Crash when replacing vehicles
« Reply #9 on: December 31, 2009, 03:37:43 PM »
Closing factories is indeed specific to Simutrans-Experimental. The code for deciding whether they are closed is in the new month method of karte_t (simworld.cc), and the code for what happens when they do close is in fabrik_t (simfab.cc).

Offline Bernd Gabriel

  • *
  • Posts: 230
  • Addicted to Simutrans: since 2003
    • Fast Function Factory
  • Languages: DE, EN, C++
Re: Crash when replacing vehicles
« Reply #10 on: January 01, 2010, 08:58:45 PM »
Removing a factory, no matter if done by experimental closing code or by 'destroy/remove' tool of player 'public service', now notifies all players, that a factory is going to be deleted. Thus ai_goods player is able to check and eventually clean up its various references to factories.

Loading a savegame with references to no longer existing factories and/or types of goods in ai_goods will remove those erroneous data.

This makes foo34.sve playable again.

Will be fixed in Exp. 7.2.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20188
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Crash when replacing vehicles
« Reply #11 on: January 01, 2010, 09:54:30 PM »
Excellent - good work Bernd!

Offline ivansanchez

  • *
  • Posts: 10
Re: Crash when replacing vehicles
« Reply #12 on: January 02, 2010, 01:22:19 AM »
Loading a savegame with references to no longer existing factories and/or types of goods in ai_goods will remove those erroneous data.

Kudos for fixing this!