Crossfire Server, Branch 1.12  R12190
Defines | Functions | Variables
exp.c File Reference

Experience management. More...

#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.

Defines

#define FALSE   0
#define TRUE   1

Functions

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.
void free_experience (void)
 Frees experience-related memory.
int has_ability (const object *ob)
 Checks whether object has innate abilities (spell/spellbook in inventory).
void init_experience (void)
 This loads the experience table from the exp_table file.
sint64 new_exp (const object *ob)
 Alternative way to calculate experience based on the ability of a monster.

Variables

static const float exp_att_mult [NROFATTACKS+2]
static const float exp_prot_mult [NROFATTACKS+2]
sint64 * levels
 Number of levels for which we have experience.

Detailed Description

Experience management.

reading data from files and such.

Definition in file exp.c.


Define Documentation

#define FALSE   0
#define TRUE   1

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 FALSE, SPELL, SPELLBOOK, and TRUE.

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 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, MIN, NROFATTACKS, and QUERY_FLAG.

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().