Go to the documentation of this file.
42 #include <unordered_map>
94 if (
t->item == NULL &&
t->name == NULL)
95 LOG(
llevError,
"Treasurelist %s has element with no name or archetype\n", tl->
name);
96 if (
t->chance >= 100 &&
t->next_yes && (
t->next ||
t->next_no))
97 LOG(
llevError,
"Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", tl->
name);
98 if (
t->name && strcmp(
t->name,
"NONE"))
114 LOG(
llevInfo,
"Starting to collect assets from %s\n", datadir);
148 LOG(
llevInfo,
"Finished collecting assets from %s\n", datadir);
162 LOG(llevError,
"Fatal: %s is generator without content_on_gen but lacks other_arch.\n", arch->name);
167 LOG(llevError,
"Fatal: %s is generator with content_on_gen but lacks inventory.\n", arch->name);
184 if (arch->clone.other_arch->clone.move_type == 0) {
185 LOG(llevError,
"Summonable archetype %s [%s] has no move_type defined!\n", arch->clone.other_arch->name, arch->clone.other_arch->clone.name);
186 fatal(SEE_LAST_ERROR);
203 auto skill = manager->archetypes()->first([&arch] (const archetype *skill) {
204 return skill->clone.type == SKILL && arch->clone.skill == skill->clone.name;
233 check_treasurelist(list->items, list);
250 if (!strcmp(
name,
"none"))
334 assets->
each([writer,
buf] (T *asset) {
344 for (
const auto item :
list->items) {
361 auto dot = strrchr(
name,
'.');
384 memset(&h, 0,
sizeof(h));
389 h.
mtime = time(NULL);
408 if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
413 add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen,
filename);
427 bool isTar = (
count > 1) || (strcmp(
split[0],
"images") == 0);
436 for (
size_t t = 0;
t <
count;
t++) {
438 const char *
name =
nullptr;
441 if (strcmp(
type,
"treasures") == 0) {
443 name =
"crossfire.trs";
444 }
else if (strcmp(
type,
"faces") == 0) {
447 name =
"crossfire.face";
448 }
else if (strcmp(
type,
"archs") == 0) {
450 name =
"crossfire.arc";
451 }
else if (strcmp(
type,
"messages") == 0) {
454 }
else if (strcmp(
type,
"facesets") == 0) {
457 }
else if (strcmp(
type,
"artifacts") == 0) {
460 }
else if (strcmp(
type,
"formulae") == 0) {
463 }
else if (strcmp(
type,
"quests") == 0) {
465 name =
"crossfire.quests";
466 }
else if (strcmp(
type,
"images") == 0) {
486 if (fwrite(
static_cast<void*
>(
data), 1, length,
out) != length) {
511 object *
op = &
arch->clone;
513 op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
514 op->speed = -op->speed;
524 LOG(
llevError,
"quest %s required but not found!\n", code);
static void do_pack(AssetWriter< T > *writer, AssetsCollection< T > *assets, StringBuffer *buf)
size_t stringbuffer_length(StringBuffer *sb)
recipelist * get_formulalist(int i)
void quest_for_each(quest_op op, void *user)
void LOG(LogLevel logLevel, const char *format,...)
void(* quest_op)(const quest_definition *, void *)
#define QUERY_FLAG(xyz, p)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
void archetypes_for_each(arch_op op)
archetype * get_next_archetype(archetype *current)
#define FLAG_CONTENT_ON_GEN
void init_regions(BufferReader *reader, const char *filename)
StringBuffer * stringbuffer_new(void)
void init_attackmess(BufferReader *reader, const char *filename)
const Face * findById(uint16_t id)
AllAnimations * animations()
face_sets * find_faceset(int id)
void(* face_op)(const Face *)
class AssetsTracker * assets_tracker
treasurelist * find_treasurelist(const char *name)
size_t visibleCount() const
static void check_generators(void)
const Face * find_face(const char *name)
AssetsManager * getManager()
T * find(const Key &name)
void collect(const std::string &directory)
char * stringbuffer_finish(StringBuffer *sb)
int mtar_close(mtar_t *tar)
int mtar_open(mtar_t *tar, const char *filename, const char *mode)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
bool check_formulae(void)
#define ASSETS_ARCHETYPES
static void build_filename(const char *name, const char *prefix, char *dest, size_t max)
int mtar_finalize(mtar_t *tar)
int mtar_write_data(mtar_t *tar, const void *data, unsigned size)
size_t quests_count(bool includeSystem)
void check_summoned(void)
face_sets * findById(int id)
static void pack_formulae(StringBuffer *buf)
void assets_finish_archetypes_for_play()
const char * hooks_filename[20]
void addLoader(AssetLoader *loader)
static void pack_images(mtar_t *tar)
void each(std::function< void(T *)> op)
const Face * get_face_by_id(uint16_t id)
quest_definition * quest_get_by_code(sstring code)
static void check_spells(void)
#define ASSETS_ATTACK_MESSAGES
const GeneralMessage * get_message_from_identifier(const char *identifier)
void fatal(enum fatal_error err)
Archetypes * archetypes()
int mtar_write_header(mtar_t *tar, const mtar_header_t *h)
Animations * try_find_animation(const char *name)
quest_definition * quest_find_by_code(sstring code)
static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename)
void stringbuffer_delete(StringBuffer *sb)
virtual void write(const T *asset, StringBuffer *buf)=0
const typedef char * sstring
size_t assets_number_of_treasurelists()
archetype * find_archetype(const char *name)
const char *const spell_mapping[SPELL_MAPPINGS]
Animations * find_animation(const char *name)
void init_formulae(BufferReader *reader, const char *filename)
artifactlist * first_artifactlist
void faces_for_each(face_op op)
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
void assets_pack(const char *what, const char *filename)
static void pack_artifacts(StringBuffer *buf)
void assets_collect(const char *datadir, int what)
static std::vector< std::string > split(const std::string &field, const std::string &by)
virtual void write(const artifact *item, StringBuffer *buf)
void(* arch_op)(archetype *)
static AssetsManager * manager
size_t assets_number_of_treasures()
static void check_treasurelist(treasure *t, const treasurelist *tl)