mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-20 10:31:45 +01:00
Renamed several functions to lower case and variable wovel to vowel. Removed oasis_delete.h and object type TRAP. --Rumble
This commit is contained in:
@@ -1,32 +1,13 @@
|
||||
/**************************************************************************
|
||||
* File: dg_event.c *
|
||||
* *
|
||||
* Usage: This file contains a simplified event system to allow *
|
||||
* DG Script triggers to use the "wait" command, causing a delay in the *
|
||||
* middle of a script. *
|
||||
* *
|
||||
* By: Mark A. Heilpern (Sammy @ eQuoria MUD equoria.com:4000) *
|
||||
* *
|
||||
* As of dg scripts pl 8 this includes the 'FULL' DG event package. * *
|
||||
* This file includes the file queue.c, which handles the priority queues.* *
|
||||
* Thomas Arp - Welcor - 2002 *
|
||||
* File: dg_event.c Part of tbaMUD *
|
||||
* Usage: This file contains a simplified event system to allow trigedit *
|
||||
* to use the "wait" command, causing a delay in the middle of a script. *
|
||||
* *
|
||||
* $Author: Mark A. Heilpern/egreen/Welcor $ *
|
||||
* $Date: 2004/10/11 12:07:00$ *
|
||||
* $Revision: 1.0.14 $ *
|
||||
**************************************************************************/
|
||||
/*
|
||||
* dg_event.c: This file contains a simplified event system to allow
|
||||
* DG Script triggers to use the "wait" command, causing a delay in the
|
||||
* middle of a script.
|
||||
*
|
||||
* By: Mark A. Heilpern (Sammy @ eQuoria MUD equoria.com:4000)
|
||||
*
|
||||
* As of dg scripts pl 8 this includes the 'FULL' DG event package.
|
||||
* This file includes the file queue.c, which handles the priority queues.
|
||||
* Thomas Arp - Welcor - 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
@@ -46,10 +27,7 @@ void event_init(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Add an event to the current list
|
||||
*/
|
||||
/* creates an event and returns it */
|
||||
/* Add an event to the current list. Creates an event and returns it. */
|
||||
struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
|
||||
{
|
||||
struct event *new_event;
|
||||
@@ -65,7 +43,6 @@ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
|
||||
return new_event;
|
||||
}
|
||||
|
||||
|
||||
/* removes the event from the system */
|
||||
void event_cancel(struct event *event)
|
||||
{
|
||||
@@ -84,7 +61,6 @@ void event_cancel(struct event *event)
|
||||
free(event);
|
||||
}
|
||||
|
||||
|
||||
/* Process any events whose time has come. */
|
||||
void event_process(void)
|
||||
{
|
||||
@@ -97,11 +73,9 @@ void event_process(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the_event->q_el to NULL so that any functions called beneath
|
||||
** event_process can tell if they're being called beneath the actual
|
||||
** event function.
|
||||
*/
|
||||
/* Set the_event->q_el to NULL so that any functions called beneath
|
||||
* event_process can tell if they're being called beneath the actual
|
||||
* event function. */
|
||||
the_event->q_el = NULL;
|
||||
|
||||
/* call event func, reenqueue event if retval > 0 */
|
||||
@@ -112,7 +86,6 @@ void event_process(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* returns the time remaining before the event */
|
||||
long event_time(struct event *event)
|
||||
{
|
||||
@@ -123,7 +96,6 @@ long event_time(struct event *event)
|
||||
return (when - pulse);
|
||||
}
|
||||
|
||||
|
||||
/* frees all events in the queue */
|
||||
void event_free_all(void)
|
||||
{
|
||||
@@ -147,13 +119,7 @@ int event_is_queued(struct event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ************************************************************************
|
||||
* File: queue.c *
|
||||
* *
|
||||
* Usage: generic queue functions for building and using a priority queue *
|
||||
* *
|
||||
************************************************************************ */
|
||||
|
||||
/* Generic queue functions for building and using a priority queue. */
|
||||
/* returns a new, initialized queue */
|
||||
struct queue *queue_init(void)
|
||||
{
|
||||
@@ -164,7 +130,6 @@ struct queue *queue_init(void)
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
/* add data into the priority queue q with key */
|
||||
struct q_element *queue_enq(struct queue *q, void *data, long key)
|
||||
{
|
||||
@@ -209,7 +174,6 @@ struct q_element *queue_enq(struct queue *q, void *data, long key)
|
||||
return qe;
|
||||
}
|
||||
|
||||
|
||||
/* remove queue element qe from the priority queue q */
|
||||
void queue_deq(struct queue *q, struct q_element *qe)
|
||||
{
|
||||
@@ -232,11 +196,7 @@ void queue_deq(struct queue *q, struct q_element *qe)
|
||||
free(qe);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* removes and returns the data of the
|
||||
* first element of the priority queue q
|
||||
*/
|
||||
/* Removes and returns the data of the first element of the priority queue q. */
|
||||
void *queue_head(struct queue *q)
|
||||
{
|
||||
void *dg_data;
|
||||
@@ -252,11 +212,8 @@ void *queue_head(struct queue *q)
|
||||
return dg_data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* returns the key of the head element of the priority queue
|
||||
* if q is NULL, then return the largest unsigned number
|
||||
*/
|
||||
/* Returns the key of the head element of the priority queue if q is NULL, then
|
||||
* return the largest unsigned number. */
|
||||
long queue_key(struct queue *q)
|
||||
{
|
||||
int i;
|
||||
@@ -269,14 +226,12 @@ long queue_key(struct queue *q)
|
||||
return LONG_MAX;
|
||||
}
|
||||
|
||||
|
||||
/* returns the key of queue element qe */
|
||||
long queue_elmt_key(struct q_element *qe)
|
||||
{
|
||||
return qe->key;
|
||||
}
|
||||
|
||||
|
||||
/* free q and contents */
|
||||
void queue_free(struct queue *q)
|
||||
{
|
||||
@@ -292,4 +247,3 @@ void queue_free(struct queue *q)
|
||||
free(q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user