Jump to content

addtimer command should report an error if it hits MAX_EVENTTIMER

closed

AnnieRuru
2014-01-10 16:48:59
http://rathena.org/board/topic/91248-npc-event-error/
what a long way to tackle this topic
and the reason is so simple ...
just because the *addtimer script command doesn't report an error when the MAX_EVENTTIMER is full

[quote name="rathena\src\map\map.h"]
#define MAX_EVENTTIMER 32[/quote]there is currently a hardcoded limit that addtimer command can only queue up to 32 instances
over that, addtimer command doesn't report an error
but its weird that OnxxxxEvent does !
https://github.com/rathena/rathena/blob/master/src/map/npc.c#L313
so its better for the addtimer command should be report an error
suggestion

BUILDIN_FUNC(addtimer)
{
	int tick = script_getnum(st,2);
	const char* event = script_getstr(st, 3);
	TBL_PC* sd;

	check_event(st, event);
	sd = script_rid2sd(st);
	if( sd == NULL )
		return 0;

	if ( !pc_addeventtimer(sd,tick,event) ) {
		//Failed to dequeue, couldn't set a timer.
		ShowWarning("buildin_addtimer: event timer is full !
");
		return SCRIPT_CMD_FAILURE;
	}
	return SCRIPT_CMD_SUCCESS;
}


Cydh
2014-01-11 09:12:17
here f46a792
×
×
  • Create New...