The International Simutrans Forum

 

Author Topic: r2022 - route_index overflow when loading old savegames  (Read 2999 times)

0 Members and 1 Guest are viewing this topic.

Offline z9999

  • Devotees (Inactive)
  • *
  • Posts: 848
r2022 - route_index overflow when loading old savegames
« on: September 17, 2008, 06:18:05 AM »
simutrans r2022

When I loading very old savegames, some games cause to crash.
These games could read in v100.0.

Quote
Message: convoi_t::register_with_line():   ( 8 ) 日産ディーゼル タンクローリー1800 registers for 1
Message: convoi_t::laden_abschliessen():   state=DRIVING, next_stop_index=8
Message: automobil_t::setze_convoi():   0876F410
Message: automobil_t::setze_convoi():   0876F410
Message: convoi_t::laden_abschliessen():   next_stop_index=65535
Message: convoi_t::laden_abschliessen():   state=DRIVING, next_stop_index=8
Message: automobil_t::setze_convoi():   0876FBB0
Message: convoi_t::laden_abschliessen():   next_stop_index=65535
Warning: convoi_t::laden_abschliessen():   cnv 10 is currently too long.
FATAL ERROR: vector_tpl<T>::[]
index out of bounds: 47 not in 0..46
Aborting program execution ...

When I changed source code like below, crash didn't happen.
But I don't understand source code well, so I'm not sure this is correct or not.

simvehikel.cc:726 in void vehikel_t::neue_fahrt(uint16 start_route_index, bool recalc)
Quote
   route_index = start_route_index+1;
=>
Quote
   route_index = (start_route_index<cnv->get_route()->gib_max_n()) ? start_route_index+1: start_route_index;

Offline DirrrtyDirk

  • Devotees (Inactive)
  • *
  • Posts: 1253
  • JR 700 Series Shinkansen
  • Languages: EN,DE
Re: r2022 - route_index overflow when loading old savegames
« Reply #1 on: September 17, 2008, 05:25:36 PM »
Just F.Y.I. : prissi isn't around this week, so it might take a while until you get a reply or until something is changed.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9559
  • Languages: De,EN,JP
Re: r2022 - route_index overflow when loading old savegames
« Reply #2 on: September 19, 2008, 08:55:14 PM »
Well, this is not the right place to fix it., because this will misalign many other convoi. I done, then it should be rather in simconvoi.cc. I will look into it. (The error is due to different diagonals and vehicle length. For replacement vehicle, which are shorter, the error should not occur.)

Well, I just started all convois one field back, if possible. Please recheck.
« Last Edit: September 19, 2008, 08:57:54 PM by prissi »