Skip to main content
Topic: [Bug v3.6] arrival_time of ware_t Objects is Overwritten when Loading Save Game (Read 2799 times) previous topic - next topic

[Bug v3.6] arrival_time of ware_t Objects is Overwritten when Loading Save Game

Hi James,

In haltestelle_t::rdwr() :

Quote

   // restoring all goods in the station
   char s[256];
   file->rdwr_str(s,256);
   while(*s) {
      file->rdwr_short(count, " ");
      if(count>0) {
         for(int i = 0; i < count; i++) {
            // add to internal storage (use this function, since the old categories were different)
            ware_t ware(welt,file);
            if(  ware.menge > 0 ) {
               add_ware_to_halt(ware);
            }
         }
      }
      file->rdwr_str(s,256);
   }


By adding ware_t objects to halts during save game loading using add_ware_to_halt(), their previously saved arrival_time will be overwritten with the world tick at load time :

Quote

void haltestelle_t::add_ware_to_halt(ware_t ware)
{
   //@author: jamespetts
   ware.arrival_time = welt->get_zeit_ms();

   ...


Re: [Bug v3.6] arrival_time of ware_t Objects is Overwritten when Loading Save Game

Reply #1
Thank you for spotting that! Now resolved for the next version.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.