mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 00:37:58 +03:00
Replace WarningsAsErrors usage with ScriptAssert usage.
For recoverable errors, add some recovery behaviour and logging so a level designer can see in the log what was done as a result of the error. Warn about default behaviour if no callbacks are added.
This commit is contained in:
parent
5929180395
commit
1d1653f995
9 changed files with 36 additions and 61 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include "framework.h"
|
||||
#include "GameScriptAIObject.h"
|
||||
#include "ScriptAssert.h"
|
||||
#include "GameScriptPosition.h"
|
||||
#include <sol.hpp>
|
||||
/***
|
||||
|
@ -10,7 +11,6 @@ AI object
|
|||
@pragma nostrip
|
||||
*/
|
||||
|
||||
extern bool const WarningsAsErrors;
|
||||
|
||||
constexpr auto LUA_CLASS_NAME{ "AIObject" };
|
||||
|
||||
|
@ -105,8 +105,7 @@ std::string GameScriptAIObject::GetName() const
|
|||
|
||||
void GameScriptAIObject::SetName(std::string const & id)
|
||||
{
|
||||
if (id.empty() && WarningsAsErrors)
|
||||
throw TENScriptException("Name cannot be blank");
|
||||
ScriptAssert(!id.empty(), "Name cannot be blank", ERROR_MODE::TERMINATE);
|
||||
|
||||
// remove the old name if we have one
|
||||
s_callbackRemoveName(m_aiObject.luaName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue