TombEngine/TR5Main/Scripting/ScriptAssert.h
hispidence 032f824870 Add ScriptWarn and SetErrorMode.
SetErrorMode is called via Lua in settings.lua to allow us or the LD to choose between the three ERROR_MODEs for script asserts.

ScriptWarn is for when we want to follow up on a failed assert in ERROR_MODE::WARN. e.g. if the player gives in an invalid HP value, we would ScriptWarn to tell them that the HP is being set to zero instead. If we added this information in ScriptAssert, we would end up displaying this message in TERMINATE mode, too - which is incorrect, since we won't have set the HP to zero, as we will have terminated the game.
2021-08-06 16:43:01 +01:00

16 lines
300 B
C++

#pragma once
#include <string>
#include <optional>
enum class ERROR_MODE
{
SILENT,
WARN,
TERMINATE
};
void ScriptWarn(std::string const& msg);
bool ScriptAssert(bool cond, std::string const& msg, std::optional<ERROR_MODE> forceMode = std::nullopt);
void SetErrorMode(std::string const& mode);