Rename AddDisplayString to SetDisplayString. Make it call insert_or_assign instead of just insert.

Add GetDisplayString and assorted types/static functions.
This commit is contained in:
hispidence 2021-08-29 20:09:59 +01:00
parent 501be9c594
commit 9a2d1a0f2d
3 changed files with 27 additions and 6 deletions

View file

@ -46,9 +46,11 @@ DisplayStringIDType GameScriptDisplayString::GetID() const
}
AddItemCallback GameScriptDisplayString::s_addItemCallback = [](DisplayStringIDType, UserDisplayString)
SetItemCallback GameScriptDisplayString::s_setItemCallback = [](DisplayStringIDType, UserDisplayString)
{
std::string err = "\"Add string\" callback is not set.";
std::string err = "\"Set string\" callback is not set.";
throw TENScriptException(err);
return false;
};
// This is called by a destructor (or will be if we forget to assign it during a refactor)
@ -57,5 +59,13 @@ RemoveItemCallback GameScriptDisplayString::s_removeItemCallback = [](DisplayStr
{
TENLog("\"Remove string\" callback is not set.", LogLevel::Error);
std::terminate();
return false;
};
GetItemCallback GameScriptDisplayString::s_getItemCallback = [](DisplayStringIDType)
{
std::string err = "\"Get string\" callback is not set.";
throw TENScriptException(err);
return std::nullopt;
};