src/hcode/btech/mech.stat.c File Reference

#include "mech.stat.h"
#include "db.h"
#include "externs.h"

Include dependency graph for mech.stat.c:

Go to the source code of this file.

Defines

#define MECH_STAT_C

Functions

void init_stat ()
void do_show_stat (dbref player, dbref cause, int key, char *arg1, char *arg2)

Variables

stat_type rollstat
static int chances [11] = { 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 }


Define Documentation

#define MECH_STAT_C

Definition at line 15 of file mech.stat.c.


Function Documentation

void do_show_stat ( dbref  player,
dbref  cause,
int  key,
char *  arg1,
char *  arg2 
)

Definition at line 30 of file mech.stat.c.

References chances, notify, notify_printf(), stat_type::rolls, rollstat, and stat_type::totrolls.

00031 {
00032         int i;
00033         float f1, f2;
00034 
00035         if(!rollstat.totrolls) {
00036                 notify(player, "No rolls to show statistics for!");
00037                 return;
00038         }
00039         for(i = 0; i < 11; i++) {
00040                 if(i == 0) {
00041                         notify(player, "#   Rolls  Optimal% Present% Diff. in 1000");
00042                 }
00043                 f1 = (float) chances[i] * 100.0 / 36.0;
00044                 f2 = (float) rollstat.rolls[i] * 100.0 / rollstat.totrolls;
00045                 notify_printf(player, "%-3d %6d %8.3f %8.3f %.3f", i + 2,
00046                                           rollstat.rolls[i], f1, f2, 10.0 * f2 - 10.0 * f1);
00047         }
00048         notify_printf(player, "Total rolls: %d", rollstat.totrolls);
00049 }

void init_stat ( void   ) 

Definition at line 22 of file mech.stat.c.

Referenced by LoadSpecialObjects().

00023 {
00024         /* This is not necessary -- globals are always initialized empty */
00025         /* bzero(&stat, sizeof(stat)); */
00026 }


Variable Documentation

int chances[11] = { 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 } [static]

Definition at line 28 of file mech.stat.c.

Referenced by do_show_stat().

stat_type rollstat

Definition at line 20 of file mech.stat.c.

Referenced by cause_armordamage(), cause_internaldamage(), do_show_stat(), FindAdvFasaVehicleHitLocation(), FindFasaHitLocation(), FindHitLocation(), FindHitLocation_CritProof(), and Roll().


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