The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: z9999 on October 04, 2009, 09:26:05 AM

Title: set_nosave() behavior
Post by: z9999 on October 04, 2009, 09:26:05 AM
Is this nosave flag really needed for none-factory buildings ?
I tested many, but none-factory buildings didn't cause any problems even if they don't have images.
Only factory buildings caused problems after reloading.

gebaeude.cc: gebaeude_t::rotate90()
Quote
            // may have a rotation, that is not recoverable
            if(!is_factory  ||  new_offset!=koord(0,0)  ||  ptr.fab->get_besch()->get_haus()->get_tile(0,0,0)==NULL) {
               // there are factories without a valid zero tile
               // => this map rotation cannot be reloaded!
               welt->set_nosave();
            }

If a player often changed map direction, just one city building which has problem will force stop saving a game.
This behavior is really bad, because player aalways lost their game and their time.
If this game was saved, player could continue play their game without any problems.

It should check only factory, isn't it ?

Quote
            // may have a rotation, that is not recoverable
            if(is_factory  &&  (new_offset!=koord(0,0)  ||  ptr.fab->get_besch()->get_haus()->get_tile(0,0,0)==NULL) ) {
               // there are factories without a valid zero tile
               // => this map rotation cannot be reloaded!
               welt->set_nosave();
            }

And also, this should be save a game anyway after 4 times trying, isn't it ?

Quote
   // rotate the map until it can be saved
   for( int i=0;  i<4  &&  nosave;  i++  ) {
      nosave = false;
      rotate90();
      needs_redraw = true;
   }

I think it makes player more happier than current one.
Title: Re: set_nosave() behavior
Post by: prissi on October 04, 2009, 09:38:57 PM
Well, assymetric station extensions would be also a problem ... but usually you cannot build them without crash. I think this is better than so give up completely. I included your suggestion, together with a routine to make best efforts first for trying correctly everything and then just saving correctly only factories.
Title: Re: set_nosave() behavior
Post by: z9999 on October 05, 2009, 12:13:41 PM
Thank you.
One thing, could you please change from w_time_delete to w_info ?
Because this window is always hidden by "Game successfully saved." window and will be closed at the same time.
So, we never see this warning.

simworld.cc:3492
Quote
         create_win( new news_img("Map may be not saveable in any rotation!"), w_time_delete, magic_none);
         // still broken, but we try anyway to save it ...
Title: Re: set_nosave() behavior
Post by: prissi on October 05, 2009, 02:22:13 PM
Certainly, this is a good suggestion.