Galactic Bloodshed
Classes | Macros | Functions | Variables
racegen.h File Reference
#include <cstdio>
Include dependency graph for racegen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  attribute
 
struct  x
 

Macros

#define GBVERSION   "1.7.3"
 
#define VERSION   ""
 
#define IS_PLAYER   1
 
#define MAILER   "/usr/lib/sendmail"
 
#define SAVETO   "racegen.save"
 
#define TMP   "/tmp/racegen.save"
 
#define START_RECORD_STRING   "<************"
 
#define END_RECORD_STRING   "************>"
 
#define FIRST_ATTRIBUTE   0
 
#define ADVENT   FIRST_ATTRIBUTE
 
#define ABSORB   (ADVENT + 1)
 
#define BIRTH   (ABSORB + 1)
 
#define COL_IQ   (BIRTH + 1)
 
#define FERT   (COL_IQ + 1)
 
#define A_IQ   (FERT + 1)
 
#define FIGHT   (A_IQ + 1)
 
#define PODS   (FIGHT + 1)
 
#define MASS   (PODS + 1)
 
#define SEXES   (MASS + 1)
 
#define METAB   (SEXES + 1)
 
#define LAST_ATTRIBUTE   (METAB)
 
#define N_ATTRIBUTES   (LAST_ATTRIBUTE + 1)
 
#define ATTR_RANGE(a)   (attr[a].maximum - attr[a].minimum)
 
#define FIRST_HOME_PLANET_TYPE   0
 
#define H_EARTH   FIRST_HOME_PLANET_TYPE
 
#define H_FOREST   (H_EARTH + 1)
 
#define H_DESERT   (H_FOREST + 1)
 
#define H_WATER   (H_DESERT + 1)
 
#define H_AIRLESS   (H_WATER + 1)
 
#define H_ICEBALL   (H_AIRLESS + 1)
 
#define H_JOVIAN   (H_ICEBALL + 1)
 
#define LAST_HOME_PLANET_TYPE   H_JOVIAN
 
#define N_HOME_PLANET_TYPES   (LAST_HOME_PLANET_TYPE + 1)
 
#define FIRST_RACE_TYPE   0
 
#define R_NORMAL   FIRST_RACE_TYPE
 
#define R_METAMORPH   (R_NORMAL + 1)
 
#define LAST_RACE_TYPE   R_METAMORPH
 
#define N_RACE_TYPES   (LAST_RACE_TYPE + 1)
 
#define FIRST_PRIV_TYPE   0
 
#define P_GOD   (FIRST_PRIV_TYPE)
 
#define P_GUEST   (P_GOD + 1)
 
#define P_NORMAL   (P_GUEST + 1)
 
#define LAST_PRIV_TYPE   (P_NORMAL)
 
#define N_PRIV_TYPES   (LAST_PRIV_TYPE + 1)
 
#define FIRST_SECTOR_TYPE   0
 
#define S_WATER   FIRST_SECTOR_TYPE
 
#define S_LAND   (S_WATER + 1)
 
#define S_MOUNTAIN   (S_LAND + 1)
 
#define S_GAS   (S_MOUNTAIN + 1)
 
#define S_ICE   (S_GAS + 1)
 
#define S_FOREST   (S_ICE + 1)
 
#define S_DESERT   (S_FOREST + 1)
 
#define S_PLATED   (S_DESERT + 1)
 
#define LAST_SECTOR_TYPE   S_PLATED
 
#define N_SECTOR_TYPES   (LAST_SECTOR_TYPE + 1)
 
#define STATUS_ENROLLED   -2
 
#define STATUS_UNENROLLABLE   -1
 
#define STATUS_UNBALANCED   0
 
#define STATUS_BALANCED   1
 

Functions

int Dialogue (const char *,...)
 
int critique_to_file (FILE *f, int rigorous_checking, int is_player_race)
 
void print_to_file (FILE *f, int verbose)
 
int load_from_file (FILE *g)
 
int cost_of_race ()
 
void modify_print_loop (int level)
 

Variables

const char * planet_print_name [N_HOME_PLANET_TYPES]
 
const int planet_cost [N_HOME_PLANET_TYPES]
 
const char * race_print_name [N_RACE_TYPES]
 
const int race_cost [N_RACE_TYPES]
 
