/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
*/
/**
* @file saveload.cpp
* All actions handling saving and loading goes on in this file. The general actions
* are as follows for saving a game (loading is analogous):
*
* - initialize the writer by creating a temporary memory-buffer for it
*
- go through all to-be saved elements, each 'chunk' (#ChunkHandler) prefixed by a label
*
- use their description array (#SaveLoad) to know what elements to save and in what version
* of the game it was active (used when loading)
*
- write all data byte-by-byte to the temporary buffer so it is endian-safe
*
- when the buffer is full; flush it to the output (eg save to file) (_sl.buf, _sl.bufp, _sl.bufe)
*
- repeat this until everything is done, and flush any remaining output to file
*
*/
#include "../stdafx.h"
#include "saveload.h"
#include "../debug.h"
#include "../string_func.h"
#include "../string_func_extra.h"
#include "../strings_func.h"
#include "../core/bitmath_func.hpp"
#include "../vehicle_base.h"
#include "../station_base.h"
#include "../linkgraph/linkgraph.h"
#include "../linkgraph/linkgraphjob.h"
#include "../town.h"
#include "../roadstop_base.h"
#include "../autoreplace_base.h"
#include "../core/ring_buffer.hpp"
#include
#include
#include
#include