saveload.c
changeset 4549 106ed18a7675
parent 4328 1b3940c35724
child 4590 3bb61fa03c69
equal deleted inserted replaced
4548:6165e12570bf 4549:106ed18a7675
   686 		default: NOT_REACHED();
   686 		default: NOT_REACHED();
   687 		}
   687 		}
   688 		break;
   688 		break;
   689 
   689 
   690 	/* SL_WRITEBYTE translates a value of a variable to another one upon
   690 	/* SL_WRITEBYTE translates a value of a variable to another one upon
   691 		* saving or loading.
   691    * saving or loading.
   692 		* XXX - variable renaming abuse
   692    * XXX - variable renaming abuse
   693 		* game_value: the value of the variable ingame is abused by sld->version_from
   693    * game_value: the value of the variable ingame is abused by sld->version_from
   694 		* file_value: the value of the variable in the savegame is abused by sld->version_to */
   694    * file_value: the value of the variable in the savegame is abused by sld->version_to */
   695 	case SL_WRITEBYTE:
   695 	case SL_WRITEBYTE:
   696 		if (_sl.save) {
   696 		if (_sl.save) {
   697 			SlWriteByte(sld->version_to);
   697 			SlWriteByte(sld->version_to);
   698 		} else {
   698 		} else {
   699 			*(byte*)ptr = sld->version_from;
   699 			*(byte*)ptr = sld->version_from;
  1604 		SlLoadChunks();
  1604 		SlLoadChunks();
  1605 		fmt->uninit_read();
  1605 		fmt->uninit_read();
  1606 		fclose(_sl.fh);
  1606 		fclose(_sl.fh);
  1607 
  1607 
  1608 		/* After loading fix up savegame for any internal changes that
  1608 		/* After loading fix up savegame for any internal changes that
  1609 		* might've occured since then. If it fails, load back the old game */
  1609 		 * might've occured since then. If it fails, load back the old game */
  1610 		if (!AfterLoadGame()) return SL_REINIT;
  1610 		if (!AfterLoadGame()) return SL_REINIT;
  1611 	}
  1611 	}
  1612 
  1612 
  1613 	return SL_OK;
  1613 	return SL_OK;
  1614 }
  1614 }