const char * priv_print_name [N_PRIV_TYPES]
 
const char * sector_print_name [N_SECTOR_TYPES]
 
const int n_sector_types_cost [N_SECTOR_TYPES]
 
const double compat_cov [N_SECTOR_TYPES][N_SECTOR_TYPES]
 
const double planet_compat_cov [N_HOME_PLANET_TYPES][N_SECTOR_TYPES]
 
struct x race_info cost_info last
 
int npoints
 
int last_npoints
 
int altered
 
int changed
 
int please_quit
 

Macro Definition Documentation

◆ A_IQ

#define A_IQ   (FERT + 1)

Definition at line 50 of file racegen.h.

◆ ABSORB

#define ABSORB   (ADVENT + 1)

Definition at line 46 of file racegen.h.

◆ ADVENT

#define ADVENT   FIRST_ATTRIBUTE

Definition at line 45 of file racegen.h.

◆ ATTR_RANGE

#define ATTR_RANGE (   a)    (attr[a].maximum - attr[a].minimum)

Definition at line 68 of file racegen.h.

◆ BIRTH

#define BIRTH   (ABSORB + 1)

Definition at line 47 of file racegen.h.

◆ COL_IQ

#define COL_IQ   (BIRTH + 1)

Definition at line 48 of file racegen.h.

◆ END_RECORD_STRING

#define END_RECORD_STRING   "************>"

Definition at line 37 of file racegen.h.

◆ FERT

#define FERT   (COL_IQ + 1)

Definition at line 49 of file racegen.h.

◆ FIGHT

#define FIGHT   (A_IQ + 1)

Definition at line 51 of file racegen.h.

◆ FIRST_ATTRIBUTE

#define FIRST_ATTRIBUTE   0

Definition at line 44 of file racegen.h.

◆ FIRST_HOME_PLANET_TYPE

#define FIRST_HOME_PLANET_TYPE   0

Definition at line 103 of file racegen.h.

◆ FIRST_PRIV_TYPE

#define FIRST_PRIV_TYPE   0

Definition at line 132 of file racegen.h.

◆ FIRST_RACE_TYPE

#define FIRST_RACE_TYPE   0

Definition at line 120 of file racegen.h.

◆ FIRST_SECTOR_TYPE

#define FIRST_SECTOR_TYPE   0

Definition at line 144 of file racegen.h.

◆ GBVERSION

#define GBVERSION   "1.7.3"

Definition at line 10 of file racegen.h.

◆ H_AIRLESS

#define H_AIRLESS   (H_WATER + 1)

Definition at line 108 of file racegen.h.

◆ H_DESERT

#define H_DESERT   (H_FOREST + 1)

Definition at line 106 of file racegen.h.

◆ H_EARTH

#define H_EARTH   FIRST_HOME_PLANET_TYPE

Definition at line 104 of file racegen.h.

◆ H_FOREST

#define H_FOREST   (H_EARTH + 1)

Definition at line 105 of file racegen.h.

◆ H_ICEBALL

#define H_ICEBALL   (H_AIRLESS + 1)

Definition at line 109 of file racegen.h.

◆ H_JOVIAN

#define H_JOVIAN   (H_ICEBALL + 1)

Definition at line 110 of file racegen.h.

◆ H_WATER

#define H_WATER   (H_DESERT + 1)

Definition at line 107 of file racegen.h.

◆ IS_PLAYER

#define IS_PLAYER   1

Definition at line 23 of file racegen.h.

◆ LAST_ATTRIBUTE

#define LAST_ATTRIBUTE   (METAB)

Definition at line 56 of file racegen.h.

◆ LAST_HOME_PLANET_TYPE

#define LAST_HOME_PLANET_TYPE   H_JOVIAN

Definition at line 111 of file racegen.h.

◆ LAST_PRIV_TYPE

#define LAST_PRIV_TYPE   (P_NORMAL)

Definition at line 136 of file racegen.h.

◆ LAST_RACE_TYPE

#define LAST_RACE_TYPE   R_METAMORPH

Definition at line 123 of file racegen.h.

◆ LAST_SECTOR_TYPE

#define LAST_SECTOR_TYPE   S_PLATED

Definition at line 153 of file racegen.h.

◆ MAILER

#define MAILER   "/usr/lib/sendmail"

Definition at line 29 of file racegen.h.

◆ MASS

