Crossfire Server, Trunk
assets.h File Reference
#include "global.h"
#include "image.h"
#include "quest.h"
+ Include dependency graph for assets.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSETS_ALL   0xFFFF
 
#define ASSETS_ANIMATIONS   0x0004
 
#define ASSETS_ARCHETYPES   0x0001
 
#define ASSETS_ARTIFACTS   0x0080
 
#define ASSETS_ATTACK_MESSAGES   0x0200
 
#define ASSETS_FACES   0x0002
 
#define ASSETS_FACESETS   0x0008
 
#define ASSETS_FORMULAE   0x0100
 
#define ASSETS_MESSAGES   0x0040
 
#define ASSETS_PNG   0x0020
 
#define ASSETS_QUESTS   0x0400
 
#define ASSETS_TREASURES   0x0010
 

Typedefs

typedef void(* anim_op) (const Animations *)
 
typedef void(* arch_op) (archetype *)
 
typedef void(* face_op) (const Face *)
 
typedef void(* faceset_op) (const face_sets *)
 

Functions

void animations_for_each (anim_op op)
 
void archetypes_for_each (arch_op op)
 
void assets_collect (const char *datadir, int what)
 
size_t assets_dump_undefined ()
 
void assets_end_load ()
 
void assets_finish_archetypes_for_play ()
 
void assets_free ()
 
void assets_init ()
 
size_t assets_number_of_animations ()
 
size_t assets_number_of_archetypes ()
 
size_t assets_number_of_treasurelists ()
 
size_t assets_number_of_treasures ()
 
void assets_pack (const char *type, const char *filename)
 
void faces_for_each (face_op op)
 
void facesets_for_each (faceset_op op)
 
GeneralMessageget_random_message ()
 
quest_definitionquest_find_by_code (sstring code)
 
void quest_for_each (quest_op op, void *user)
 
quest_definitionquest_get_by_code (sstring code)
 
size_t quests_count (bool includeSystem)
 
long recipe_find_ingredient_cost (const char *name)
 

Detailed Description

C function wrappers to interact with assets. Should not be used by C++ code, except for getManager() to get the AssetsManager.

Definition in file assets.h.

Macro Definition Documentation

◆ ASSETS_ALL

#define ASSETS_ALL   0xFFFF

Definition at line 35 of file assets.h.

◆ ASSETS_ANIMATIONS

#define ASSETS_ANIMATIONS   0x0004

Definition at line 26 of file assets.h.

◆ ASSETS_ARCHETYPES

#define ASSETS_ARCHETYPES   0x0001

Definition at line 24 of file assets.h.

◆ ASSETS_ARTIFACTS

#define ASSETS_ARTIFACTS   0x0080

Definition at line 31 of file assets.h.

◆ ASSETS_ATTACK_MESSAGES

#define ASSETS_ATTACK_MESSAGES   0x0200

Definition at line 33 of file assets.h.

◆ ASSETS_FACES

#define ASSETS_FACES   0x0002

Definition at line 25 of file assets.h.

◆ ASSETS_FACESETS

#define ASSETS_FACESETS   0x0008

Definition at line 27 of file assets.h.

◆ ASSETS_FORMULAE

#define ASSETS_FORMULAE   0x0100

Definition at line 32 of file assets.h.

◆ ASSETS_MESSAGES

#define ASSETS_MESSAGES   0x0040

Definition at line 30 of file assets.h.

◆ ASSETS_PNG

#define ASSETS_PNG   0x0020

Definition at line 29 of file assets.h.

◆ ASSETS_QUESTS

#define ASSETS_QUESTS   0x0400

Definition at line 34 of file assets.h.

◆ ASSETS_TREASURES

#define ASSETS_TREASURES   0x0010

Definition at line 28 of file assets.h.

Typedef Documentation

◆ anim_op

typedef void(* anim_op) (const Animations *)

Definition at line 46 of file assets.h.

◆ arch_op

typedef void(* arch_op) (archetype *)

Definition at line 44 of file assets.h.

◆ face_op

typedef void(* face_op) (const Face *)

Definition at line 45 of file assets.h.

◆ faceset_op

typedef void(* faceset_op) (const face_sets *)

Definition at line 47 of file assets.h.

Function Documentation

◆ animations_for_each()

void animations_for_each ( anim_op  op)

Definition at line 298 of file assets.cpp.

References AssetsManager::animations(), AssetsCollection< T, Key >::each(), manager, and give::op.

Referenced by dump_animations().

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

◆ archetypes_for_each()

void archetypes_for_each ( arch_op  op)

Definition at line 325 of file assets.cpp.

References AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), manager, and give::op.

Referenced by build_class_list_reply(), build_race_list_reply(), cast_create_food(), init_gods(), init_mon_info(), init_skills(), send_map_info(), and spellpath_msg().

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

◆ assets_collect()

void assets_collect ( const char *  datadir,
int  what 
)

◆ assets_dump_undefined()

size_t assets_dump_undefined ( )

Dump and reset referenced but undefined assets.

Returns
total number of referenced but not defined assets.

Definition at line 228 of file assets.cpp.

References AssetsManager::dumpUndefined(), and manager.

Referenced by init_library().

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

◆ assets_end_load()

