Crossfire Server, Trunk  R20513
Functions
stubs_common.c File Reference
#include <global.h>
#include <sproto.h>
Include dependency graph for stubs_common.c:

Go to the source code of this file.

Functions

void apply_auto_fix (mapstruct *m)
 Those are dummy functions defined to resolve all symboles. More...
 
void clean_tmp_files (void)
 Remove temporary map files. More...
 
void dragon_ability_gain (object *ob, int x, int y)
 When a dragon-player gains a new stage of evolution, he gets some treasure. More...
 
void draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *txt)
 Sends message to player(s). More...
 
void draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
 Sends message to player(s). More...
 
void emergency_save (int x)
 Save all players. More...
 
void esrv_del_item (player *pl, object *ob)
 Tells the client to delete an item. More...
 
void esrv_send_item (object *ob, object *obx)
 Sends item's info to player. More...
 
void esrv_update_item (int flags, object *pl, object *op)
 Updates object *op for player *pl. More...
 
void esrv_update_spells (player *pl)
 This looks for any spells the player may have that have changed their stats. More...
 
int execute_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix)
 
int execute_global_event (int eventcode,...)
 
void ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
 Writes to everyone on the specified map. More...
 
objectfind_skill_by_number (object *who, int skillno)
 This returns the skill pointer of the given name (the one that accumulates exp, has the level, etc). More...
 
void move_firewall (object *ob)
 Move for FIREWALL. More...
 
void rod_adjust (object *rod)
 Adjusts rod attributes. More...
 
void set_darkness_map (mapstruct *m)
 Set the darkness level for a map, based on the time of the day. More...
 

Function Documentation

void apply_auto_fix ( mapstruct m)

Those are dummy functions defined to resolve all symboles.

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

Added as part of glue cleaning. Ryo 2005-07-15

Definition at line 9 of file stubs_common.c.

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 34 of file stubs_common.c.

void dragon_ability_gain ( object ob,
int  x,
int  y 
)

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 43 of file stubs_common.c.

void draw_ext_info ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  txt 
)

Sends message to player(s).

Parameters
flagsVarious flags - mostly color, plus a few specials. If NDI_ALL or NDI_ALL_DMS is set, pl is ignored and the message is resent to all players or all DMs individually.
priPriority. 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.
plWho to send the message to. pl may be NULL, particularly if flags has NDI_ALL or NDI_DMS set since it is ignored in that case. If NDI_ALL and NDI_DMS are not set, when pl is NULL, nobody gets the message. This is sometimes useful when a function that can be invoked by a player is automatically called by some other mechanism. For example, if a player tries to put something in a container, they should get a message that tells them they cannot put it in an unsuitable container, but when auto-pickup is at work, all containers are tried, even unsuitable ones, and so messages should not be sent to the player.
typeThe type MSG_TYPE for the type of message.
subtypeThe subtype of the message.
messageThe message to send.

Definition at line 12 of file stubs_common.c.

References logfile.

void draw_ext_info_format ( int  flags,
int  pri,
const object pl,
uint8_t  type,
uint8_t  subtype,
const char *  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.

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.
typeThe type MSG_TYPE for the type of message.
subtypeThe type MSG_TYPE for the subtype of message.
formatThe message to send, with optional format specifiers.

Definition at line 16 of file stubs_common.c.

References logfile.

void emergency_save ( int  x)

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 31 of file stubs_common.c.

void esrv_del_item ( player pl,
object ob 
)

Tells the client to delete an item.

Uses the item command with a -1 location.

Definition at line 53 of file stubs_common.c.

void esrv_send_item ( object ob,
object obx 
)

Sends item's info to player.

Definition at line 37 of file stubs_common.c.

void esrv_update_item ( int  flags,
object pl,
object op 
)

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 40 of file stubs_common.c.

void esrv_update_spells ( player pl)

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 56 of file stubs_common.c.

int execute_event ( object op,
int  eventcode,
object activator,
object third,
const char *  message,
int  fix 
)

Definition at line 62 of file stubs_common.c.

int execute_global_event ( int  eventcode,
  ... 
)

Definition at line 66 of file stubs_common.c.

void ext_info_map ( int  color,
const mapstruct map,
uint8_t  type,
uint8_t  subtype,
const char *  str1 
)

Writes to everyone on the specified map.

Parameters
colorThe color of the message
mapThe map where the players receiving the message are located
typeThe message type
subtypeThe message subtype
str1The message to be sent

Definition at line 24 of file stubs_common.c.

References logfile.

object* find_skill_by_number ( object who,
int  skillno 
)

This returns the skill pointer of the given name (the one that accumulates 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 49 of file stubs_common.c.

void move_firewall ( object ob)

Move for FIREWALL.

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

Parameters
opfirewall.

Definition at line 28 of file stubs_common.c.

void rod_adjust ( object rod)

Adjusts rod attributes.

This function must be called after a new rod has been created.

Parameters
rodthe rod to update

Definition at line 59 of file stubs_common.c.

void set_darkness_map ( mapstruct m)

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

Parameters
mmap to alter.

Definition at line 46 of file stubs_common.c.