Files
@ r17346:c18704fa8b81
Branch filter:
Location: cpp/openttd-patchpack/source/src/saveload/autoreplace_sl.cpp - annotation
r17346:c18704fa8b81
1.8 KiB
text/x-c
(svn r22098) -Codechange: Have an array of option data, use it in the option parsing routine. Adapt openttd option processing too.
r10571:99cb9a95b4cf r10571:99cb9a95b4cf r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r16546:a3376e2d6467 r10571:99cb9a95b4cf r16546:a3376e2d6467 r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r10571:99cb9a95b4cf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r11930:314dbf13f3bf r10571:99cb9a95b4cf r15322:29a1524c8399 r10571:99cb9a95b4cf | /* $Id$ */
/*
* 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 <http://www.gnu.org/licenses/>.
*/
/** @file autoreplace_sl.cpp Code handling saving and loading of autoreplace rules */
#include "../stdafx.h"
#include "../autoreplace_base.h"
#include "saveload.h"
static const SaveLoad _engine_renew_desc[] = {
SLE_VAR(EngineRenew, from, SLE_UINT16),
SLE_VAR(EngineRenew, to, SLE_UINT16),
SLE_REF(EngineRenew, next, REF_ENGINE_RENEWS),
SLE_CONDVAR(EngineRenew, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
SLE_END()
};
static void Save_ERNW()
{
EngineRenew *er;
FOR_ALL_ENGINE_RENEWS(er) {
SlSetArrayIndex(er->index);
SlObject(er, _engine_renew_desc);
}
}
static void Load_ERNW()
{
int index;
while ((index = SlIterateArray()) != -1) {
EngineRenew *er = new (index) EngineRenew();
SlObject(er, _engine_renew_desc);
/* Advanced vehicle lists, ungrouped vehicles got added */
if (IsSavegameVersionBefore(60)) {
er->group_id = ALL_GROUP;
} else if (IsSavegameVersionBefore(71)) {
if (er->group_id == DEFAULT_GROUP) er->group_id = ALL_GROUP;
}
}
}
static void Ptrs_ERNW()
{
EngineRenew *er;
FOR_ALL_ENGINE_RENEWS(er) {
SlObject(er, _engine_renew_desc);
}
}
extern const ChunkHandler _autoreplace_chunk_handlers[] = {
{ 'ERNW', Save_ERNW, Load_ERNW, Ptrs_ERNW, NULL, CH_ARRAY | CH_LAST},
};
|