#define MASS   (PODS + 1)

Definition at line 53 of file racegen.h.

◆ METAB

#define METAB   (SEXES + 1)

Definition at line 55 of file racegen.h.

◆ N_ATTRIBUTES

#define N_ATTRIBUTES   (LAST_ATTRIBUTE + 1)

Definition at line 57 of file racegen.h.

◆ N_HOME_PLANET_TYPES

#define N_HOME_PLANET_TYPES   (LAST_HOME_PLANET_TYPE + 1)

Definition at line 112 of file racegen.h.

◆ N_PRIV_TYPES

#define N_PRIV_TYPES   (LAST_PRIV_TYPE + 1)

Definition at line 137 of file racegen.h.

◆ N_RACE_TYPES

#define N_RACE_TYPES   (LAST_RACE_TYPE + 1)

Definition at line 124 of file racegen.h.

◆ N_SECTOR_TYPES

#define N_SECTOR_TYPES   (LAST_SECTOR_TYPE + 1)

Definition at line 154 of file racegen.h.

◆ P_GOD

#define P_GOD   (FIRST_PRIV_TYPE)

Definition at line 133 of file racegen.h.

◆ P_GUEST

#define P_GUEST   (P_GOD + 1)

Definition at line 134 of file racegen.h.

◆ P_NORMAL

#define P_NORMAL   (P_GUEST + 1)

Definition at line 135 of file racegen.h.

◆ PODS

#define PODS   (FIGHT + 1)

Definition at line 52 of file racegen.h.

◆ R_METAMORPH

#define R_METAMORPH   (R_NORMAL + 1)

Definition at line 122 of file racegen.h.

◆ R_NORMAL

#define R_NORMAL   FIRST_RACE_TYPE

Definition at line 121 of file racegen.h.

◆ S_DESERT

#define S_DESERT   (S_FOREST + 1)

Definition at line 151 of file racegen.h.

◆ S_FOREST

#define S_FOREST   (S_ICE + 1)

Definition at line 150 of file racegen.h.

◆ S_GAS

#define S_GAS   (S_MOUNTAIN + 1)

Definition at line 148 of file racegen.h.

◆ S_ICE

#define S_ICE   (S_GAS + 1)

Definition at line 149 of file racegen.h.

◆ S_LAND

#define S_LAND   (S_WATER + 1)

Definition at line 146 of file racegen.h.

◆ S_MOUNTAIN

#define S_MOUNTAIN   (S_LAND + 1)

Definition at line 147 of file racegen.h.

◆ S_PLATED

#define S_PLATED   (S_DESERT + 1)

Definition at line 152 of file racegen.h.

◆ S_WATER

#define S_WATER   FIRST_SECTOR_TYPE

Definition at line 145 of file racegen.h.

◆ SAVETO

#define SAVETO   "racegen.save"

Definition at line 30 of file racegen.h.

◆ SEXES

#define SEXES   (MASS + 1)

Definition at line 54 of file racegen.h.

◆ START_RECORD_STRING

#define START_RECORD_STRING   "<************"

Definition at line 36 of file racegen.h.

◆ STATUS_BALANCED

#define STATUS_BALANCED   1

Definition at line 170 of file racegen.h.

◆ STATUS_ENROLLED

#define STATUS_ENROLLED   -2

Definition at line 167 of file racegen.h.

◆ STATUS_UNBALANCED

#define STATUS_UNBALANCED   0

Definition at line 169 of file racegen.h.

◆ STATUS_UNENROLLABLE

#define STATUS_UNENROLLABLE   -1

Definition at line 168 of file racegen.h.

◆ TMP

#define TMP   "/tmp/racegen.save"

Definition at line 31 of file racegen.h.

◆ VERSION

#define VERSION   ""

Definition at line 14 of file racegen.h.

Function Documentation

◆ cost_of_race()

int cost_of_race ( )

Definition at line 332 of file racegen.cc.

References attr, x::attr, blah, x::compat, compat_cov, attribute::cov, attribute::e_factor, attribute::e_fudge, attribute::e_hinge, x::home_planet_type, attribute::l_factor, attribute::l_fudge, x::n_sector_types, planet_compat_cov, planet_cost, race_cost, and x::race_type.

Referenced by initialize(), modify_print_loop(), and process().

Here is the caller graph for this function:

◆ critique_to_file()

int critique_to_file ( FILE *  f,
int  rigorous_checking,
int  is_player_race 
)

Definition at line 440 of file racegen.cc.

References x::address, attr, x::attr, x::compat, x::home_planet_type, attribute::is_integral, attribute::maximum, attribute::minimum, x::n_sector_types, npoints, x::password, planet_compat_cov, attribute::print_name, priv_print_name, x::priv_type, x::race_type, x::rejection, and x::status.

Referenced by critique_modification(), enroll(), enroll_player_race(), and send2().

Here is the caller graph for this function:

◆ Dialogue()

int Dialogue ( const char *  ,
  ... 
)

Definition at line 1213 of file racegen.cc.

Referenced by do_racegen(), enroll_player_race(), load(), and quit().

Here is the caller graph for this function:

◆ load_from_file()

int load_from_file ( FILE *  g)

Definition at line 843 of file racegen.cc.

References x::address, x::attr, x::compat, fix_up_iq(), x::home_planet_type, metamorph(), x::name, normal(), x::password, x::priv_type, x::race_type, and x::status.

Referenced by load_from_filename(), and process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ modify_print_loop()

void modify_print_loop ( int  level)

Definition at line 1329 of file racegen.cc.

References changed, cost_of_race(), execute(), last_npoints, npoints, please_quit, and print_to_file().

Referenced by do_racegen(), and enroll_player_race().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_to_file()

void print_to_file ( FILE *  f,
int  verbose 
)

Definition at line 1061 of file racegen.cc.

References x::address, attr, x::attr, x::compat, x::home_planet_type, attribute::is_integral, last_npoints, x::n_sector_types, x::name, npoints, x::password, planet_compat_cov, planet_print_name, attribute::print_name, x::priv_type, race_print_name, x::race_type, and sector_print_name.

Referenced by enroll_player_race(), modify_print_loop(), print(), print_to_filename(), and send2().

Here is the caller graph for this function:

Variable Documentation

◆ altered

int altered

Definition at line 323 of file racegen.cc.

Referenced by critique_modification(), load(), quit(), and save().

◆ changed

int changed

Definition at line 324 of file racegen.cc.

Referenced by critique_modification(), load(), and modify_print_loop().

◆ compat_cov

const double compat_cov[N_SECTOR_TYPES][N_SECTOR_TYPES]

Definition at line 264 of file racegen.cc.

Referenced by cost_of_race().

◆ last

struct x race_info cost_info last

Definition at line 319 of file racegen.cc.

◆ last_npoints

int last_npoints

Definition at line 322 of file racegen.cc.

Referenced by modify_print_loop(), print_to_file(), and process().

◆ n_sector_types_cost

const int n_sector_types_cost[N_SECTOR_TYPES]

◆ npoints

int npoints

Definition at line 321 of file racegen.cc.

Referenced by critique_to_file(), modify_print_loop(), print_to_file(), and process().

◆ planet_compat_cov

const double planet_compat_cov[N_HOME_PLANET_TYPES][N_SECTOR_TYPES]

Definition at line 299 of file racegen.cc.

Referenced by cost_of_race(), critique_to_file(), and print_to_file().

◆ planet_cost

const int planet_cost[N_HOME_PLANET_TYPES]

Definition at line 252 of file racegen.cc.

Referenced by cost_of_race().

◆ planet_print_name

const char* planet_print_name[N_HOME_PLANET_TYPES]

Definition at line 250 of file racegen.cc.

Referenced by help(), and print_to_file().

◆ please_quit

int please_quit

Definition at line 325 of file racegen.cc.

Referenced by enroll_player_race(), modify_print_loop(), and quit().

◆ priv_print_name

const char* priv_print_name[N_PRIV_TYPES]

Definition at line 257 of file racegen.cc.

Referenced by critique_to_file().

◆ race_cost

const int race_cost[N_RACE_TYPES]

Definition at line 255 of file racegen.cc.

Referenced by cost_of_race().

◆ race_print_name

const char* race_print_name[N_RACE_TYPES]

Definition at line 254 of file racegen.cc.

Referenced by help(), and print_to_file().

◆ sector_print_name

const char* sector_print_name[N_SECTOR_TYPES]

Definition at line 259 of file racegen.cc.

Referenced by help(), and print_to_file().