src/saveload.cpp
changeset 10770 c1e1fb4bd561
parent 10751 ebd94f2d6385
child 10771 6c7035d85faf
equal deleted inserted replaced
10769:a005e45d1f09 10770:c1e1fb4bd561
  1469 	}
  1469 	}
  1470 	return def;
  1470 	return def;
  1471 }
  1471 }
  1472 
  1472 
  1473 /* actual loader/saver function */
  1473 /* actual loader/saver function */
  1474 void InitializeGame(int mode, uint size_x, uint size_y);
  1474 void InitializeGame(uint size_x, uint size_y, bool reset_date);
  1475 extern bool AfterLoadGame();
  1475 extern bool AfterLoadGame();
  1476 extern void BeforeSaveGame();
  1476 extern void BeforeSaveGame();
  1477 extern bool LoadOldSaveGame(const char *file);
  1477 extern bool LoadOldSaveGame(const char *file);
  1478 
  1478 
  1479 /** Small helper function to close the to be loaded savegame an signal error */
  1479 /** Small helper function to close the to be loaded savegame an signal error */
  1632 
  1632 
  1633 	_next_offs = 0;
  1633 	_next_offs = 0;
  1634 
  1634 
  1635 	/* Load a TTDLX or TTDPatch game */
  1635 	/* Load a TTDLX or TTDPatch game */
  1636 	if (mode == SL_OLD_LOAD) {
  1636 	if (mode == SL_OLD_LOAD) {
  1637 		InitializeGame(IG_DATE_RESET, 256, 256); // set a mapsize of 256x256 for TTDPatch games or it might get confused
  1637 		InitializeGame(256, 256, true); // set a mapsize of 256x256 for TTDPatch games or it might get confused
  1638 		if (!LoadOldSaveGame(filename)) return SL_REINIT;
  1638 		if (!LoadOldSaveGame(filename)) return SL_REINIT;
  1639 		_sl_version = 0;
  1639 		_sl_version = 0;
  1640 		_sl_minor_version = 0;
  1640 		_sl_minor_version = 0;
  1641 		if (!AfterLoadGame()) return SL_REINIT;
  1641 		if (!AfterLoadGame()) return SL_REINIT;
  1642 		return SL_OK;
  1642 		return SL_OK;
  1745 			}
  1745 			}
  1746 
  1746 
  1747 			/* Old maps were hardcoded to 256x256 and thus did not contain
  1747 			/* Old maps were hardcoded to 256x256 and thus did not contain
  1748 			 * any mapsize information. Pre-initialize to 256x256 to not to
  1748 			 * any mapsize information. Pre-initialize to 256x256 to not to
  1749 			 * confuse old games */
  1749 			 * confuse old games */
  1750 			InitializeGame(IG_DATE_RESET, 256, 256);
  1750 			InitializeGame(256, 256, true);
  1751 
  1751 
  1752 			SlLoadChunks();
  1752 			SlLoadChunks();
  1753 			fmt->uninit_read();
  1753 			fmt->uninit_read();
  1754 			fclose(_sl.fh);
  1754 			fclose(_sl.fh);
  1755 
  1755