Crossfire Server  1.75.0
assets.h File Reference

C function wrappers to interact with assets. More...

#include "global.h"
#include "image.h"
#include "quest.h"

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_REGIONS   0x0800
 
#define ASSETS_TREASURES   0x0010
 

Typedefs

typedef void(* anim_op) (const Animations *)
 
typedef void(* arch_op) (archetype *)
 
typedef std::function< void(BufferReader *, const char *)> collectorHook
 
typedef void(* face_op) (const Face *)
 
typedef void(* faceset_op) (const face_sets *)
 

Functions

void archetypes_for_each (arch_op op)
 
void assets_add_collector_hook (const char *name, collectorHook hook)
 
void assets_collect (const char *datadir, int what)
 Collect all assets from the specified directory and all its subdirectories. More...
 
void assets_end_load ()
 Called after collect is complete, to check various things. More...
 
void assets_finish_archetypes_for_play ()
 
void assets_free ()
 Free all assets-related memory. More...
 
void assets_init ()
 Init assets-related variables. More...
 
size_t assets_number_of_treasurelists ()
 
size_t assets_number_of_treasures ()
 
void assets_pack (const char *type, const char *filename)
 Pack the specified assets in a file. More...
 
class AssetsManagergetManager ()
 
void load_assets (void)
 
quest_definitionquest_find_by_code (sstring code)
 Find a quest from its code, logging if no matching quest. More...
 
void quest_for_each (quest_op op, void *user)
 Iterate over all quests. More...
 
quest_definitionquest_get_by_code (sstring code)
 Find a quest from its code if it exists. More...
 
size_t quests_count (bool includeSystem)
 

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.

Typedef Documentation

◆ anim_op

typedef void(* anim_op) (const Animations *)

Definition at line 47 of file assets.h.

◆ arch_op

typedef void(* arch_op) (archetype *)

Definition at line 45 of file assets.h.

◆ collectorHook

typedef std::function<void(BufferReader *, const char *)> collectorHook

Definition at line 35 of file assets.h.

◆ face_op

typedef void(* face_op) (const Face *)

Definition at line 46 of file assets.h.

◆ faceset_op

typedef void(* faceset_op) (const face_sets *)

Definition at line 48 of file assets.h.

Function Documentation

◆ archetypes_for_each()

void archetypes_for_each ( arch_op  op)

◆ assets_add_collector_hook()

void assets_add_collector_hook ( const char *  name,
collectorHook  hook 
)

Definition at line 556 of file assets.cpp.

References collector_hooks.

Referenced by add_server_collect_hooks(), cfcitybell_init(), and citylife_init().

◆ assets_collect()

◆ assets_end_load()

void assets_end_load ( )

Called after collect is complete, to check various things.

Definition at line 231 of file assets.cpp.

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

Referenced by load_assets().

◆ assets_finish_archetypes_for_play()

void assets_finish_archetypes_for_play ( )

◆ assets_free()

void assets_free ( )

Free all assets-related memory.

Definition at line 72 of file assets.cpp.

References manager.

Referenced by free_globals().

◆ assets_init()

void assets_init ( )

Init assets-related variables.

Definition at line 65 of file assets.cpp.

Referenced by init_library().

◆ assets_number_of_treasurelists()

size_t assets_number_of_treasurelists ( )

Definition at line 262 of file assets.cpp.

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

Referenced by malloc_info().

◆ assets_number_of_treasures()

size_t assets_number_of_treasures ( )

Definition at line 259 of file assets.cpp.

References nroftreasures.

Referenced by malloc_info().

◆ assets_pack()

◆ getManager()

◆ load_assets()

void load_assets ( void  )

Definition at line 551 of file assets.cpp.

References ASSETS_ALL, assets_collect(), assets_end_load(), Settings::datadir, and settings.

Referenced by command_recollect(), and init_library().

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

◆ 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 543 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 534 of file assets.cpp.

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

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

◆ quests_count()

size_t quests_count ( bool  includeSystem)