News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

r2022 - route_index overflow when loading old savegames

Started by z9999, September 17, 2008, 06:18:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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;

DirrrtyDirk

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.
  
***** PAK128 Dev Team - semi-retired*****

prissi

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.