Crossfire Server, Trunk
assets.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2020 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
18 #ifndef WIN32 /* ---win32 exclude headers */
19 #include <sys/stat.h>
20 #include "autoconf.h"
21 #endif
22 
23 extern "C" {
24 #include "global.h"
25 #include "compat.h"
26 }
27 #include "assets.h"
28 #include "AssetsManager.h"
29 #include "AssetCollector.h"
30 #include "TreasureLoader.h"
31 #include "ArchetypeLoader.h"
32 #include "PngLoader.h"
33 #include "FacesetLoader.h"
34 #include "FaceLoader.h"
35 #include "WrapperLoader.h"
36 #include "MessageLoader.h"
37 #include "QuestLoader.h"
38 #include "Faces.h"
39 #include <string.h>
40 
41 #include <vector>
42 #include <string>
43 #include <set>
44 #include <algorithm>
45 #include <map>
46 #include <memory>
47 
48 #include "AssetWriter.h"
49 #include "TreasureWriter.h"
50 #include "FaceWriter.h"
51 #include "AnimationWriter.h"
52 #include "ArchetypeWriter.h"
53 #include "MessageWriter.h"
54 #include "image.h"
55 #include "FacesetWriter.h"
56 #include "ArtifactWriter.h"
57 #include "FormulaeWriter.h"
58 #include "QuestWriter.h"
59 
60 #include "microtar.h"
61 #include "TarLoader.h"
62 
63 static AssetsManager *manager = nullptr;
64 
68 void assets_init() {
69  manager = new AssetsManager();
70 }
71 
75 void assets_free() {
76  delete manager;
77  manager = nullptr;
78 }
79 
83 size_t nroftreasures = 0;
84 
96 static void check_treasurelist(treasure *t, const treasurelist *tl) {
97  if (t->item == NULL && t->name == NULL)
98  LOG(llevError, "Treasurelist %s has element with no name or archetype\n", tl->name);
99  if (t->chance >= 100 && t->next_yes && (t->next || t->next_no))
100  LOG(llevError, "Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", tl->name);
101  if (t->name && strcmp(t->name, "NONE"))
102  find_treasurelist(t->name);
103  if (t->next)
104  check_treasurelist(t->next, tl);
105  if (t->next_yes)
106  check_treasurelist(t->next_yes, tl);
107  if (t->next_no)
108  check_treasurelist(t->next_no, tl);
109 }
110 
116 void assets_collect(const char* datadir, int what) {
117  LOG(llevInfo, "Starting to collect assets from %s\n", datadir);
118 
119  auto tracker = static_cast<AssetsTracker *>(settings.archetypes_tracker);
120 
121  AssetCollector collector;
122  if (what & ASSETS_TREASURES)
124  if (what & ASSETS_ARCHETYPES)
125  collector.addLoader(new ArchetypeLoader(manager->archetypes(), tracker));
126  if (what & ASSETS_PNG)
127  collector.addLoader(new PngLoader(manager->faces(), manager->facesets()));
128  if (what & ASSETS_FACESETS)
129  collector.addLoader(new FacesetLoader(manager->facesets()));
130  if (what & ASSETS_FACES)
131  collector.addLoader(new FaceLoader(manager->faces(), manager->animations()));
132  if (what & ASSETS_MESSAGES)
133  collector.addLoader(new MessageLoader(manager->messages()));
134  if (what & ASSETS_ARTIFACTS)
135  collector.addLoader(new WrapperLoader("/artifacts", init_artifacts));
136  if (what & ASSETS_FORMULAE)
137  collector.addLoader(new WrapperLoader("/formulae", init_formulae));
138  if (what & ASSETS_ATTACK_MESSAGES)
139  collector.addLoader(new WrapperLoader("/attackmess", init_attackmess));
140  if (what & ASSETS_QUESTS)
141  collector.addLoader(new QuestLoader(manager->quests(), manager->faces(), tracker));
142  for (uint8_t hook = 0; hook < settings.hooks_count; hook++) {
143  collector.addLoader(new WrapperLoader(settings.hooks_filename[hook], settings.hooks[hook]));
144  }
145  collector.addLoader(new TarLoader(&collector));
146  collector.collect(datadir);
147 
148  LOG(llevInfo, "Finished collecting assets from %s\n", datadir);
149 }
150 
154 static void check_generators(void) {
155  int abort = 0;
156 
157  manager->archetypes()->each([&abort] (const auto& arch) {
158  if (!QUERY_FLAG(&arch->clone, FLAG_GENERATOR))
159  return;
160 
161  if (!QUERY_FLAG(&arch->clone, FLAG_CONTENT_ON_GEN) && arch->clone.other_arch == NULL) {
162  LOG(llevError, "Fatal: %s is generator without content_on_gen but lacks other_arch.\n", arch->name);
163  abort = 1;
164  return;
165  }
166  if (QUERY_FLAG(&arch->clone, FLAG_CONTENT_ON_GEN) && arch->clone.inv == NULL) {
167  LOG(llevError, "Fatal: %s is generator with content_on_gen but lacks inventory.\n", arch->name);
168  abort = 1;
169  return;
170  }
171  });
172 
173  if (abort)
175 }
176 
181 void check_summoned(void) {
182  manager->archetypes()->each([] (const auto& arch) {
183  if (arch->clone.type == SPELL && arch->clone.subtype == SP_SUMMON_GOLEM && arch->clone.other_arch) {
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);
187  }
188  }
189  });
190 }
191 
198 static void check_spells(void) {
199  int abort = 0;
200 
201  manager->archetypes()->each([&abort] (const auto& arch) {
202  if (arch->clone.type == SPELL && arch->clone.skill) {
203  auto skill = manager->archetypes()->first([&arch] (const archetype *skill) {
204  return skill->clone.type == SKILL && arch->clone.skill == skill->clone.name;
205  });
206  if (!skill) {
207  LOG(llevError, "Spell %s has improper associated skill %s\n", arch->name, arch->clone.skill);
208  abort = 1;
209  }
210  }
211  });
212 
213  for (size_t i = 0; i < sizeof(spell_mapping) / sizeof(spell_mapping[0]); i++) {
215  LOG(llevError, "Unable to find spell mapping %s (%i)\n", spell_mapping[i], i);
216  abort = 1;
217  }
218  }
219 
220  if (abort)
222 }
223 
229  return manager->dumpUndefined();
230 }
231 
237  check_spells();
238  check_summoned();
239  manager->treasures()->each([] (auto list) {
240  if (list->items) {
241  check_treasurelist(list->items, list);
242  }
243  });
244  check_recipes();
245  check_formulae();
246 }
247 
258  if (!strcmp(name, "none"))
259  return NULL;
260  return manager->treasures()->get(name);
261 }
262 
264  return nroftreasures;
265 }
267  return manager->treasures()->count();
268 }
269 
271  return manager->archetypes()->count();
272 }
273 
275  return manager->archetypes()->next(current);
276 }
277 
279  return manager->archetypes()->get(name);
280 }
281 
283  return manager->archetypes()->find(name);
284 }
285 
287  return manager->animations()->count();
288 }
289 
291  return manager->animations()->get(name);
292 }
293 
295  return manager->animations()->find(name);
296 }
297 
299  manager->animations()->each(*op);
300 }
301 
302 const Face *find_face(const char *name) {
303  return manager->faces()->get(name);
304 }
305 
306 const Face *try_find_face(const char *name, const Face *error) {
307  auto found = manager->faces()->find(name);
308  if (found)
309  return found;
310  return error;
311 }
312 
313 size_t get_faces_count() {
314  return manager->faces()->count();
315 }
316 
318  manager->faces()->each(*op);
319 }
320 
322  manager->facesets()->each(*op);
323 }
324 
326  manager->archetypes()->each(*op);
327 }
328 
330  return manager;
331 }
332 
339 const Face *get_face_by_id(uint16_t id) {
340  return manager->faces()->findById(id);
341 }
342 
344  return manager->messages()->random();
345 }
346 
352 const GeneralMessage *get_message_from_identifier(const char *identifier) {
353  return manager->messages()->find(identifier);
354 }
355 
357  return manager->faces()->checksum();
358 }
359 
361  return manager->facesets()->findById(id);
362 }
363 
364 template<class T>
365 static void do_pack(AssetWriter<T> *writer, AssetsCollection<T> *assets, StringBuffer *buf) {
366  assets->each([writer, buf] (T *asset) {
367  writer->write(asset, buf);
368  });
369  delete writer;
370 }
371 
373  ArtifactWriter writer;
375  while (list) {
376  writer.write(list, buf);
377  list = list->next;
378  }
379 }
380 
382  FormulaeWriter writer;
384  while (list) {
385  writer.write(list, buf);
386  list = list->next;
387  }
388 }
389 
390 static void build_filename(const char *name, const char *prefix, char *dest, size_t max) {
391  auto dot = strrchr(name, '.');
392  if (!dot) {
393  snprintf(dest, max, "%s.%s", name, prefix);
394  return;
395  }
396  memset(dest, 0, max);
397  dot++;
398 
399  memcpy(dest, name, dot - name);
400  strncat(dest, prefix, max);
401  strncat(dest, ".", max);
402  strncat(dest, dot, max);
403  strncat(dest, ".png", max);
404 }
405 
413 static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename) {
414  mtar_header_t h;
415  memset(&h, 0, sizeof(h));
416  strncpy(h.name, filename, sizeof(h.name));
417  h.size = len;
418  h.type = MTAR_TREG;
419  h.mode = 0664;
420  h.mtime = time(NULL);
421  /* Build raw header and write */
422  if (MTAR_ESUCCESS != mtar_write_header(tar, &h)) {
423  LOG(llevError, "Failed to write tar header for %s\n", filename);
425  }
426  if (MTAR_ESUCCESS != mtar_write_data(tar, data, len)) {
427  LOG(llevError, "Failed to write tar data for %s\n", filename);
429  }
430 }
431 
436 static void pack_images(mtar_t *tar) {
437  manager->faces()->each([&tar] (const auto face) {
438  manager->facesets()->each([&tar, &face] (const auto fs) {
439  if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
440  return;
441  }
442  char filename[500];
443  build_filename(face->name, fs->prefix, filename, sizeof(filename));
444  add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen, filename);
445  });
446  });
447 }
448 
449 void assets_pack(const char *what, const char *filename) {
450 #define MAX_PACK 100
451  char *split[MAX_PACK];
452  char *dup = strdup_local(what);
453  size_t count = split_string(dup, split, MAX_PACK, '+');
454  if (count == 0) {
455  LOG(llevError, "Invalid pack type %s\n", what);
457  }
458  bool isTar = (count > 1) || (strcmp(split[0], "images") == 0);
459  mtar_t tar;
460  if (isTar) {
461  if (MTAR_ESUCCESS != mtar_open(&tar, filename, "w")) {
462  LOG(llevError, "Failed to open tar file %s\n", filename);
464  }
465  }
466 
467  for (size_t t = 0; t < count; t++) {
468  const char *type = split[t];
469  const char *name = nullptr;
470 
472  if (strcmp(type, "treasures") == 0) {
474  name = "crossfire.trs";
475  } else if (strcmp(type, "faces") == 0) {
476  do_pack(new FaceWriter(), manager->faces(), buf);
478  name = "crossfire.face";
479  } else if (strcmp(type, "archs") == 0) {
481  name = "crossfire.arc";
482  } else if (strcmp(type, "messages") == 0) {
484  name = "messages";
485  } else if (strcmp(type, "facesets") == 0) {
487  name = "image_info";
488  } else if (strcmp(type, "artifacts") == 0) {
490  name = "artifacts";
491  } else if (strcmp(type, "formulae") == 0) {
493  name = "formulae";
494  } else if (strcmp(type, "quests") == 0) {
495  do_pack(new QuestWriter(), manager->quests(), buf);
496  name = "crossfire.quests";
497  } else if (strcmp(type, "images") == 0) {
498  pack_images(&tar);
500  continue; // Already stored in tar.
501  } else {
502  LOG(llevError, "Invalid asset type '%s'\n", type);
504  }
505 
506  size_t length = stringbuffer_length(buf);
507  char *data = stringbuffer_finish(buf);
508 
509  if (isTar) {
510  add_to_tar(&tar, data, length, name);
511  } else {
512  FILE *out = fopen(filename, "w+");
513  if (!out) {
514  LOG(llevError, "Failed to open file '%s'\n", filename);
516  }
517  if (fwrite(static_cast<void*>(data), 1, length, out) != length) {
518  LOG(llevError, "Failed to write all data!\n", filename);
519  fclose(out);
521  }
522  fclose(out);
523  }
524  free(data);
525  }
526 
527  if (isTar) {
528  if (MTAR_ESUCCESS != mtar_finalize(&tar)) {
529  LOG(llevError, "Failed to finalize tar file %s\n", filename);
531  }
532  if (MTAR_ESUCCESS != mtar_close(&tar)) {
533  LOG(llevError, "Failed to closed tar file %s\n", filename);
535  }
536  }
537  free(dup);
538 }
539 
541  manager->archetypes()->each([] (archetype *arch) {
542  object *op = &arch->clone;
543  if (op->speed < 0) {
544  op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
545  op->speed = -op->speed; // Make this always positive
546  }
547  });
548 }
549 
573  long mult;
574  const char *cp;
575  char part1[100];
576  char part2[100];
577 
578  /* same as atoi(), but skip number */
579  mult = 0;
580  while (isdigit(*name)) {
581  mult = 10*mult+(*name-'0');
582  name++;
583  }
584  if (mult > 0)
585  name++;
586  else
587  mult = 1;
588  /* first, try to match the name of an archetype */
589 
590  long value = 0;
591  bool found = false;
592  manager->archetypes()->each([&value, &found, &name, &part1] (const archetype *at) {
593  if (found) {
594  return;
595  }
596 
597  if (at->clone.title != NULL) {
598  /* inefficient, but who cares? */
599  snprintf(part1, sizeof(part1), "%s %s", at->clone.name, at->clone.title);
600  if (!strcasecmp(part1, name)) {
601  value = at->clone.value;
602  found = true;
603  return;
604  }
605  }
606  if (!strcasecmp(at->clone.name, name)) {
607  value = at->clone.value;
608  found = true;
609  return;
610  }
611  });
612  if (found) {
613  return mult * value;
614  }
615 
616  /* second, try to match an artifact ("arch of something") */
617  cp = strstr(name, " of ");
618  if (cp != NULL) {
619  safe_strncpy(part1, name, sizeof(part1));
620  part1[cp-name] = '\0';
621  safe_strncpy(part2, cp + 4, sizeof(part2));
622  manager->archetypes()->each([&value, &found, &part1, &part2] (const archetype *at) {
623  if (found) {
624  return;
625  }
626 
627  if (!strcasecmp(at->clone.name, part1) && at->clone.title == NULL) {
628  /* find the first artifact derived from that archetype (same type) */
629  for (auto al = first_artifactlist; al != NULL; al = al->next) {
630  if (al->type == at->clone.type) {
631  for (auto art = al->items; art != NULL; art = art->next) {
632  if (!strcasecmp(art->item->name, part2)) {
633  value = at->clone.value * art->item->value;
634  found = true;
635  return;
636  }
637  }
638  }
639  }
640  }
641  });
642  }
643  if (found) {
644  return mult * value;
645  }
646 
647  /* third, try to match a body part ("arch's something") */
648  cp = strstr(name, "'s ");
649  if (cp != NULL) {
650  safe_strncpy(part1, name, sizeof(part1));
651  part1[cp-name] = '\0';
652  safe_strncpy(part2, cp + 3, sizeof(part2));
653  /* examine all archetypes matching the first part of the name */
654  manager->archetypes()->each([&value, &found, &part1, &part2] (const archetype *at) {
655  if (found) {
656  return;
657  }
658  if (!strcasecmp(at->clone.name, part1) && at->clone.title == NULL) {
659  if (at->clone.randomitems != NULL) {
660  auto at2 = find_treasure_by_name(at->clone.randomitems->items, part2, 0);
661  if (at2 != NULL) {
662  value = at2->clone.value * isqrt(at->clone.level * 2);
663  found = true;
664  return;
665  }
666  }
667  }
668  });
669  }
670  if (found) {
671  return mult * value;
672  }
673 
674  /* failed to find any matching items -- formula should be checked */
675  LOG(llevError, "Couldn't find cost for ingredient %s\n", name);
676  return -1;
677 }
678 
681 
682  quest = quest_get_by_code(code);
683  if (!quest) {
684  LOG(llevError, "quest %s required but not found!\n", code);
685  return NULL;
686  }
687  return quest;
688 }
689 
691  return manager->quests()->find(code);
692 }
693 
699 void quest_for_each(quest_op op, void *user) {
700  manager->quests()->each([&op, &user] (auto q) { op(q, user); });
701 }
702 
703 size_t quests_count(bool includeSystem) {
704  return includeSystem ? manager->quests()->count() : manager->quests()->visibleCount();
705 }
AssetsCollection::count
size_t count() const
Definition: AssetsCollection.h:57
facesets_for_each
void facesets_for_each(faceset_op op)
Definition: assets.cpp:321
Face
Definition: face.h:14
do_pack
static void do_pack(AssetWriter< T > *writer, AssetsCollection< T > *assets, StringBuffer *buf)
Definition: assets.cpp:365
global.h
castle_read.prefix
string prefix
Definition: castle_read.py:31
get_formulalist
recipelist * get_formulalist(int i)
Definition: recipe.c:96
Settings::hooks_count
uint8_t hooks_count
Definition: global.h:328
GeneralMessage
Definition: book.h:44
safe_strncpy
#define safe_strncpy
Definition: compat.h:27
stringbuffer_new
StringBuffer * stringbuffer_new(void)
Definition: stringbuffer.c:57
FormulaeWriter.h
AssetWriter.h
assets_number_of_animations
size_t assets_number_of_animations()
Definition: assets.cpp:286
ArchetypeWriter.h
Settings::archetypes_tracker
void * archetypes_tracker
Definition: global.h:332
mtar_open
int mtar_open(mtar_t *tar, const char *filename, const char *mode)
Definition: microtar.c:177
llevError
@ llevError
Definition: logger.h:11
ASSETS_FACESETS
#define ASSETS_FACESETS
Definition: assets.h:27
quest_for_each
void quest_for_each(quest_op op, void *user)
Definition: assets.cpp:699
ArchetypeWriter
Definition: ArchetypeWriter.h:22
AssetsManager::messages
Messages * messages()
Definition: AssetsManager.h:59
assets_dump_undefined
size_t assets_dump_undefined()
Definition: assets.cpp:228
FLAG_GENERATOR
#define FLAG_GENERATOR
Definition: define.h:248
strdup_local
#define strdup_local
Definition: compat.h:29
quest_op
void(* quest_op)(const quest_definition *, void *)
Definition: quest.h:55
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
archetypes_for_each
void archetypes_for_each(arch_op op)
Definition: assets.cpp:325
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:274
AssetsManager.h
FLAG_CONTENT_ON_GEN
#define FLAG_CONTENT_ON_GEN
Definition: define.h:365
obj::value
int32_t value
Definition: object.h:353
mtar_header_t::type
unsigned type
Definition: microtar.h:48
Faces::checksum
int checksum() const
Definition: Faces.h:27
QuestWriter.h
mtar_t
Definition: microtar.h:56
MessageWriter.h
Faces::findById
const Face * findById(uint16_t id)
Definition: Faces.cpp:43
guildoracle.list
list
Definition: guildoracle.py:87
ASSETS_MESSAGES
#define ASSETS_MESSAGES
Definition: assets.h:30
get_random_message
GeneralMessage * get_random_message()
Definition: assets.cpp:343
mtar_header_t::size
unsigned size
Definition: microtar.h:46
AssetsManager::animations
AllAnimations * animations()
Definition: AssetsManager.h:49
animations_for_each
void animations_for_each(anim_op op)
Definition: assets.cpp:298
find_faceset
face_sets * find_faceset(int id)
Definition: assets.cpp:360
face_op
void(* face_op)(const Face *)
Definition: assets.h:45
ArtifactWriter.h
FaceWriter
Definition: FaceWriter.h:22
FaceWriter.h
AssetsManager::dumpUndefined
size_t dumpUndefined()
Definition: AssetsManager.cpp:65
TreasureLoader
Definition: TreasureLoader.h:27
first_artifactlist
EXTERN artifactlist * first_artifactlist
Definition: global.h:118
inja::string_view::split
std::pair< nonstd::string_view, nonstd::string_view > split(nonstd::string_view view, char Separator)
Definition: inja.hpp:1886
MAX_PACK
#define MAX_PACK
find_treasurelist
treasurelist * find_treasurelist(const char *name)
Definition: assets.cpp:257
TreasureLoader.h
mtar_header_t::mtime
unsigned mtime
Definition: microtar.h:47
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
Quests::visibleCount
size_t visibleCount() const
Definition: Quests.h:26
assets_number_of_archetypes
size_t assets_number_of_archetypes()
Definition: assets.cpp:270
npc_dialog.filename
filename
Definition: npc_dialog.py:99
assets_free
void assets_free()
Definition: assets.cpp:75
check_generators
static void check_generators(void)
Definition: assets.cpp:154
init_formulae
void init_formulae(BufferReader *reader, const char *filename)
Definition: recipe.c:167
find_face
const Face * find_face(const char *name)
Definition: assets.cpp:302
getManager
AssetsManager * getManager()
Definition: assets.cpp:329
treasurestruct
Definition: treasure.h:63
AssetsCollection::find
T * find(const Key &name)
Definition: AssetsCollection.h:85
AssetCollector::collect
void collect(const std::string &directory)
Definition: AssetCollector.cpp:57
archt
Definition: object.h:468
settings
struct Settings settings
Definition: init.c:39
AnimationWriter
Definition: AnimationWriter.h:22
FacesetLoader
Definition: FacesetLoader.h:21
ASSETS_QUESTS
#define ASSETS_QUESTS
Definition: assets.h:34
quest
Definition: quest.py:1
get_bitmap_checksum
int get_bitmap_checksum()
Definition: assets.cpp:356
Messages::random
GeneralMessage * random()
Definition: Messages.cpp:50
item.q
q
Definition: item.py:32
mtar_header_t::name
char name[100]
Definition: microtar.h:49
AssetsTracker
Definition: AssetsTracker.h:28
AnimationWriter.h
check_recipes
void check_recipes()
Definition: recipe.c:146
QuestLoader
Definition: QuestLoader.h:24
obj::name
sstring name
Definition: object.h:312
AssetsCollection
Definition: AssetsCollection.h:39
faceset_op
void(* faceset_op)(const face_sets *)
Definition: assets.h:47
AssetsManager::treasures
Treasures * treasures()
Definition: AssetsManager.h:54
ASSETS_FACES
#define ASSETS_FACES
Definition: assets.h:25
ArchetypeLoader
Definition: ArchetypeLoader.h:22
microtar.h
ASSETS_ARCHETYPES
#define ASSETS_ARCHETYPES
Definition: assets.h:24
mtar_finalize
int mtar_finalize(mtar_t *tar)
Definition: microtar.c:373
build_filename
static void build_filename(const char *name, const char *prefix, char *dest, size_t max)
Definition: assets.cpp:390
fatal
void fatal(enum fatal_error err)
Definition: utils.c:597
FacesetWriter
Definition: FacesetWriter.h:23
compat.h
FormulaeWriter::write
virtual void write(const recipelist *list, StringBuffer *buf)
Definition: FormulaeWriter.cpp:52
AssetsManager::quests
Quests * quests()
Definition: AssetsManager.h:71
AssetsManager::faces
Faces * faces()
Definition: AssetsManager.h:39
quests_count
size_t quests_count(bool includeSystem)
Definition: assets.cpp:703
check_summoned
void check_summoned(void)
Definition: assets.cpp:181
navar-midane_time.data
data
Definition: navar-midane_time.py:11
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.c:76
Facesets::findById
face_sets * findById(int id)
Definition: Facesets.cpp:19
treasureliststruct::name
const char * name
Definition: treasure.h:83
pack_formulae
static void pack_formulae(StringBuffer *buf)
Definition: assets.cpp:381
ArtifactWriter
Definition: ArtifactWriter.h:22
FacesetWriter.h
artifactliststruct
Definition: artifact.h:26
QuestWriter
Definition: QuestWriter.h:19
sstring
const typedef char * sstring
Definition: global.h:40
disinfect.count
int count
Definition: disinfect.py:7
say.max
dictionary max
Definition: say.py:148
assets_finish_archetypes_for_play
void assets_finish_archetypes_for_play()
Definition: assets.cpp:540
Settings::hooks_filename
const char * hooks_filename[20]
Definition: global.h:329
ArtifactWriter::write
virtual void write(const artifactlist *list, StringBuffer *buf)
Definition: ArtifactWriter.cpp:58
AssetCollector::addLoader
void addLoader(AssetLoader *loader)
Definition: AssetCollector.h:40
pack_images
static void pack_images(mtar_t *tar)
Definition: assets.cpp:436
AssetsCollection::get
T * get(const Key &name)
Definition: AssetsCollection.h:66
recipeliststruct
Definition: recipe.h:37
AssetsCollection::each
void each(std::function< void(T *)> op)
Definition: AssetsCollection.h:135
get_face_by_id
const Face * get_face_by_id(uint16_t id)
Definition: assets.cpp:339
mtar_write_data
int mtar_write_data(mtar_t *tar, const void *data, unsigned size)
Definition: microtar.c:357
mtar_header_t
Definition: microtar.h:43
quest_get_by_code
quest_definition * quest_get_by_code(sstring code)
Definition: assets.cpp:690
AssetsManager::facesets
Facesets * facesets()
Definition: AssetsManager.h:65
check_spells
static void check_spells(void)
Definition: assets.cpp:198
ASSETS_ATTACK_MESSAGES
#define ASSETS_ATTACK_MESSAGES
Definition: assets.h:33
AssetsCollection::next
T * next(T *current)
Definition: AssetsCollection.h:116
image.h
get_message_from_identifier
const GeneralMessage * get_message_from_identifier(const char *identifier)
Definition: assets.cpp:352
ASSETS_ARTIFACTS
#define ASSETS_ARTIFACTS
Definition: assets.h:31
mtar_write_header
int mtar_write_header(mtar_t *tar, const mtar_header_t *h)
Definition: microtar.c:323
AssetsManager::archetypes
Archetypes * archetypes()
Definition: AssetsManager.h:44
split_string
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Definition: utils.c:500
ASSETS_TREASURES
#define ASSETS_TREASURES
Definition: assets.h:28
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:294
StringBuffer
Definition: stringbuffer.c:25
is_valid_types_gen.found
found
Definition: is_valid_types_gen.py:39
mtar_header_t::mode
unsigned mode
Definition: microtar.h:44
mtar_close
int mtar_close(mtar_t *tar)
Definition: microtar.c:211
obj::title
sstring title
Definition: object.h:318
recipe_find_ingredient_cost
long recipe_find_ingredient_cost(const char *name)
Definition: assets.cpp:572
quest_find_by_code
quest_definition * quest_find_by_code(sstring code)
Definition: assets.cpp:679
MessageLoader
Definition: MessageLoader.h:21
animations_struct
Definition: face.h:25
add_to_tar
static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename)
Definition: assets.cpp:413
make_face_from_files.out
out
Definition: make_face_from_files.py:74
QuestLoader.h
MTAR_TREG
@ MTAR_TREG
Definition: microtar.h:34
llevInfo
@ llevInfo
Definition: logger.h:12
Floor.t
t
Definition: Floor.py:62
MessageWriter
Definition: MessageWriter.h:22
archt::clone
object clone
Definition: object.h:472
Faces.h
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
AssetWriter::write
virtual void write(const T *asset, StringBuffer *buf)=0
WrapperLoader.h
give.op
op
Definition: give.py:33
assets_number_of_treasurelists
size_t assets_number_of_treasurelists()
Definition: assets.cpp:266
autojail.value
value
Definition: autojail.py:6
AssetCollector
Definition: AssetCollector.h:24
MTAR_ESUCCESS
@ MTAR_ESUCCESS
Definition: microtar.h:22
quest_definition
Definition: quest.h:42
find_archetype
archetype * find_archetype(const char *name)
Definition: assets.cpp:278
init_attackmess
void init_attackmess(BufferReader *reader, const char *filename)
Definition: init.c:457
stringbuffer_length
size_t stringbuffer_length(StringBuffer *sb)
Definition: stringbuffer.c:184
convert.dest
dest
Definition: convert.py:25
FormulaeWriter
Definition: FormulaeWriter.h:22
PngLoader.h
assets.h
buf
StringBuffer * buf
Definition: readable.c:1606
ASSETS_PNG
#define ASSETS_PNG
Definition: assets.h:29
Settings::hooks
collectorHook hooks[20]
Definition: global.h:330
WrapperLoader
Definition: WrapperLoader.h:27
find_animation
Animations * find_animation(const char *name)
Definition: assets.cpp:290
anim_op
void(* anim_op)(const Animations *)
Definition: assets.h:46
FaceLoader.h
TreasureWriter
Definition: TreasureWriter.h:22
ArchetypeLoader.h
strcasecmp
int strcasecmp(const char *s1, const char *s2)
FaceLoader
Definition: FaceLoader.h:22
faces_for_each
void faces_for_each(face_op op)
Definition: assets.cpp:317
TarLoader
Definition: TarLoader.h:8
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:282
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:306
assets_pack
void assets_pack(const char *what, const char *filename)
Definition: assets.cpp:449
SP_SUMMON_GOLEM
#define SP_SUMMON_GOLEM
Definition: spells.h:86
AssetsManager
Definition: AssetsManager.h:28
pack_artifacts
static void pack_artifacts(StringBuffer *buf)
Definition: assets.cpp:372
TreasureWriter.h
MessageLoader.h
assets_collect
void assets_collect(const char *datadir, int what)
Definition: assets.cpp:116
nroftreasures
size_t nroftreasures
Definition: assets.cpp:83
TarLoader.h
arch_op
void(* arch_op)(archetype *)
Definition: assets.h:44
PngLoader
Definition: PngLoader.h:22
stringbuffer_delete
void stringbuffer_delete(StringBuffer *sb)
Definition: stringbuffer.c:71
check_formulae
void check_formulae(void)
Definition: recipe.c:284
get_faces_count
size_t get_faces_count()
Definition: assets.cpp:313
face_sets
Definition: image.h:17
SPELL
@ SPELL
Definition: object.h:214
replace.current
current
Definition: replace.py:64
spell_mapping
const char *const spell_mapping[SPELL_MAPPINGS]
Definition: object.c:63
if
if(!(yy_init))
Definition: loader.c:2589
manager
static AssetsManager * manager
Definition: assets.cpp:63
AssetWriter
Definition: AssetWriter.h:24
FacesetLoader.h
AssetCollector.h
assets_init
void assets_init()
Definition: assets.cpp:68
assets_number_of_treasures
size_t assets_number_of_treasures()
Definition: assets.cpp:263
treasureliststruct
Definition: treasure.h:82
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
autoconf.h
assets_end_load
void assets_end_load()
Definition: assets.cpp:235
check_treasurelist
static void check_treasurelist(treasure *t, const treasurelist *tl)
Definition: assets.cpp:96
give.name
name
Definition: give.py:27
ASSETS_FORMULAE
#define ASSETS_FORMULAE
Definition: assets.h:32
init_artifacts
void init_artifacts(BufferReader *reader, const char *filename)
Definition: artifact.c:548