News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

set_nosave() behavior

Started by z9999, October 04, 2009, 09:26:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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.

prissi

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.

z9999

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 ...

prissi

Certainly, this is a good suggestion.