void assets_end_load ( )

Called after collect is complete, to check various things.

Definition at line 235 of file assets.cpp.

References check_formulae(), check_generators(), check_recipes(), check_spells(), check_summoned(), AssetsCollection< T, Key >::each(), guildoracle::list, manager, and AssetsManager::treasures().

Referenced by init_library().

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

◆ assets_finish_archetypes_for_play()

void assets_finish_archetypes_for_play ( )

Definition at line 540 of file assets.cpp.

References archininventory::arch, AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), manager, and give::op.

Referenced by init_beforeplay().

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

◆ assets_free()

void assets_free ( )

Free all assets-related memory.

Definition at line 75 of file assets.cpp.

References manager.

Referenced by free_globals(), and teardown().

+ Here is the caller graph for this function:

◆ assets_init()

void assets_init ( )

Init assets-related variables.

Definition at line 68 of file assets.cpp.

References manager.

Referenced by cctk_init_std_archetypes(), init_library(), and setup().

+ Here is the caller graph for this function:

◆ assets_number_of_animations()

size_t assets_number_of_animations ( )

Definition at line 286 of file assets.cpp.

References AssetsManager::animations(), AssetsCollection< T, Key >::count(), and manager.

Referenced by malloc_info().

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

◆ assets_number_of_archetypes()

size_t assets_number_of_archetypes ( )

Definition at line 270 of file assets.cpp.

References AssetsManager::archetypes(), AssetsCollection< T, Key >::count(), and manager.

Referenced by malloc_info().

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

◆ assets_number_of_treasurelists()

size_t assets_number_of_treasurelists ( )

Definition at line 266 of file assets.cpp.

References AssetsCollection< T, Key >::count(), manager, and AssetsManager::treasures().

Referenced by malloc_info().

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

◆ assets_number_of_treasures()

size_t assets_number_of_treasures ( )

Definition at line 263 of file assets.cpp.

References nroftreasures.

Referenced by malloc_info().

+ Here is the caller graph for this function:

◆ assets_pack()

◆ faces_for_each()

void faces_for_each ( face_op  op)

Definition at line 317 of file assets.cpp.

References AssetsCollection< T, Key >::each(), AssetsManager::faces(), manager, and give::op.

Referenced by dump_faces().

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

◆ facesets_for_each()

void facesets_for_each ( faceset_op  op)

Definition at line 321 of file assets.cpp.

References AssetsCollection< T, Key >::each(), AssetsManager::facesets(), manager, and give::op.

Referenced by send_image_info(), and START_TEST().

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

◆ get_random_message()

GeneralMessage* get_random_message ( )

Definition at line 343 of file assets.cpp.

References manager, AssetsManager::messages(), and Messages::random().

Referenced by msgfile_msg().

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

◆ quest_find_by_code()

quest_definition* quest_find_by_code ( sstring  code)

Find a quest from its code, logging if no matching quest.

Parameters
codequest to search.
Returns
quest, or NULL if no such quest.

Definition at line 679 of file assets.cpp.

References llevError, LOG(), and quest_get_by_code().

Referenced by get_quest_by_number(), quest_display(), quest_get_player_state(), quest_info(), quest_set_state(), and quest_start().

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

◆ quest_for_each()

void quest_for_each ( quest_op  op,
void *  user 
)

Iterate over all quests.

Parameters
opfunction to call for each quest.
userextra parameter to give the function.

Definition at line 699 of file assets.cpp.

◆ quest_get_by_code()

quest_definition* quest_get_by_code ( sstring  code)

Find a quest from its code if it exists.

Returns
quest, or NULL if no such quest.

Definition at line 690 of file assets.cpp.

References AssetsCollection< T, Key >::find(), manager, and AssetsManager::quests().

Referenced by command_quest(), quest_find_by_code(), quest_read_player_data(), and quest_send_initial_states().

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

◆ quests_count()

size_t quests_count ( bool  includeSystem)

Definition at line 703 of file assets.cpp.

References AssetsCollection< T, Key >::count(), manager, AssetsManager::quests(), and Quests::visibleCount().

+ Here is the call graph for this function:

◆ recipe_find_ingredient_cost()

long recipe_find_ingredient_cost ( const char *  name)

Try to find an ingredient with specified name.

If several archetypes have the same name, the value of the first one with that name will be returned. This happens for the mushrooms (mushroom_1, mushroom_2 and mushroom_3). For the monsters' body parts, there may be several monsters with the same name. This is not a problem if these monsters have the same level (e.g. sage & c_sage) or if only one of the monsters generates the body parts that we are looking for (e.g. big_dragon and big_dragon_worthless).

Will also search in artifacts.

Note
migrated from recipe.c for performance issues.
Parameters
nameingredient we're searching for. Can start with a number.
Returns
cost of ingredient, -1 if wasn't found.
Todo:
move back to recipe.c it it migrates to C++.

Definition at line 572 of file assets.cpp.

References AssetsManager::archetypes(), archt::clone, AssetsCollection< T, Key >::each(), is_valid_types_gen::found, manager, give::name, obj::name, safe_strncpy, strcasecmp(), obj::title, autojail::value, and obj::value.

Referenced by dump_alchemy_costs().

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