Crossfire Server, Branches 1.12  R18729
exp.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <global.h>
+ Include dependency graph for exp.c:

Go to the source code of this file.

Macros

#define FALSE   0
 
#define TRUE   1
 

Functions

void dump_experience (void)
 
void free_experience (void)
 
int has_ability (const object *ob)
 
void init_experience (void)
 
sint64 new_exp (const object *ob)
 

Variables

static const float exp_att_mult [NROFATTACKS+2]
 
static const float exp_prot_mult [NROFATTACKS+2]
 
sint64 * levels
 

Detailed Description

Experience management. reading data from files and such.

Definition in file exp.c.

Macro Definition Documentation

Function Documentation

void dump_experience ( void  )

Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format of the exp_table is correct.

Definition at line 257 of file exp.c.

References levels, logfile, Settings::max_level, and settings.

void free_experience ( void  )

Frees experience-related memory.

Definition at line 269 of file exp.c.

References FREE_AND_CLEAR, and levels.

Referenced by free_globals().

+ Here is the caller graph for this function:

int has_ability ( const object ob)

Checks whether object has innate abilities (spell/spellbook in inventory).

Returns
1 if monster has any innate abilities, 0 else

Definition at line 151 of file exp.c.

References obj::below, FALSE, obj::inv, SPELL, SPELLBOOK, TRUE, and obj::type.

Referenced by new_exp().

+ Here is the caller graph for this function:

void init_experience ( void  )

This loads the experience table from the exp_table file. This tends to exit on any errors, since it populates the table as it goes along, so if there are errors, the table is likely in an inconsistent state.

Note
will call exit() if file is invalid or not found.

Definition at line 170 of file exp.c.

References close_and_delete(), Settings::confdir, levels, llevDebug, llevError, LOG(), MAX_BUF, Settings::max_level, open_and_uncompress(), settings, snprintf(), and strncasecmp().

Referenced by init_library().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

sint64 new_exp ( const object ob)

Alternative way to calculate experience based on the ability of a monster.

It's far from perfect, and doesn't consider everything which can be considered, thus it's only used in debugging. this is only used with one of the dumpflags, and not anyplace in the code.

Parameters
obobject for which to return experience
Returns
experience computed from object's properties.

Definition at line 104 of file exp.c.

References liv::ac, obj::attacktype, liv::Con, liv::dam, exp_att_mult, exp_prot_mult, FABS, FALSE, FLAG_CAST_SPELL, FLAG_HITBACK, FLAG_NO_MAGIC, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_INVISIBLE, FLAG_SPLITTING, FLAG_STAND_STILL, FLAG_USE_BOW, FLAG_USE_RANGE, FLAG_USE_SCROLL, has_ability(), MAX, liv::maxhp, liv::maxsp, MIN, NROFATTACKS, QUERY_FLAG, obj::resist, obj::speed, obj::stats, and liv::wc.

Referenced by print_monsters().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const float exp_att_mult[NROFATTACKS+2]
static
Initial value:
= {
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.4,
1.5,
0.0,
0.1,
0.3,
0.2,
0.3,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
}

Definition at line 44 of file exp.c.

Referenced by new_exp().

const float exp_prot_mult[NROFATTACKS+2]
static
Initial value:
= {
0.4,
0.5,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.0,
0.0,
0.0,
0.0,
0.0
}

Definition at line 67 of file exp.c.

Referenced by new_exp().

sint64* levels

Number of levels for which we have experience.

Definition at line 39 of file exp.c.

Referenced by add_player_exp(), apply_death_exp_penalty(), dump_experience(), free_experience(), init_experience(), level_exp(), and send_exp_table().