Bool LoadTimer(int timer_id,int object_id,char *message_name,int milliseconds) { object_node *o; timer_node *t; message_node *m; o = GetObjectByID(object_id); if (o == NULL) { eprintf("LoadTimer can't find object %i\n",object_id); return False; } m = GetMessageByName(o->class_id,message_name,NULL); if (m == NULL) { eprintf("LoadTimer can't find message name %s\n",message_name); return False; } if (numActiveTimers == num_timer_nodes) ReallocTimerNodes(); t = timer_heap[numActiveTimers]; t->timer_id = timer_id; t->object_id = object_id; t->message_id = m->message_id; t->time = GetMilliCount() + milliseconds; TimerAddNode(t); /* the timers weren't saved in numerical order, but they were * compacted to first x non-negative integers */ if (timer_id >= next_timer_num) next_timer_num = timer_id + 1; return True; }
Bool LoadTimer(int timer_id,int object_id,char *message_name,int milliseconds) { object_node *o; timer_node *t; message_node *m; o = GetObjectByID(object_id); if (o == NULL) { eprintf("LoadTimer can't find object %i\n",object_id); return False; } m = GetMessageByName(o->class_id,message_name,NULL); if (m == NULL) { eprintf("LoadTimer can't find message name %s\n",message_name); return False; } t = (timer_node *)AllocateMemory(MALLOC_ID_TIMER,sizeof(timer_node)); t->timer_id = timer_id; t->object_id = object_id; t->message_id = m->message_id; t->time = GetMilliCount() + milliseconds; AddTimerNode(t); numActiveTimers++; /* the timers weren't saved in numerical order, but they were * compacted to first x non-negative integers */ if (timer_id >= next_timer_num) next_timer_num = timer_id + 1; return True; }