Skip to content

Commit

Permalink
Codechange: Remove FOR_ALL_CHUNK_HANDLERS
Browse files Browse the repository at this point in the history
Co-Authored-By: Patric Stout <truebrain@openttd.org>
  • Loading branch information
glx22 and TrueBrain committed Jun 6, 2021
1 parent 3559e55 commit c27afdf
Show file tree
Hide file tree
Showing 35 changed files with 273 additions and 199 deletions.
6 changes: 4 additions & 2 deletions src/saveload/ai_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ static void Save_AIPL()
}
}

extern const ChunkHandler _ai_chunk_handlers[] = {
{ 'AIPL', Save_AIPL, Load_AIPL, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler ai_chunk_handlers[] = {
{ 'AIPL', Save_AIPL, Load_AIPL, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _ai_chunk_handlers(ai_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/airport_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ static void Load_ATID()
Load_NewGRFMapping(_airporttile_mngr);
}

extern const ChunkHandler _airport_chunk_handlers[] = {
static const ChunkHandler airport_chunk_handlers[] = {
{ 'ATID', Save_ATID, Load_ATID, nullptr, nullptr, CH_ARRAY },
{ 'APID', Save_APID, Load_APID, nullptr, nullptr, CH_ARRAY | CH_LAST },
{ 'APID', Save_APID, Load_APID, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _airport_chunk_handlers(airport_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/animated_tile_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static void Load_ANIT()
* "Definition" imported by the saveload code to be able to load and save
* the animated tile table.
*/
extern const ChunkHandler _animated_tile_chunk_handlers[] = {
{ 'ANIT', Save_ANIT, Load_ANIT, nullptr, nullptr, CH_RIFF | CH_LAST},
static const ChunkHandler animated_tile_chunk_handlers[] = {
{ 'ANIT', Save_ANIT, Load_ANIT, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _animated_tile_chunk_handlers(animated_tile_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/autoreplace_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static void Ptrs_ERNW()
}
}

extern const ChunkHandler _autoreplace_chunk_handlers[] = {
{ 'ERNW', Save_ERNW, Load_ERNW, Ptrs_ERNW, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler autoreplace_chunk_handlers[] = {
{ 'ERNW', Save_ERNW, Load_ERNW, Ptrs_ERNW, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _autoreplace_chunk_handlers(autoreplace_chunk_handlers);
8 changes: 5 additions & 3 deletions src/saveload/cargomonitor_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ static void LoadPickup()
}

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

extern const ChunkHandlerTable _cargomonitor_chunk_handlers(cargomonitor_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/cargopacket_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ static void Load_CAPA()
}

/** Chunk handlers related to cargo packets. */
extern const ChunkHandler _cargopacket_chunk_handlers[] = {
{ 'CAPA', Save_CAPA, Load_CAPA, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler cargopacket_chunk_handlers[] = {
{ 'CAPA', Save_CAPA, Load_CAPA, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _cargopacket_chunk_handlers(cargopacket_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/cheat_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ static void Load_CHTS()
}

/** Chunk handlers related to cheats. */
extern const ChunkHandler _cheat_chunk_handlers[] = {
{ 'CHTS', Save_CHTS, Load_CHTS, nullptr, nullptr, CH_RIFF | CH_LAST},
static const ChunkHandler cheat_chunk_handlers[] = {
{ 'CHTS', Save_CHTS, Load_CHTS, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _cheat_chunk_handlers(cheat_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/company_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ static void Ptrs_PLYR()
}


extern const ChunkHandler _company_chunk_handlers[] = {
{ 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_ARRAY | CH_LAST},
static const ChunkHandler company_chunk_handlers[] = {
{ 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_ARRAY },
};

extern const ChunkHandlerTable _company_chunk_handlers(company_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/depot_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ static void Ptrs_DEPT()
}
}

extern const ChunkHandler _depot_chunk_handlers[] = {
{ 'DEPT', Save_DEPT, Load_DEPT, Ptrs_DEPT, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler depot_chunk_handlers[] = {
{ 'DEPT', Save_DEPT, Load_DEPT, Ptrs_DEPT, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _depot_chunk_handlers(depot_chunk_handlers);
12 changes: 7 additions & 5 deletions src/saveload/economy_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ static void Ptrs_CAPY()
}


extern const ChunkHandler _economy_chunk_handlers[] = {
{ 'CAPY', Save_CAPY, Load_CAPY, Ptrs_CAPY, nullptr, CH_ARRAY},
{ 'PRIC', nullptr, Load_PRIC, nullptr, nullptr, CH_RIFF },
{ 'CAPR', nullptr, Load_CAPR, nullptr, nullptr, CH_RIFF },
{ 'ECMY', Save_ECMY, Load_ECMY, nullptr, nullptr, CH_RIFF | CH_LAST},
static const ChunkHandler economy_chunk_handlers[] = {
{ 'CAPY', Save_CAPY, Load_CAPY, Ptrs_CAPY, nullptr, CH_ARRAY },
{ 'PRIC', nullptr, Load_PRIC, nullptr, nullptr, CH_RIFF },
{ 'CAPR', nullptr, Load_CAPR, nullptr, nullptr, CH_RIFF },
{ 'ECMY', Save_ECMY, Load_ECMY, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _economy_chunk_handlers(economy_chunk_handlers);
10 changes: 6 additions & 4 deletions src/saveload/engine_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ static void Load_EIDS()
}
}

extern const ChunkHandler _engine_chunk_handlers[] = {
{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_ARRAY },
{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_ARRAY },
{ 'ENGS', nullptr, Load_ENGS, nullptr, nullptr, CH_RIFF | CH_LAST },
static const ChunkHandler engine_chunk_handlers[] = {
{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_ARRAY },
{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_ARRAY },
{ 'ENGS', nullptr, Load_ENGS, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _engine_chunk_handlers(engine_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/game_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ static void Save_GSTR()
}
}

extern const ChunkHandler _game_chunk_handlers[] = {
static const ChunkHandler game_chunk_handlers[] = {
{ 'GSTR', Save_GSTR, Load_GSTR, nullptr, nullptr, CH_ARRAY },
{ 'GSDT', Save_GSDT, Load_GSDT, nullptr, nullptr, CH_ARRAY | CH_LAST},
{ 'GSDT', Save_GSDT, Load_GSDT, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _game_chunk_handlers(game_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/gamelog_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ static void Check_GLOG()
Load_GLOG_common(_load_check_data.gamelog_action, _load_check_data.gamelog_actions);
}

extern const ChunkHandler _gamelog_chunk_handlers[] = {
{ 'GLOG', Save_GLOG, Load_GLOG, nullptr, Check_GLOG, CH_RIFF | CH_LAST }
static const ChunkHandler gamelog_chunk_handlers[] = {
{ 'GLOG', Save_GLOG, Load_GLOG, nullptr, Check_GLOG, CH_RIFF }
};

extern const ChunkHandlerTable _gamelog_chunk_handlers(gamelog_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/goal_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ static void Load_GOAL()
}
}

extern const ChunkHandler _goal_chunk_handlers[] = {
{ 'GOAL', Save_GOAL, Load_GOAL, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler goal_chunk_handlers[] = {
{ 'GOAL', Save_GOAL, Load_GOAL, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _goal_chunk_handlers(goal_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/group_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static void Load_GRPS()
}
}

extern const ChunkHandler _group_chunk_handlers[] = {
{ 'GRPS', Save_GRPS, Load_GRPS, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler group_chunk_handlers[] = {
{ 'GRPS', Save_GRPS, Load_GRPS, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _group_chunk_handlers(group_chunk_handlers);
14 changes: 8 additions & 6 deletions src/saveload/industry_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ static void Load_ITBL()
}
}

extern const ChunkHandler _industry_chunk_handlers[] = {
{ 'INDY', Save_INDY, Load_INDY, Ptrs_INDY, nullptr, CH_ARRAY},
{ 'IIDS', Save_IIDS, Load_IIDS, nullptr, nullptr, CH_ARRAY},
{ 'TIDS', Save_TIDS, Load_TIDS, nullptr, nullptr, CH_ARRAY},
{ 'IBLD', LoadSave_IBLD, LoadSave_IBLD, nullptr, nullptr, CH_RIFF},
{ 'ITBL', Save_ITBL, Load_ITBL, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler industry_chunk_handlers[] = {
{ 'INDY', Save_INDY, Load_INDY, Ptrs_INDY, nullptr, CH_ARRAY },
{ 'IIDS', Save_IIDS, Load_IIDS, nullptr, nullptr, CH_ARRAY },
{ 'TIDS', Save_TIDS, Load_TIDS, nullptr, nullptr, CH_ARRAY },
{ 'IBLD', LoadSave_IBLD, LoadSave_IBLD, nullptr, nullptr, CH_RIFF },
{ 'ITBL', Save_ITBL, Load_ITBL, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _industry_chunk_handlers(industry_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/labelmaps_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ static void Load_RAIL()
}
}

extern const ChunkHandler _labelmaps_chunk_handlers[] = {
{ 'RAIL', Save_RAIL, Load_RAIL, nullptr, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler labelmaps_chunk_handlers[] = {
{ 'RAIL', Save_RAIL, Load_RAIL, nullptr, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _labelmaps_chunk_handlers(labelmaps_chunk_handlers);

6 changes: 4 additions & 2 deletions src/saveload/linkgraph_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,10 @@ static void Ptrs_LGRS()
SlObject(&LinkGraphSchedule::instance, GetLinkGraphScheduleDesc());
}

extern const ChunkHandler _linkgraph_chunk_handlers[] = {
static const ChunkHandler linkgraph_chunk_handlers[] = {
{ 'LGRP', Save_LGRP, Load_LGRP, nullptr, nullptr, CH_ARRAY },
{ 'LGRJ', Save_LGRJ, Load_LGRJ, nullptr, nullptr, CH_ARRAY },
{ 'LGRS', Save_LGRS, Load_LGRS, Ptrs_LGRS, nullptr, CH_LAST }
{ 'LGRS', Save_LGRS, Load_LGRS, Ptrs_LGRS, nullptr, CH_RIFF }
};

extern const ChunkHandlerTable _linkgraph_chunk_handlers(linkgraph_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/map_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ static void Save_MAP8()
}


extern const ChunkHandler _map_chunk_handlers[] = {
static const ChunkHandler map_chunk_handlers[] = {
{ 'MAPS', Save_MAPS, Load_MAPS, nullptr, Check_MAPS, CH_RIFF },
{ 'MAPT', Save_MAPT, Load_MAPT, nullptr, nullptr, CH_RIFF },
{ 'MAPH', Save_MAPH, Load_MAPH, nullptr, nullptr, CH_RIFF },
Expand All @@ -305,5 +305,7 @@ extern const ChunkHandler _map_chunk_handlers[] = {
{ '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 | CH_LAST },
{ 'MAP8', Save_MAP8, Load_MAP8, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _map_chunk_handlers(map_chunk_handlers);
8 changes: 5 additions & 3 deletions src/saveload/misc_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ static void SaveLoad_VIEW()
SlGlobList(_view_desc);
}

extern const ChunkHandler _misc_chunk_handlers[] = {
{ 'DATE', SaveLoad_DATE, SaveLoad_DATE, nullptr, Check_DATE, CH_RIFF},
{ 'VIEW', SaveLoad_VIEW, SaveLoad_VIEW, nullptr, nullptr, CH_RIFF | CH_LAST},
static const ChunkHandler misc_chunk_handlers[] = {
{ 'DATE', SaveLoad_DATE, SaveLoad_DATE, nullptr, Check_DATE, CH_RIFF },
{ 'VIEW', SaveLoad_VIEW, SaveLoad_VIEW, nullptr, nullptr, CH_RIFF },
};

extern const ChunkHandlerTable _misc_chunk_handlers(misc_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/newgrf_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ static void Check_NGRF()
Load_NGRF_common(_load_check_data.grfconfig);
}

extern const ChunkHandler _newgrf_chunk_handlers[] = {
{ 'NGRF', Save_NGRF, Load_NGRF, nullptr, Check_NGRF, CH_ARRAY | CH_LAST }
static const ChunkHandler newgrf_chunk_handlers[] = {
{ 'NGRF', Save_NGRF, Load_NGRF, nullptr, Check_NGRF, CH_ARRAY }
};

extern const ChunkHandlerTable _newgrf_chunk_handlers(newgrf_chunk_handlers);
6 changes: 4 additions & 2 deletions src/saveload/object_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ static void Load_OBID()
Load_NewGRFMapping(_object_mngr);
}

extern const ChunkHandler _object_chunk_handlers[] = {
static const ChunkHandler object_chunk_handlers[] = {
{ 'OBID', Save_OBID, Load_OBID, nullptr, nullptr, CH_ARRAY },
{ 'OBJS', Save_OBJS, Load_OBJS, Ptrs_OBJS, nullptr, CH_ARRAY | CH_LAST},
{ 'OBJS', Save_OBJS, Load_OBJS, Ptrs_OBJS, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _object_chunk_handlers(object_chunk_handlers);
10 changes: 6 additions & 4 deletions src/saveload/order_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ static void Ptrs_BKOR()
}
}

extern const ChunkHandler _order_chunk_handlers[] = {
{ 'BKOR', Save_BKOR, Load_BKOR, Ptrs_BKOR, nullptr, CH_ARRAY},
{ 'ORDR', Save_ORDR, Load_ORDR, Ptrs_ORDR, nullptr, CH_ARRAY},
{ 'ORDL', Save_ORDL, Load_ORDL, Ptrs_ORDL, nullptr, CH_ARRAY | CH_LAST},
static const ChunkHandler order_chunk_handlers[] = {
{ 'BKOR', Save_BKOR, Load_BKOR, Ptrs_BKOR, nullptr, CH_ARRAY },
{ 'ORDR', Save_ORDR, Load_ORDR, Ptrs_ORDR, nullptr, CH_ARRAY },
{ 'ORDL', Save_ORDL, Load_ORDL, Ptrs_ORDL, nullptr, CH_ARRAY },
};

extern const ChunkHandlerTable _order_chunk_handlers(order_chunk_handlers);
Loading

0 comments on commit c27afdf

Please sign in to comment.