Crossfire Server, Trunk
exp.cpp File Reference
#include "global.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for exp.cpp:

Go to the source code of this file.

Functions

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

Variables

static const float exp_att_mult [NROFATTACKS]
 
static const float exp_prot_mult [NROFATTACKS]
 
int64_t * levels
 

Detailed Description

Experience management. reading data from files and such.

Definition in file exp.cpp.

Function Documentation

◆ dump_experience()

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 251 of file exp.cpp.

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

◆ free_experience()

void free_experience ( void  )

Frees experience-related memory.

Definition at line 263 of file exp.cpp.

References FREE_AND_CLEAR, and levels.

Referenced by free_globals().

+ Here is the caller graph for this function:

◆ has_ability()

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 153 of file exp.cpp.

References guildjoin::ob, object_find_by_type(), SPELL, and SPELLBOOK.

Referenced by new_exp().

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

◆ init_experience()

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 167 of file exp.cpp.

References buf, Settings::confdir, fatal(), FMT64, levels, llevDebug, llevError, LOG(), MAX_BUF, Settings::max_level, SEE_LAST_ERROR, and settings.

Referenced by init_library(), and setup().

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

◆ new_exp()

int64_t 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 100 of file exp.cpp.

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, guildjoin::ob, 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

◆ exp_att_mult

const float exp_att_mult[NROFATTACKS]
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.1,
0.3,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.5,
0.1,
0.2,
0.0,
0.5,
0.2,
}

Definition at line 28 of file exp.cpp.

Referenced by new_exp().

◆ exp_prot_mult

const float exp_prot_mult[NROFATTACKS]
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.0,
0.1,
0.1,
0.1,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.1,
0.0,
0.0,
0.0,
0.1,
}

Definition at line 57 of file exp.cpp.

Referenced by new_exp().

◆ levels

int64_t* levels

Number of levels for which we have experience.

Definition at line 26 of file exp.cpp.

Referenced by CREExperienceWindow::CREExperienceWindow(), dump_experience(), free_experience(), init_experience(), perceive_self(), send_exp_table(), and spellsTable().