OpenTTD Source 20260208-master-g43af8e94d0
saveload_error.hpp File Reference

Functions/types related to errors from savegames. More...

#include "../3rdparty/fmt/format.h"
#include "../strings_type.h"

Go to the source code of this file.

Functions

void SlError (StringID string, const std::string &extra_msg={})
 Error handler.
void SlErrorCorrupt (const std::string &msg)
 Error handler for corrupt savegames.
template<typename ... Args>
void SlErrorCorruptFmt (const fmt::format_string< Args... > format, Args &&... fmt_args)
 Issue an SlErrorCorrupt with a format string.

Detailed Description

Functions/types related to errors from savegames.

Definition in file saveload_error.hpp.

Function Documentation

◆ SlError()

void SlError ( StringID string,
const std::string & extra_msg )

Error handler.

Sets everything up to show an error message and to clean up the mess of a partial savegame load.

Parameters
stringThe translatable error message to show.
extra_msgAn extra error message coming from one of the APIs.
Note
This function does never return as it throws an exception to break out of all the saveload code.

Definition at line 339 of file saveload.cpp.

References _gamelog, _load_check_data, _sl, SLA_LOAD, SLA_LOAD_CHECK, SLA_PTRS, and SlNullPointers().

Referenced by AfterLoadGame(), DetermineSaveLoadFormat(), DoLoad(), PacketWriter::Finish(), GetSavegameFormat(), LZMALoadFilter::LZMALoadFilter(), LZMASaveFilter::LZMASaveFilter(), LZOLoadFilter::LZOLoadFilter(), LZOSaveFilter::LZOSaveFilter(), MoveWaypointsToBaseStations(), LZMALoadFilter::Read(), LZOLoadFilter::Read(), ZlibLoadFilter::Read(), SaveOrLoad(), SlErrorCorrupt(), FileWriter::Write(), PacketWriter::Write(), LZMASaveFilter::WriteLoop(), ZlibSaveFilter::WriteLoop(), ZlibLoadFilter::ZlibLoadFilter(), and ZlibSaveFilter::ZlibSaveFilter().

◆ SlErrorCorrupt()

◆ SlErrorCorruptFmt()

template<typename ... Args>
void SlErrorCorruptFmt ( const fmt::format_string< Args... > format,
Args &&... fmt_args )
inline

Issue an SlErrorCorrupt with a format string.

Parameters
formatThe formatting string to tell what to do with the remaining arguments.
fmt_argsThe arguments to be passed to fmt.
Template Parameters
ArgsThe types of the fmt arguments.
Note
This function does never return as it throws an exception to break out of all the saveload code.

Definition at line 28 of file saveload_error.hpp.

References SlErrorCorrupt().

Referenced by Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::GetNew(), SlAutolength(), SlIterateArray(), SlLoadCheckChunk(), and SlLoadChunk().