Crossfire Server, Branches 1.12  R18729
cre.cpp File Reference
#include "global.h"
#include "libproto.h"
#include <Qt>
#include <QApplication>
#include <QCoreApplication>
#include <CREMainWindow.h>
#include "CREPixmap.h"
+ Include dependency graph for cre.cpp:

Go to the source code of this file.

Functions

int auto_apply (object *op)
 
void clean_tmp_files (void)
 
void dragon_ability_gain (object *, int, int)
 
void draw_ext_info (int, int, const object *, uint8, uint8, const char *txt, const char *)
 
void draw_ext_info_format (int, int, const object *, uint8, uint8, const char *, const char *old_format,...)
 
void emergency_save (int)
 
void esrv_del_item (player *, int)
 
void esrv_send_item (object *, object *)
 
void esrv_update_item (int, object *, object *)
 
void esrv_update_spells (player *)
 
int execute_event (object *, int, object *, object *, const char *, int)
 
int execute_global_event (int,...)
 
void ext_info_map (int, const mapstruct *, uint8, uint8, const char *, const char *str2)
 
objectfind_skill_by_number (object *, int)
 
void fix_auto_apply (mapstruct *)
 
int main (int argc, char **argv)
 
void monster_check_apply (object *, object *)
 
void move_firewall (object *)
 
void set_darkness_map (mapstruct *)
 
void trap_adjust (object *, int)
 

Function Documentation

int auto_apply ( object op)

Map was just loaded, handle op's initialisation.

Generates shop floor's item, and treasures.

Parameters
opobject to initialize.
Returns
1 if object was initialized, 0 else.

Definition at line 128 of file cre.cpp.

References obj::below, CLEAR_FLAG, create_treasure(), mapdef::difficulty, obj::env, liv::exp, FLAG_AUTO_APPLY, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_A_TEMPLATE, FLAG_UNPAID, free_object(), generate_treasure(), GT_ENVIRONMENT, HAS_RANDOM_ITEMS, liv::hp, identify(), insert_ob_in_map(), insert_ob_in_ob(), obj::inv, obj::map, MAX, QUERY_FLAG, obj::randomitems, remove_ob(), SET_FLAG, SHOP_FLOOR, obj::stats, TREASURE, obj::type, obj::x, and obj::y.

+ Here is the call graph for this function:

void clean_tmp_files ( void  )

Remove temporary map files.

Todo:
check logic, why is file only removed if map is in memory?

Definition at line 76 of file cre.cpp.

void dragon_ability_gain ( object ,
int  ,
int   
)

When a dragon-player gains a new stage of evolution, he gets some treasure.

Parameters
whothe dragon player.
atnrthe attack-number of the ability focus.
levelability level.

Definition at line 84 of file cre.cpp.

void draw_ext_info ( int  ,
int  ,
const object ,
uint8  ,
uint8  ,
const char *  txt,
const char *   
)

Dummy functions to link the library.

Definition at line 44 of file cre.cpp.

References logfile.

void draw_ext_info_format ( int  ,
int  ,
const object ,
uint8  ,
uint8  ,
const char *  ,
const char *  old_format,
  ... 
)

Sends message to player(s).

This function is the same as draw_ext_info, but takes varargs format. Otherwise, the meaning of all the fields is the same. This is perhaps not the most efficient as we do vsnprintf on both the old and newbuf, but it simplifies the code greatly since we can just call draw_ext_info. Also, hopefully at some point, need for old_format will go away.

Parameters
flagsVarious flags - mostly color, plus a few specials.
priPriority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what.
plCan be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags.

If message is black, and not NDI_UNIQUE, gets sent through output buffers. If the client supports the new readables, this is sent to the client without processing in the output buffers.

Parameters
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the type of message.
new_format
old_format

Definition at line 49 of file cre.cpp.

References logfile.

void emergency_save ( int  )

Save all players.

Parameters
flagif non zero, it means that we want to try and save everyone, but keep the game running. Thus, we don't want to free any information.

Definition at line 72 of file cre.cpp.

void esrv_del_item ( player ,
int   
)

Tells the client to delete an item. Uses the item command with a -1 location.

Definition at line 97 of file cre.cpp.

void esrv_send_item ( object ,
object  
)

Sends item's info to player.

Definition at line 80 of file cre.cpp.

void esrv_update_item ( int  ,
object ,
object  
)

Updates object *op for player *pl.

flags is a list of values to update to the client (as defined in newclient.h - might as well use the same value both places.

Definition at line 101 of file cre.cpp.

void esrv_update_spells ( player )

This looks for any spells the player may have that have changed their stats. It then sends an updspell packet for each spell that has changed in this way.

Definition at line 105 of file cre.cpp.

int execute_event ( object ,
int  ,
object ,
object ,
const char *  ,
int   
)

Definition at line 117 of file cre.cpp.

int execute_global_event ( int  ,
  ... 
)

Definition at line 122 of file cre.cpp.

void ext_info_map ( int  ,
const mapstruct ,
uint8  ,
uint8  ,
const char *  ,
const char *  str2 
)

Writes to everyone on the specified map

Definition at line 63 of file cre.cpp.

References logfile.

object* find_skill_by_number ( object ,
int   
)

This returns the skill pointer of the given name (the one that accumlates exp, has the level, etc).

It is presumed that the player will be needing to actually use the skill, so a skill tool will be equipped if one if found to benefit from its bonuses.

This code is basically the same as find_skill_by_name() above, but instead of a skill name, we search by matching number.

Parameters
whoplayer applying a skill.
skillnoskill subtype.
Returns
skill object if player can use it, NULL else.

Definition at line 92 of file cre.cpp.

void fix_auto_apply ( mapstruct )

Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff). Calls auto_apply() if appropriate.

Parameters
mmap to fix.

Those are dummy functions defined to resolve all symboles. Added as part of glue cleaning. Ryo 2005-07-15

Definition at line 180 of file cre.cpp.

int main ( int  argc,
char **  argv 
)

Main entry point.

Parameters
argclength of argv.
argvcommand-line options.
Returns
0.

Definition at line 14 of file cre.cpp.

References CREPixmap::init(), init_artifacts(), init_formulae(), init_globals(), init_library(), load_treasures(), and read_client_images().

+ Here is the call graph for this function:

void monster_check_apply ( object ,
object  
)

Definition at line 109 of file cre.cpp.

void move_firewall ( object )

Move for FIREWALL.

firewalls fire other spells. The direction of the wall is stored in op->stats.sp. walls can have hp, so they can be torn down.

Parameters
opfirewall.

Definition at line 68 of file cre.cpp.

void set_darkness_map ( mapstruct )

Set the darkness level for a map, based on the time of the day.

Parameters
mmap to alter.

Definition at line 88 of file cre.cpp.

void trap_adjust ( object ,
int   
)

Adjust trap difficulty to the map. The default traps are too strong for wimpy level 1 players, and unthreatening to anyone of high level

Parameters
traptrap to adjust.
difficultymap difficulty.

Definition at line 113 of file cre.cpp.