File diff r25574:6c110f88f880 → r25575:634f384ae528
src/script/api/script_event_types.cpp
Show inline comments
 
@@ -118,23 +118,18 @@ bool ScriptEventCompanyAskMerger::Accept
 
	return ScriptObject::DoCommand(0, this->owner, 0, CMD_BUY_COMPANY);
 
}
 

	
 
ScriptEventAdminPort::ScriptEventAdminPort(const char *json) :
 
ScriptEventAdminPort::ScriptEventAdminPort(const std::string &json) :
 
		ScriptEvent(ET_ADMIN_PORT),
 
		json(stredup(json))
 
		json(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 nullptr; }
 

	
 
SQInteger ScriptEventAdminPort::GetObject(HSQUIRRELVM vm)
 
{
 
	const char *p = this->json;
 
	const char *p = this->json.c_str();
 

	
 
	if (this->ReadTable(vm, p) == nullptr) {
 
		sq_pushnull(vm);
 
@@ -168,7 +163,8 @@ const char *ScriptEventAdminPort::ReadSt
 
		p++;
 
	}
 

	
 
	sq_pushstring(vm, value, p - value);
 
	size_t len = p - value;
 
	sq_pushstring(vm, value, len);
 
	p++; // Step past the end-of-string marker (")
 

	
 
	return p;