(svn r23777) -Codechange: refactor allocating memory and fetching strings into a single function for scripts
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#include "../../company_base.h"
|
||||
#include "../../network/network.h"
|
||||
#include "../../genworld.h"
|
||||
#include "../../string_func.h"
|
||||
#include "../../strings_func.h"
|
||||
|
||||
#include "../script_storage.hpp"
|
||||
#include "../script_instance.hpp"
|
||||
@@ -233,6 +235,13 @@ ScriptObject::ActiveInstance::~ActiveInstance()
|
||||
return GetStorage()->log_data;
|
||||
}
|
||||
|
||||
/* static */ char *ScriptObject::GetString(StringID string)
|
||||
{
|
||||
char buffer[64];
|
||||
::GetString(buffer, string, lastof(buffer));
|
||||
return ::strdup(buffer);
|
||||
}
|
||||
|
||||
/* static */ void ScriptObject::SetCallbackVariable(int index, int value)
|
||||
{
|
||||
if ((size_t)index >= GetStorage()->callback_value.size()) GetStorage()->callback_value.resize(index + 1);
|
||||
|
Reference in New Issue
Block a user