From 9ed12b0f07edb342aaff21c130d325fd158a9d5b Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 25 Apr 2014 15:40:32 +0000 Subject: (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) --- src/script/api/script_event_types.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/script/api/script_event_types.cpp') diff --git a/src/script/api/script_event_types.cpp b/src/script/api/script_event_types.cpp index 8c1395c11..277ce22ec 100644 --- a/src/script/api/script_event_types.cpp +++ b/src/script/api/script_event_types.cpp @@ -17,6 +17,7 @@ #include "../../settings_type.h" #include "../../engine_base.h" #include "../../articulated_vehicles.h" +#include "../../string_func.h" #include "table/strings.h" #include "../../safeguards.h" @@ -119,6 +120,17 @@ bool ScriptEventCompanyAskMerger::AcceptMerger() return ScriptObject::DoCommand(0, this->owner, 0, CMD_BUY_COMPANY); } +ScriptEventAdminPort::ScriptEventAdminPort(const char *json) : + ScriptEvent(ET_ADMIN_PORT), + json(stredup(json)) +{ +} + +ScriptEventAdminPort::~ScriptEventAdminPort() +{ + free(this->json); +} + #define SKIP_EMPTY(p) while (*(p) == ' ' || *(p) == '\n' || *(p) == '\r') (p)++; #define RETURN_ERROR(stack) { ScriptLog::Error("Received invalid JSON data from AdminPort."); if (stack != 0) sq_pop(vm, stack); return NULL; } -- cgit v1.2.3-54-g00ecf