src/hcode/include/p.events.h File Reference

Go to the source code of this file.

Functions

void muxevent_count_initialize (void)
void debug_EventTypes (dbref player, void *data, char *buffer)
void prerun_event (MUXEVENT *e)
void postrun_event (MUXEVENT *e)


Function Documentation

void debug_EventTypes ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 40 of file events.c.

References MAX_EVENTS, muxevent_count_type(), muxevent_exec_count, muxevent_last_type(), muxevent_names, notify, and notify_printf().

00041 {
00042         int i, j, k, tot = 0;
00043 
00044         if(buffer && *buffer) {
00045                 int t[MAX_EVENTS];
00046                 int tot_ev = 0;
00047 
00048                 for(i = 0; i < MAX_EVENTS; i++) {
00049                         t[i] = i;
00050                         tot_ev += muxevent_exec_count[i];
00051                 }
00052                 for(i = 0; i < (MAX_EVENTS - 1); i++)
00053                         for(j = i + 1; j < MAX_EVENTS; j++)
00054                                 if(muxevent_exec_count[t[i]] > muxevent_exec_count[t[j]]) {
00055                                         int s = t[i];
00056 
00057                                         t[i] = t[j];
00058                                         t[j] = s;
00059                                 }
00060                 /* Then, display */
00061                 notify(player, "Event history (by use)");
00062                 for(i = 0; i < MAX_EVENTS; i++)
00063                         if(muxevent_exec_count[t[i]])
00064                                 notify_printf(player, "%-3d%-20s%10d %.3f%%", t[i],
00065                                                           muxevent_names[t[i]], muxevent_exec_count[t[i]],
00066                                                           ((float) 100.0 * muxevent_exec_count[t[i]] /
00067                                                            (tot_ev ? tot_ev : 1)));
00068 
00069                 return;
00070         }
00071         notify(player, "Events by type: ");
00072         notify(player, "-------------------------------");
00073         k = muxevent_last_type();
00074         for(i = 0; i <= k; i++) {
00075                 j = muxevent_count_type(i);
00076                 if(!j)
00077                         continue;
00078                 tot += j;
00079                 notify_printf(player, "%-20s%d", muxevent_names[i], j);
00080         }
00081         if(tot)
00082                 notify(player, "-------------------------------");
00083         notify_printf(player, "%d total", tot);
00084 }

void muxevent_count_initialize ( void   ) 

Definition at line 21 of file events.c.

References MAX_EVENTS, and muxevent_exec_count.

Referenced by LoadSpecialObjects().

00022 {
00023         int i;
00024 
00025         for(i = 0; i < MAX_EVENTS; i++)
00026                 muxevent_exec_count[i] = 0;
00027 }

void postrun_event ( MUXEVENT e  ) 

Definition at line 90 of file events.c.

00091 {
00092 }

void prerun_event ( MUXEVENT e  ) 

Definition at line 86 of file events.c.

00087 {
00088 }


Generated on Mon May 28 04:25:44 2007 for BattletechMUX by  doxygen 1.4.7