Changeset - r25772:5ba83ce3a853
src/saveload/ai_sl.cpp
Show inline comments
 
@@ -124,11 +124,12 @@ static void Save_AIPL()
 
	for (int i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
 
		SlSetArrayIndex(i);
 
		SlAutolength((AutolengthProc *)SaveReal_AIPL, &i);
 
	}
 
}
 

	
 
static const ChunkHandler ai_chunk_handlers[] = {
 
	{ 'AIPL', Save_AIPL, Load_AIPL, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler AIPL{ 'AIPL', Save_AIPL, Load_AIPL, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef ai_chunk_handlers[] = {
 
	AIPL,
 
};
 

	
 
extern const ChunkHandlerTable _ai_chunk_handlers(ai_chunk_handlers);
src/saveload/airport_sl.cpp
Show inline comments
 
@@ -31,12 +31,14 @@ static void Save_ATID()
 

	
 
static void Load_ATID()
 
{
 
	Load_NewGRFMapping(_airporttile_mngr);
 
}
 

	
 
static const ChunkHandler airport_chunk_handlers[] = {
 
	{ 'ATID', Save_ATID, Load_ATID, nullptr, nullptr, CH_TABLE },
 
	{ 'APID', Save_APID, Load_APID, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler ATID{ 'ATID', Save_ATID, Load_ATID, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler APID{ 'APID', Save_APID, Load_APID, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef airport_chunk_handlers[] = {
 
	ATID,
 
	APID,
 
};
 

	
 
extern const ChunkHandlerTable _airport_chunk_handlers(airport_chunk_handlers);
src/saveload/animated_tile_sl.cpp
Show inline comments
 
@@ -65,11 +65,12 @@ static void Load_ANIT()
 

	
 
	if (SlIterateArray() == -1) return;
 
	SlGlobList(slt);
 
	if (SlIterateArray() != -1) SlErrorCorrupt("Too many ANIT entries");
 
}
 

	
 
static const ChunkHandler animated_tile_chunk_handlers[] = {
 
	{ 'ANIT', Save_ANIT, Load_ANIT, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler ANIT{ 'ANIT', Save_ANIT, Load_ANIT, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef animated_tile_chunk_handlers[] = {
 
	ANIT,
 
};
 

	
 
extern const ChunkHandlerTable _animated_tile_chunk_handlers(animated_tile_chunk_handlers);
src/saveload/autoreplace_sl.cpp
Show inline comments
 
@@ -58,11 +58,12 @@ static void Ptrs_ERNW()
 
{
 
	for (EngineRenew *er : EngineRenew::Iterate()) {
 
		SlObject(er, _engine_renew_desc);
 
	}
 
}
 

	
 
static const ChunkHandler autoreplace_chunk_handlers[] = {
 
	{ 'ERNW', Save_ERNW, Load_ERNW, Ptrs_ERNW, nullptr, CH_TABLE },
 
static const ChunkHandler ERNW{ 'ERNW', Save_ERNW, Load_ERNW, Ptrs_ERNW, nullptr, CH_TABLE };
 
static const ChunkHandlerRef autoreplace_chunk_handlers[] = {
 
	ERNW,
 
};
 

	
 
extern const ChunkHandlerTable _autoreplace_chunk_handlers(autoreplace_chunk_handlers);
src/saveload/cargomonitor_sl.cpp
Show inline comments
 
@@ -124,12 +124,14 @@ static void LoadPickup()
 
		std::pair<CargoMonitorID, uint32> p(storage.number, storage.amount);
 
		_cargo_pickups.insert(p);
 
	}
 
}
 

	
 
/** Chunk definition of the cargomonitoring maps. */
 
extern const ChunkHandler cargomonitor_chunk_handlers[] = {
 
	{ 'CMDL', SaveDelivery, LoadDelivery, nullptr, nullptr, CH_TABLE },
 
	{ 'CMPU', SavePickup,   LoadPickup,   nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler CMDL{ 'CMDL', SaveDelivery, LoadDelivery, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler CMPU{ 'CMPU', SavePickup,   LoadPickup,   nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef cargomonitor_chunk_handlers[] = {
 
	CMDL,
 
	CMPU,
 
};
 

	
 
extern const ChunkHandlerTable _cargomonitor_chunk_handlers(cargomonitor_chunk_handlers);
src/saveload/cargopacket_sl.cpp
Show inline comments
 
@@ -125,11 +125,12 @@ static void Load_CAPA()
 
	while ((index = SlIterateArray()) != -1) {
 
		CargoPacket *cp = new (index) CargoPacket();
 
		SlObject(cp, slt);
 
	}
 
}
 

	
 
static const ChunkHandler cargopacket_chunk_handlers[] = {
 
	{ 'CAPA', Save_CAPA, Load_CAPA, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler CAPA{ 'CAPA', Save_CAPA, Load_CAPA, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef cargopacket_chunk_handlers[] = {
 
	CAPA,
 
};
 

	
 
extern const ChunkHandlerTable _cargopacket_chunk_handlers(cargopacket_chunk_handlers);
src/saveload/cheat_sl.cpp
Show inline comments
 
@@ -72,11 +72,12 @@ static void Load_CHTS()
 

	
 
	if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() == -1) return;
 
	SlObject(&_cheats, slt);
 
	if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() != -1) SlErrorCorrupt("Too many CHTS entries");
 
}
 

	
 
static const ChunkHandler cheat_chunk_handlers[] = {
 
	{ 'CHTS', Save_CHTS, Load_CHTS, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler CHTS{ 'CHTS', Save_CHTS, Load_CHTS, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef cheat_chunk_handlers[] = {
 
	CHTS,
 
};
 

	
 
extern const ChunkHandlerTable _cheat_chunk_handlers(cheat_chunk_handlers);
src/saveload/company_sl.cpp
Show inline comments
 
@@ -554,12 +554,12 @@ static void Ptrs_PLYR()
 
{
 
	for (Company *c : Company::Iterate()) {
 
		SlObject(c, _company_desc);
 
	}
 
}
 

	
 

	
 
static const ChunkHandler company_chunk_handlers[] = {
 
	{ 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_TABLE },
 
static const ChunkHandler PLYR{ 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_TABLE };
 
static const ChunkHandlerRef company_chunk_handlers[] = {
 
	PLYR,
 
};
 

	
 
extern const ChunkHandlerTable _company_chunk_handlers(company_chunk_handlers);
src/saveload/depot_sl.cpp
Show inline comments
 
@@ -59,11 +59,12 @@ static void Ptrs_DEPT()
 
	for (Depot *depot : Depot::Iterate()) {
 
		SlObject(depot, _depot_desc);
 
		if (IsSavegameVersionBefore(SLV_141)) depot->town = Town::Get((size_t)depot->town);
 
	}
 
}
 

	
 
static const ChunkHandler depot_chunk_handlers[] = {
 
	{ 'DEPT', Save_DEPT, Load_DEPT, Ptrs_DEPT, nullptr, CH_TABLE },
 
static const ChunkHandler DEPT{ 'DEPT', Save_DEPT, Load_DEPT, Ptrs_DEPT, nullptr, CH_TABLE };
 
static const ChunkHandlerRef depot_chunk_handlers[] = {
 
	DEPT,
 
};
 

	
 
extern const ChunkHandlerTable _depot_chunk_handlers(depot_chunk_handlers);
src/saveload/economy_sl.cpp
Show inline comments
 
@@ -102,15 +102,18 @@ static void Ptrs_CAPY()
 
{
 
	for (CargoPayment *cp : CargoPayment::Iterate()) {
 
		SlObject(cp, _cargopayment_desc);
 
	}
 
}
 

	
 

	
 
static const ChunkHandler economy_chunk_handlers[] = {
 
	{ 'CAPY', Save_CAPY, Load_CAPY, Ptrs_CAPY, nullptr, CH_TABLE },
 
	{ 'PRIC', nullptr,   Load_PRIC, nullptr,   nullptr, CH_READONLY  },
 
	{ 'CAPR', nullptr,   Load_CAPR, nullptr,   nullptr, CH_READONLY  },
 
	{ 'ECMY', Save_ECMY, Load_ECMY, nullptr,   nullptr, CH_TABLE },
 
static const ChunkHandler CAPY{ 'CAPY', Save_CAPY, Load_CAPY, Ptrs_CAPY, nullptr, CH_TABLE };
 
static const ChunkHandler PRIC{ 'PRIC', nullptr,   Load_PRIC, nullptr,   nullptr, CH_READONLY };
 
static const ChunkHandler CAPR{ 'CAPR', nullptr,   Load_CAPR, nullptr,   nullptr, CH_READONLY };
 
static const ChunkHandler ECMY{ 'ECMY', Save_ECMY, Load_ECMY, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandlerRef economy_chunk_handlers[] = {
 
	CAPY,
 
	PRIC,
 
	CAPR,
 
	ECMY,
 
};
 

	
 
extern const ChunkHandlerTable _economy_chunk_handlers(economy_chunk_handlers);
src/saveload/engine_sl.cpp
Show inline comments
 
@@ -196,13 +196,16 @@ static void Load_EIDS()
 
	while (SlIterateArray() != -1) {
 
		EngineIDMapping *eid = &_engine_mngr.emplace_back();
 
		SlObject(eid, slt);
 
	}
 
}
 

	
 
static const ChunkHandler engine_chunk_handlers[] = {
 
	{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_TABLE },
 
	{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_TABLE },
 
	{ 'ENGS', nullptr,   Load_ENGS, nullptr, nullptr, CH_READONLY  },
 
static const ChunkHandler EIDS{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler ENGN{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler ENGS{ 'ENGS', nullptr,   Load_ENGS, nullptr, nullptr, CH_READONLY };
 
static const ChunkHandlerRef engine_chunk_handlers[] = {
 
	EIDS,
 
	ENGN,
 
	ENGS,
 
};
 

	
 
extern const ChunkHandlerTable _engine_chunk_handlers(engine_chunk_handlers);
src/saveload/game_sl.cpp
Show inline comments
 
@@ -185,12 +185,14 @@ static void Save_GSTR()
 
	for (uint i = 0; i < _current_data->raw_strings.size(); i++) {
 
		SlSetArrayIndex(i);
 
		SlObject(&_current_data->raw_strings[i], _game_language_desc);
 
	}
 
}
 

	
 
static const ChunkHandler game_chunk_handlers[] = {
 
	{ 'GSTR', Save_GSTR, Load_GSTR, nullptr, nullptr, CH_TABLE },
 
	{ 'GSDT', Save_GSDT, Load_GSDT, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler GSTR{ 'GSTR', Save_GSTR, Load_GSTR, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler GSDT{ 'GSDT', Save_GSDT, Load_GSDT, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef game_chunk_handlers[] = {
 
	GSTR,
 
	GSDT,
 
};
 

	
 
extern const ChunkHandlerTable _game_chunk_handlers(game_chunk_handlers);
src/saveload/gamelog_sl.cpp
Show inline comments
 
@@ -398,11 +398,12 @@ static void Load_GLOG()
 

	
 
static void Check_GLOG()
 
{
 
	Load_GLOG_common(_load_check_data.gamelog_action, _load_check_data.gamelog_actions);
 
}
 

	
 
static const ChunkHandler gamelog_chunk_handlers[] = {
 
	{ 'GLOG', Save_GLOG, Load_GLOG, nullptr, Check_GLOG, CH_TABLE }
 
static const ChunkHandler GLOG{ 'GLOG', Save_GLOG, Load_GLOG, nullptr, Check_GLOG, CH_TABLE };
 
static const ChunkHandlerRef gamelog_chunk_handlers[] = {
 
	GLOG,
 
};
 

	
 
extern const ChunkHandlerTable _gamelog_chunk_handlers(gamelog_chunk_handlers);
src/saveload/goal_sl.cpp
Show inline comments
 
@@ -43,11 +43,12 @@ static void Load_GOAL()
 
	while ((index = SlIterateArray()) != -1) {
 
		Goal *s = new (index) Goal();
 
		SlObject(s, slt);
 
	}
 
}
 

	
 
static const ChunkHandler goal_chunk_handlers[] = {
 
	{ 'GOAL', Save_GOAL, Load_GOAL, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler GOAL{ 'GOAL', Save_GOAL, Load_GOAL, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef goal_chunk_handlers[] = {
 
	GOAL,
 
};
 

	
 
extern const ChunkHandlerTable _goal_chunk_handlers(goal_chunk_handlers);
src/saveload/group_sl.cpp
Show inline comments
 
@@ -56,11 +56,12 @@ static void Load_GRPS()
 
			g->livery.colour1 = c->livery[LS_DEFAULT].colour1;
 
			g->livery.colour2 = c->livery[LS_DEFAULT].colour2;
 
		}
 
	}
 
}
 

	
 
static const ChunkHandler group_chunk_handlers[] = {
 
	{ 'GRPS', Save_GRPS, Load_GRPS, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler GRPS{ 'GRPS', Save_GRPS, Load_GRPS, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef group_chunk_handlers[] = {
 
	GRPS,
 
};
 

	
 
extern const ChunkHandlerTable _group_chunk_handlers(group_chunk_handlers);
src/saveload/industry_sl.cpp
Show inline comments
 
@@ -191,15 +191,20 @@ static void Load_ITBL()
 
	while ((index = SlIterateArray()) != -1) {
 
		if ((uint)index >= NUM_INDUSTRYTYPES) SlErrorCorrupt("Too many industry builder datas");
 
		SlObject(_industry_builder.builddata + index, slt);
 
	}
 
}
 

	
 
static const ChunkHandler industry_chunk_handlers[] = {
 
	{ 'INDY', Save_INDY, Load_INDY, Ptrs_INDY, nullptr, CH_TABLE },
 
	{ 'IIDS', Save_IIDS, Load_IIDS, nullptr,   nullptr, CH_TABLE },
 
	{ 'TIDS', Save_TIDS, Load_TIDS, nullptr,   nullptr, CH_TABLE },
 
	{ 'IBLD', Save_IBLD, Load_IBLD, nullptr,   nullptr, CH_TABLE },
 
	{ 'ITBL', Save_ITBL, Load_ITBL, nullptr,   nullptr, CH_TABLE },
 
static const ChunkHandler INDY{ 'INDY', Save_INDY, Load_INDY, Ptrs_INDY, nullptr, CH_TABLE };
 
static const ChunkHandler IIDS{ 'IIDS', Save_IIDS, Load_IIDS, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler TIDS{ 'TIDS', Save_TIDS, Load_TIDS, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler IBLD{ 'IBLD', Save_IBLD, Load_IBLD, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler ITBL{ 'ITBL', Save_ITBL, Load_ITBL, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandlerRef industry_chunk_handlers[] = {
 
	INDY,
 
	IIDS,
 
	TIDS,
 
	IBLD,
 
	ITBL,
 
};
 

	
 
extern const ChunkHandlerTable _industry_chunk_handlers(industry_chunk_handlers);
src/saveload/labelmaps_sl.cpp
Show inline comments
 
@@ -124,12 +124,13 @@ static void Load_RAIL()
 
	while (SlIterateArray() != -1) {
 
		SlObject(&lo, slt);
 
		_railtype_list.push_back((RailTypeLabel)lo.label);
 
	}
 
}
 

	
 
static const ChunkHandler labelmaps_chunk_handlers[] = {
 
	{ 'RAIL', Save_RAIL, Load_RAIL, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler RAIL{ 'RAIL', Save_RAIL, Load_RAIL, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef labelmaps_chunk_handlers[] = {
 
	RAIL,
 
};
 

	
 
extern const ChunkHandlerTable _labelmaps_chunk_handlers(labelmaps_chunk_handlers);
 

	
src/saveload/linkgraph_sl.cpp
Show inline comments
 
@@ -323,13 +323,16 @@ static void Load_LGRS()
 
 */
 
static void Ptrs_LGRS()
 
{
 
	SlObject(&LinkGraphSchedule::instance, GetLinkGraphScheduleDesc());
 
}
 

	
 
static const ChunkHandler linkgraph_chunk_handlers[] = {
 
	{ 'LGRP', Save_LGRP, Load_LGRP, nullptr,   nullptr, CH_TABLE },
 
	{ 'LGRJ', Save_LGRJ, Load_LGRJ, nullptr,   nullptr, CH_TABLE },
 
	{ 'LGRS', Save_LGRS, Load_LGRS, Ptrs_LGRS, nullptr, CH_TABLE },
 
static const ChunkHandler LGRP{ 'LGRP', Save_LGRP, Load_LGRP, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler LGRJ{ 'LGRJ', Save_LGRJ, Load_LGRJ, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler LGRS{ 'LGRS', Save_LGRS, Load_LGRS, Ptrs_LGRS, nullptr, CH_TABLE };
 
static const ChunkHandlerRef linkgraph_chunk_handlers[] = {
 
	LGRP,
 
	LGRJ,
 
	LGRS,
 
};
 

	
 
extern const ChunkHandlerTable _linkgraph_chunk_handlers(linkgraph_chunk_handlers);
src/saveload/map_sl.cpp
Show inline comments
 
@@ -306,22 +306,32 @@ static void Save_MAP8()
 
	for (TileIndex i = 0; i != size;) {
 
		for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _me[i++].m8;
 
		SlCopy(buf.data(), MAP_SL_BUF_SIZE, SLE_UINT16);
 
	}
 
}
 

	
 

	
 
static const ChunkHandler map_chunk_handlers[] = {
 
	{ 'MAPS', Save_MAPS, Load_MAPS, nullptr, Check_MAPS, CH_TABLE },
 
	{ 'MAPT', Save_MAPT, Load_MAPT, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAPH', Save_MAPH, Load_MAPH, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAPO', Save_MAP1, Load_MAP1, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAP2', Save_MAP2, Load_MAP2, nullptr, nullptr,    CH_RIFF },
 
	{ 'M3LO', Save_MAP3, Load_MAP3, nullptr, nullptr,    CH_RIFF },
 
	{ 'M3HI', Save_MAP4, Load_MAP4, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAP5', Save_MAP5, Load_MAP5, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAPE', Save_MAP6, Load_MAP6, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAP7', Save_MAP7, Load_MAP7, nullptr, nullptr,    CH_RIFF },
 
	{ 'MAP8', Save_MAP8, Load_MAP8, nullptr, nullptr,    CH_RIFF },
 
static const ChunkHandler MAPS{ 'MAPS', Save_MAPS, Load_MAPS, nullptr, Check_MAPS, CH_TABLE };
 
static const ChunkHandler MAPT{ 'MAPT', Save_MAPT, Load_MAPT, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAPH{ 'MAPH', Save_MAPH, Load_MAPH, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAPO{ 'MAPO', Save_MAP1, Load_MAP1, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAP2{ 'MAP2', Save_MAP2, Load_MAP2, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler M3LO{ 'M3LO', Save_MAP3, Load_MAP3, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler M3HI{ 'M3HI', Save_MAP4, Load_MAP4, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAP5{ 'MAP5', Save_MAP5, Load_MAP5, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAPE{ 'MAPE', Save_MAP6, Load_MAP6, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAP7{ 'MAP7', Save_MAP7, Load_MAP7, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandler MAP8{ 'MAP8', Save_MAP8, Load_MAP8, nullptr, nullptr,    CH_RIFF };
 
static const ChunkHandlerRef map_chunk_handlers[] = {
 
	MAPS,
 
	MAPT,
 
	MAPH,
 
	MAPO,
 
	MAP2,
 
	M3LO,
 
	M3HI,
 
	MAP5,
 
	MAPE,
 
	MAP7,
 
	MAP8,
 
};
 

	
 
extern const ChunkHandlerTable _map_chunk_handlers(map_chunk_handlers);
src/saveload/misc_sl.cpp
Show inline comments
 
@@ -149,12 +149,14 @@ static void Load_VIEW()
 

	
 
	if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() == -1) return;
 
	SlGlobList(slt);
 
	if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() != -1) SlErrorCorrupt("Too many DATE entries");
 
}
 

	
 
static const ChunkHandler misc_chunk_handlers[] = {
 
	{ 'DATE', Save_DATE, Load_DATE, nullptr, Check_DATE, CH_TABLE },
 
	{ 'VIEW', Save_VIEW, Load_VIEW, nullptr, nullptr,    CH_TABLE },
 
static const ChunkHandler DATE{ 'DATE', Save_DATE, Load_DATE, nullptr, Check_DATE, CH_TABLE };
 
static const ChunkHandler VIEW{ 'VIEW', Save_VIEW, Load_VIEW, nullptr, nullptr,    CH_TABLE };
 
static const ChunkHandlerRef misc_chunk_handlers[] = {
 
	DATE,
 
	VIEW,
 
};
 

	
 
extern const ChunkHandlerTable _misc_chunk_handlers(misc_chunk_handlers);
src/saveload/newgrf_sl.cpp
Show inline comments
 
@@ -118,11 +118,12 @@ static void Load_NGRF()
 

	
 
static void Check_NGRF()
 
{
 
	Load_NGRF_common(_load_check_data.grfconfig);
 
}
 

	
 
static const ChunkHandler newgrf_chunk_handlers[] = {
 
	{ 'NGRF', Save_NGRF, Load_NGRF, nullptr, Check_NGRF, CH_TABLE }
 
static const ChunkHandler NGRF{ 'NGRF', Save_NGRF, Load_NGRF, nullptr, Check_NGRF, CH_TABLE };
 
static const ChunkHandlerRef newgrf_chunk_handlers[] = {
 
	NGRF,
 
};
 

	
 
extern const ChunkHandlerTable _newgrf_chunk_handlers(newgrf_chunk_handlers);
src/saveload/object_sl.cpp
Show inline comments
 
@@ -69,12 +69,14 @@ static void Save_OBID()
 

	
 
static void Load_OBID()
 
{
 
	Load_NewGRFMapping(_object_mngr);
 
}
 

	
 
static const ChunkHandler object_chunk_handlers[] = {
 
	{ 'OBID', Save_OBID, Load_OBID, nullptr,   nullptr, CH_TABLE },
 
	{ 'OBJS', Save_OBJS, Load_OBJS, Ptrs_OBJS, nullptr, CH_TABLE },
 
static const ChunkHandler OBID{ 'OBID', Save_OBID, Load_OBID, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler OBJS{ 'OBJS', Save_OBJS, Load_OBJS, Ptrs_OBJS, nullptr, CH_TABLE };
 
static const ChunkHandlerRef object_chunk_handlers[] = {
 
	OBID,
 
	OBJS,
 
};
 

	
 
extern const ChunkHandlerTable _object_chunk_handlers(object_chunk_handlers);
src/saveload/order_sl.cpp
Show inline comments
 
@@ -295,13 +295,16 @@ static void Ptrs_BKOR()
 
{
 
	for (OrderBackup *ob : OrderBackup::Iterate()) {
 
		SlObject(ob, GetOrderBackupDescription());
 
	}
 
}
 

	
 
static const ChunkHandler order_chunk_handlers[] = {
 
	{ 'BKOR', Save_BKOR, Load_BKOR, Ptrs_BKOR, nullptr, CH_TABLE },
 
	{ 'ORDR', Save_ORDR, Load_ORDR, Ptrs_ORDR, nullptr, CH_TABLE },
 
	{ 'ORDL', Save_ORDL, Load_ORDL, Ptrs_ORDL, nullptr, CH_TABLE },
 
static const ChunkHandler BKOR{ 'BKOR', Save_BKOR, Load_BKOR, Ptrs_BKOR, nullptr, CH_TABLE };
 
static const ChunkHandler ORDR{ 'ORDR', Save_ORDR, Load_ORDR, Ptrs_ORDR, nullptr, CH_TABLE };
 
static const ChunkHandler ORDL{ 'ORDL', Save_ORDL, Load_ORDL, Ptrs_ORDL, nullptr, CH_TABLE };
 
static const ChunkHandlerRef order_chunk_handlers[] = {
 
	BKOR,
 
	ORDR,
 
	ORDL,
 
};
 

	
 
extern const ChunkHandlerTable _order_chunk_handlers(order_chunk_handlers);
src/saveload/saveload.cpp
Show inline comments
 
@@ -213,13 +213,13 @@ struct SaveLoadParams {
 
	uint16 game_speed;                   ///< The game speed when saving started.
 
	bool saveinprogress;                 ///< Whether there is currently a save in progress.
 
};
 

	
 
static SaveLoadParams _sl; ///< Parameters used for/at saveload.
 

	
 
static const std::vector<ChunkHandler> &ChunkHandlers()
 
static const std::vector<ChunkHandlerRef> &ChunkHandlers()
 
{
 
	/* These define the chunks */
 
	extern const ChunkHandlerTable _gamelog_chunk_handlers;
 
	extern const ChunkHandlerTable _map_chunk_handlers;
 
	extern const ChunkHandlerTable _misc_chunk_handlers;
 
	extern const ChunkHandlerTable _name_chunk_handlers;
 
@@ -287,13 +287,13 @@ static const std::vector<ChunkHandler> &
 
		_linkgraph_chunk_handlers,
 
		_airport_chunk_handlers,
 
		_object_chunk_handlers,
 
		_persistent_storage_chunk_handlers,
 
	};
 

	
 
	static std::vector<ChunkHandler> _chunk_handlers;
 
	static std::vector<ChunkHandlerRef> _chunk_handlers;
 

	
 
	if (_chunk_handlers.empty()) {
 
		for (auto &chunk_handler_table : _chunk_handler_tables) {
 
			for (auto &chunk_handler : chunk_handler_table) {
 
				_chunk_handlers.push_back(chunk_handler);
 
			}
 
@@ -310,13 +310,13 @@ static void SlNullPointers()
 

	
 
	/* We don't want any savegame conversion code to run
 
	 * during NULLing; especially those that try to get
 
	 * pointers from other pools. */
 
	_sl_version = SAVEGAME_VERSION;
 

	
 
	for (auto &ch : ChunkHandlers()) {
 
	for (const ChunkHandler &ch : ChunkHandlers()) {
 
		if (ch.fix_pointers) {
 
			Debug(sl, 3, "Nulling pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			ch.FixPointers();
 
		}
 
	}
 

	
 
@@ -2309,13 +2309,13 @@ static void SlSaveChunks()
 
 * chunk in the savegame or in memory
 
 * @param id the chunk in question
 
 * @return returns the appropriate chunkhandler
 
 */
 
static const ChunkHandler *SlFindChunkHandler(uint32 id)
 
{
 
	for (auto &ch : ChunkHandlers()) if (ch.id == id) return &ch;
 
	for (const ChunkHandler &ch : ChunkHandlers()) if (ch.id == id) return &ch;
 
	return nullptr;
 
}
 

	
 
/** Load all chunks */
 
static void SlLoadChunks()
 
{
 
@@ -2348,13 +2348,13 @@ static void SlLoadCheckChunks()
 

	
 
/** Fix all pointers (convert index -> pointer) */
 
static void SlFixPointers()
 
{
 
	_sl.action = SLA_PTRS;
 

	
 
	for (auto &ch : ChunkHandlers()) {
 
	for (const ChunkHandler &ch : ChunkHandlers()) {
 
		if (ch.fix_pointers) {
 
			Debug(sl, 3, "Fixing pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			ch.FixPointers();
 
		}
 
	}
 

	
src/saveload/saveload.h
Show inline comments
 
@@ -447,14 +447,17 @@ struct ChunkHandler {
 
	 * Default implementation just skips the data.
 
	 * @param len Number of bytes to skip.
 
	 */
 
	virtual void LoadCheck(size_t len = 0) const;
 
};
 

	
 
/** A reference to ChunkHandler. */
 
using ChunkHandlerRef = std::reference_wrapper<const ChunkHandler>;
 

	
 
/** A table of ChunkHandler entries. */
 
using ChunkHandlerTable = span<const ChunkHandler>;
 
using ChunkHandlerTable = span<const ChunkHandlerRef>;
 

	
 
/** A table of SaveLoad entries. */
 
using SaveLoadTable = span<const struct SaveLoad>;
 

	
 
/** A table of SaveLoadCompat entries. */
 
using SaveLoadCompatTable = span<const struct SaveLoadCompat>;
src/saveload/settings_sl.cpp
Show inline comments
 
@@ -167,12 +167,14 @@ static void Check_PATS()
 

	
 
static void Save_PATS()
 
{
 
	SaveSettings(_settings, &_settings_game);
 
}
 

	
 
static const ChunkHandler setting_chunk_handlers[] = {
 
	{ 'OPTS', nullptr,   Load_OPTS, nullptr, nullptr,    CH_READONLY  },
 
	{ 'PATS', Save_PATS, Load_PATS, nullptr, Check_PATS, CH_TABLE },
 
static const ChunkHandler OPTS{ 'OPTS', nullptr,   Load_OPTS, nullptr, nullptr,    CH_READONLY };
 
static const ChunkHandler PATS{ 'PATS', Save_PATS, Load_PATS, nullptr, Check_PATS, CH_TABLE };
 
static const ChunkHandlerRef setting_chunk_handlers[] = {
 
	OPTS,
 
	PATS,
 
};
 

	
 
extern const ChunkHandlerTable _setting_chunk_handlers(setting_chunk_handlers);
src/saveload/signs_sl.cpp
Show inline comments
 
@@ -64,11 +64,12 @@ static void Load_SIGN()
 
		if (IsSavegameVersionBefore(SLV_171) && si->owner == OWNER_NONE && _file_to_saveload.abstract_ftype == FT_SCENARIO) {
 
			si->owner = OWNER_DEITY;
 
		}
 
	}
 
}
 

	
 
static const ChunkHandler sign_chunk_handlers[] = {
 
	{ 'SIGN', Save_SIGN, Load_SIGN, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler SIGN{ 'SIGN', Save_SIGN, Load_SIGN, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef sign_chunk_handlers[] = {
 
	SIGN,
 
};
 

	
 
extern const ChunkHandlerTable _sign_chunk_handlers(sign_chunk_handlers);
src/saveload/station_sl.cpp
Show inline comments
 
@@ -716,13 +716,16 @@ static void Ptrs_ROADSTOP()
 
{
 
	for (RoadStop *rs : RoadStop::Iterate()) {
 
		SlObject(rs, _roadstop_desc);
 
	}
 
}
 

	
 
static const ChunkHandler station_chunk_handlers[] = {
 
	{ 'STNS', nullptr,       Load_STNS,     Ptrs_STNS,     nullptr, CH_READONLY },
 
	{ 'STNN', Save_STNN,     Load_STNN,     Ptrs_STNN,     nullptr, CH_TABLE },
 
	{ 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, nullptr, CH_TABLE },
 
static const ChunkHandler STNS{ 'STNS', nullptr,       Load_STNS,     Ptrs_STNS,     nullptr, CH_READONLY };
 
static const ChunkHandler STNN{ 'STNN', Save_STNN,     Load_STNN,     Ptrs_STNN,     nullptr, CH_TABLE };
 
static const ChunkHandler ROAD{ 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, nullptr, CH_TABLE };
 
static const ChunkHandlerRef station_chunk_handlers[] = {
 
	STNS,
 
	STNN,
 
	ROAD,
 
};
 

	
 
extern const ChunkHandlerTable _station_chunk_handlers(station_chunk_handlers);
src/saveload/storage_sl.cpp
Show inline comments
 
@@ -47,11 +47,12 @@ static void Save_PSAC()
 
		ps->ClearChanges();
 
		SlSetArrayIndex(ps->index);
 
		SlObject(ps, _storage_desc);
 
	}
 
}
 

	
 
static const ChunkHandler persistent_storage_chunk_handlers[] = {
 
	{ 'PSAC', Save_PSAC, Load_PSAC, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler PSAC{ 'PSAC', Save_PSAC, Load_PSAC, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef persistent_storage_chunk_handlers[] = {
 
	PSAC,
 
};
 

	
 
extern const ChunkHandlerTable _persistent_storage_chunk_handlers(persistent_storage_chunk_handlers);
src/saveload/story_sl.cpp
Show inline comments
 
@@ -102,12 +102,14 @@ static void Load_STORY_PAGE()
 
	/* Update the next sort value, so that the next
 
	 * created page is shown after all existing pages.
 
	 */
 
	_story_page_next_sort_value = max_sort_value + 1;
 
}
 

	
 
static const ChunkHandler story_page_chunk_handlers[] = {
 
	{ 'STPE', Save_STORY_PAGE_ELEMENT, Load_STORY_PAGE_ELEMENT, nullptr, nullptr, CH_TABLE },
 
	{ 'STPA', Save_STORY_PAGE,         Load_STORY_PAGE,         nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler STPE{ 'STPE', Save_STORY_PAGE_ELEMENT, Load_STORY_PAGE_ELEMENT, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandler STPA{ 'STPA', Save_STORY_PAGE,         Load_STORY_PAGE,         nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef story_page_chunk_handlers[] = {
 
	STPE,
 
	STPA,
 
};
 

	
 
extern const ChunkHandlerTable _story_page_chunk_handlers(story_page_chunk_handlers);
src/saveload/strings_sl.cpp
Show inline comments
 
@@ -127,11 +127,12 @@ static void Load_NAME()
 
		SlCopy(&_old_name_array[LEN_OLD_STRINGS * index], SlGetFieldLength(), SLE_UINT8);
 
		/* Make sure the old name is null terminated */
 
		_old_name_array[LEN_OLD_STRINGS * index + LEN_OLD_STRINGS - 1] = '\0';
 
	}
 
}
 

	
 
static const ChunkHandler name_chunk_handlers[] = {
 
	{ 'NAME', nullptr, Load_NAME, nullptr, nullptr, CH_READONLY },
 
static const ChunkHandler NAME{ 'NAME', nullptr, Load_NAME, nullptr, nullptr, CH_READONLY };
 
static const ChunkHandlerRef name_chunk_handlers[] = {
 
	NAME,
 
};
 

	
 
extern const ChunkHandlerTable _name_chunk_handlers(name_chunk_handlers);
src/saveload/subsidy_sl.cpp
Show inline comments
 
@@ -47,11 +47,12 @@ static void Load_SUBS()
 
	while ((index = SlIterateArray()) != -1) {
 
		Subsidy *s = new (index) Subsidy();
 
		SlObject(s, slt);
 
	}
 
}
 

	
 
static const ChunkHandler subsidy_chunk_handlers[] = {
 
	{ 'SUBS', Save_SUBS, Load_SUBS, nullptr, nullptr, CH_TABLE },
 
static const ChunkHandler SUBS{ 'SUBS', Save_SUBS, Load_SUBS, nullptr, nullptr, CH_TABLE };
 
static const ChunkHandlerRef subsidy_chunk_handlers[] = {
 
	SUBS,
 
};
 

	
 
extern const ChunkHandlerTable _subsidy_chunk_handlers(subsidy_chunk_handlers);
src/saveload/town_sl.cpp
Show inline comments
 
@@ -315,12 +315,14 @@ static void Ptrs_TOWN()
 

	
 
	for (Town *t : Town::Iterate()) {
 
		SlObject(t, _town_desc);
 
	}
 
}
 

	
 
static const ChunkHandler town_chunk_handlers[] = {
 
	{ 'HIDS', Save_HIDS, Load_HIDS, nullptr,   nullptr, CH_TABLE },
 
	{ 'CITY', Save_TOWN, Load_TOWN, Ptrs_TOWN, nullptr, CH_TABLE },
 
static const ChunkHandler HIDS{ 'HIDS', Save_HIDS, Load_HIDS, nullptr,   nullptr, CH_TABLE };
 
static const ChunkHandler CITY{ 'CITY', Save_TOWN, Load_TOWN, Ptrs_TOWN, nullptr, CH_TABLE };
 
static const ChunkHandlerRef town_chunk_handlers[] = {
 
	HIDS,
 
	CITY,
 
};
 

	
 
extern const ChunkHandlerTable _town_chunk_handlers(town_chunk_handlers);
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -1061,11 +1061,12 @@ void Ptrs_VEHS()
 
{
 
	for (Vehicle *v : Vehicle::Iterate()) {
 
		SlObject(v, _vehicle_desc);
 
	}
 
}
 

	
 
static const ChunkHandler veh_chunk_handlers[] = {
 
	{ 'VEHS', Save_VEHS, Load_VEHS, Ptrs_VEHS, nullptr, CH_SPARSE_TABLE },
 
static const ChunkHandler VEHS{ 'VEHS', Save_VEHS, Load_VEHS, Ptrs_VEHS, nullptr, CH_SPARSE_TABLE };
 
static const ChunkHandlerRef veh_chunk_handlers[] = {
 
	VEHS,
 
};
 

	
 
extern const ChunkHandlerTable _veh_chunk_handlers(veh_chunk_handlers);
src/saveload/waypoint_sl.cpp
Show inline comments
 
@@ -221,11 +221,12 @@ static void Ptrs_WAYP()
 
		if (IsSavegameVersionBefore(SLV_84)) {
 
			wp.name = CopyFromOldName(wp.string_id);
 
		}
 
	}
 
}
 

	
 
static const ChunkHandler waypoint_chunk_handlers[] = {
 
	{ 'CHKP', nullptr, Load_WAYP, Ptrs_WAYP, nullptr, CH_READONLY },
 
static const ChunkHandler CHKP{ 'CHKP', nullptr, Load_WAYP, Ptrs_WAYP, nullptr, CH_READONLY };
 
static const ChunkHandlerRef waypoint_chunk_handlers[] = {
 
	CHKP,
 
};
 

	
 
extern const ChunkHandlerTable _waypoint_chunk_handlers(waypoint_chunk_handlers);
0 comments (0 inline, 0 general)