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 #include "global.h"
24 #include "compat.h"
25 #include "assets.h"
26 #include "AssetsManager.h"
27 #include "AssetCollector.h"
28 #include "TreasureLoader.h"
29 #include "ArchetypeLoader.h"
30 #include "PngLoader.h"
31 #include "FacesetLoader.h"
32 #include "FaceLoader.h"
33 #include "WrapperLoader.h"
34 #include "MessageLoader.h"
35 #include "QuestLoader.h"
36 #include "ArtifactLoader.h"
37 #include "Faces.h"
38 #include <string.h>
39 
40 #include <string>
41 #include <set>
42 #include <map>
43 #include <memory>
44 
45 #include "AssetWriter.h"
46 #include "TreasureWriter.h"
47 #include "FaceWriter.h"
48 #include "AnimationWriter.h"
49 #include "ArchetypeWriter.h"
50 #include "MessageWriter.h"
51 #include "image.h"
52 #include "FacesetWriter.h"
53 #include "ArtifactWriter.h"
54 #include "FormulaeWriter.h"
55 #include "QuestWriter.h"
56 
57 #include "microtar.h"
58 #include "TarLoader.h"
59 
60 static AssetsManager *manager = nullptr;
61 
65 void assets_init() {
66  manager = new AssetsManager();
67 }
68 
72 void assets_free() {
73  delete manager;
74  manager = nullptr;
75 }
76 
80 size_t nroftreasures = 0;
81 
93 static void check_treasurelist(treasure *t, const treasurelist *tl) {
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"))
99  find_treasurelist(t->name);
100  if (t->next)
101  check_treasurelist(t->next, tl);
102  if (t->next_yes)
103  check_treasurelist(t->next_yes, tl);
104  if (t->next_no)
105  check_treasurelist(t->next_no, tl);
106 }
107 
113 void assets_collect(const char* datadir, int what) {
114  LOG(llevInfo, "Starting to collect assets from %s\n", datadir);
115 
116  AssetCollector collector;
117  if (what & ASSETS_TREASURES)
119  if (what & ASSETS_ARCHETYPES)
121  if (what & ASSETS_PNG)
122  collector.addLoader(new PngLoader(manager->faces(), manager->facesets()));
123  if (what & ASSETS_FACESETS)
124  collector.addLoader(new FacesetLoader(manager->facesets()));
125  if (what & ASSETS_FACES)
127  if (what & ASSETS_MESSAGES)
129  if (what & ASSETS_ARTIFACTS) {
131  }
132  if (what & ASSETS_FORMULAE) {
133  collector.addLoader(new WrapperLoader("/formulae", init_formulae));
134  collector.addLoader(new WrapperLoader(".formulae", init_formulae));
135  }
136  if (what & ASSETS_ATTACK_MESSAGES)
137  collector.addLoader(new WrapperLoader("/attackmess", init_attackmess));
138  if (what & ASSETS_QUESTS)
140  if (what & ASSETS_REGIONS)
141  collector.addLoader(new WrapperLoader("regions.reg", init_regions));
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 (%zu)\n", spell_mapping[i], i);
216  abort = 1;
217  }
218  }
219 
220  if (abort)
222 }
223 
229  check_spells();
230  check_summoned();
231  manager->treasures()->each([] (auto list) {
232  if (list->items) {
233  check_treasurelist(list->items, list);
234  }
235  });
236  check_recipes();
237  check_formulae();
238 }
239 
250  if (!strcmp(name, "none"))
251  return NULL;
252  return manager->treasures()->get(name);
253 }
254 
256  return nroftreasures;
257 }
259  return manager->treasures()->count();
260 }
261 
263  return manager->archetypes()->next(current);
264 }
265 
267  return manager->archetypes()->get(name);
268 }
269 
271  return manager->archetypes()->find(name);
272 }
273 
275  return manager->animations()->get(name);
276 }
277 
279  return manager->animations()->find(name);
280 }
281 
282 const Face *find_face(const char *name) {
283  return manager->faces()->get(name);
284 }
285 
286 const Face *try_find_face(const char *name, const Face *error) {
287  auto found = manager->faces()->find(name);
288  if (found)
289  return found;
290  return error;
291 }
292 
293 size_t get_faces_count() {
294  return manager->faces()->count();
295 }
296 
298  manager->faces()->each(*op);
299 }
300 
302  manager->archetypes()->each(*op);
303 }
304 
306  return manager;
307 }
308 
315 const Face *get_face_by_id(uint16_t id) {
316  return manager->faces()->findById(id);
317 }
318 
324 const GeneralMessage *get_message_from_identifier(const char *identifier) {
325  return manager->messages()->find(identifier);
326 }
327 
329  return manager->facesets()->findById(id);
330 }
331 
332 template<class T>
333 static void do_pack(AssetWriter<T> *writer, AssetsCollection<T> *assets, StringBuffer *buf) {
334  assets->each([writer, buf] (T *asset) {
335  writer->write(asset, buf);
336  });
337  delete writer;
338 }
339 
341  ArtifactWriter writer;
343  while (list) {
344  for (const auto item : list->items) {
345  writer.write(item, buf);
346  }
347  list = list->next;
348  }
349 }
350 
352  FormulaeWriter writer;
354  while (list) {
355  writer.write(list, buf);
356  list = list->next;
357  }
358 }
359 
360 static void build_filename(const char *name, const char *prefix, char *dest, size_t max) {
361  auto dot = strrchr(name, '.');
362  if (!dot) {
363  snprintf(dest, max, "%s.%s", name, prefix);
364  return;
365  }
366  memset(dest, 0, max);
367  dot++;
368 
369  memcpy(dest, name, dot - name);
370  strncat(dest, prefix, max);
371  strncat(dest, ".", max);
372  strncat(dest, dot, max);
373  strncat(dest, ".png", max);
374 }
375 
383 static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename) {
384  mtar_header_t h;
385  memset(&h, 0, sizeof(h));
386  strncpy(h.name, filename, sizeof(h.name));
387  h.size = len;
388  h.type = MTAR_TREG;
389  h.mode = 0664;
390  h.mtime = time(NULL);
391  /* Build raw header and write */
392  if (MTAR_ESUCCESS != mtar_write_header(tar, &h)) {
393  LOG(llevError, "Failed to write tar header for %s\n", filename);
395  }
396  if (MTAR_ESUCCESS != mtar_write_data(tar, data, len)) {
397  LOG(llevError, "Failed to write tar data for %s\n", filename);
399  }
400 }
401 
406 static void pack_images(mtar_t *tar) {
407  manager->faces()->each([&tar] (const auto face) {
408  manager->facesets()->each([&tar, &face] (const auto fs) {
409  if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
410  return;
411  }
412  char filename[500];
413  build_filename(face->name, fs->prefix, filename, sizeof(filename));
414  add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen, filename);
415  });
416  });
417 }
418 
419 void assets_pack(const char *what, const char *filename) {
420 #define MAX_PACK 100
421  char *split[MAX_PACK];
422  char *dup = strdup_local(what);
423  size_t count = split_string(dup, split, MAX_PACK, '+');
424  if (count == 0) {
425  LOG(llevError, "Invalid pack type %s\n", what);
427  }
428  bool isTar = (count > 1) || (strcmp(split[0], "images") == 0);
429  mtar_t tar;
430  if (isTar) {
431  if (MTAR_ESUCCESS != mtar_open(&tar, filename, "w")) {
432  LOG(llevError, "Failed to open tar file %s\n", filename);
434  }
435  }
436 
437  for (size_t t = 0; t < count; t++) {
438  const char *type = split[t];
439  const char *name = nullptr;
440 
442  if (strcmp(type, "treasures") == 0) {
444  name = "crossfire.trs";
445  } else if (strcmp(type, "faces") == 0) {
446  do_pack(new FaceWriter(), manager->faces(), buf);
448  name = "crossfire.face";
449  } else if (strcmp(type, "archs") == 0) {
451  name = "crossfire.arc";
452  } else if (strcmp(type, "messages") == 0) {
454  name = "messages";
455  } else if (strcmp(type, "facesets") == 0) {
457  name = "image_info";
458  } else if (strcmp(type, "artifacts") == 0) {
460  name = "artifacts";
461  } else if (strcmp(type, "formulae") == 0) {
463  name = "formulae";
464  } else if (strcmp(type, "quests") == 0) {
465  do_pack(new QuestWriter(), manager->quests(), buf);
466  name = "crossfire.quests";
467  } else if (strcmp(type, "images") == 0) {
468  pack_images(&tar);
470  continue; // Already stored in tar.
471  } else {
472  LOG(llevError, "Invalid asset type '%s'\n", type);
474  }
475 
476  size_t length = stringbuffer_length(buf);
477  char *data = stringbuffer_finish(buf);
478 
479  if (isTar) {
480  add_to_tar(&tar, data, length, name);
481  } else {
482  FILE *out = fopen(filename, "w+");
483  if (!out) {
484  LOG(llevError, "Failed to open file '%s'\n", filename);
486  }
487  if (fwrite(static_cast<void*>(data), 1, length, out) != length) {
488  LOG(llevError, "Failed to write all data for %s!\n", filename);
489  fclose(out);
491  }
492  fclose(out);
493  }
494  free(data);
495  }
496 
497  if (isTar) {
498  if (MTAR_ESUCCESS != mtar_finalize(&tar)) {
499  LOG(llevError, "Failed to finalize tar file %s\n", filename);
501  }
502  if (MTAR_ESUCCESS != mtar_close(&tar)) {
503  LOG(llevError, "Failed to closed tar file %s\n", filename);
505  }
506  }
507  free(dup);
508 }
509 
511  manager->archetypes()->each([] (archetype *arch) {
512  object *op = &arch->clone;
513  if (op->speed < 0) {
514  op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
515  op->speed = -op->speed; // Make this always positive
516  }
517  });
518 }
519 
522 
523  quest = quest_get_by_code(code);
524  if (!quest) {
525  LOG(llevError, "quest %s required but not found!\n", code);
526  return NULL;
527  }
528  return quest;
529 }
530 
532  return manager->quests()->find(code);
533 }
534 
540 void quest_for_each(quest_op op, void *user) {
541  manager->quests()->each([&op, &user] (auto q) { op(q, user); });
542 }
543 
544 size_t quests_count(bool includeSystem) {
545  return includeSystem ? manager->quests()->count() : manager->quests()->visibleCount();
546 }
AssetsCollection::count
size_t count() const
Definition: AssetsCollection.h:80
Face
Definition: face.h:14
do_pack
static void do_pack(AssetWriter< T > *writer, AssetsCollection< T > *assets, StringBuffer *buf)
Definition: assets.cpp:333
global.h
castle_read.prefix
string prefix
Definition: castle_read.py:31
Settings::hooks_count
uint8_t hooks_count
Definition: global.h:332
settings
struct Settings settings
Definition: init.cpp:138
stringbuffer_length
size_t stringbuffer_length(StringBuffer *sb)
Definition: stringbuffer.cpp:218
GeneralMessage
Definition: book.h:44
get_formulalist
recipelist * get_formulalist(int i)
Definition: recipe.cpp:98
FormulaeWriter.h
AssetWriter.h
ArchetypeWriter.h
llevError
@ llevError
Definition: logger.h:11
ASSETS_FACESETS
#define ASSETS_FACESETS
Definition: assets.h:23
quest_for_each
void quest_for_each(quest_op op, void *user)
Definition: assets.cpp:540
ArchetypeWriter
Definition: ArchetypeWriter.h:19
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:51
AssetsManager::messages
Messages * messages()
Definition: AssetsManager.h:59
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:50
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:301
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:262
AssetsManager.h
FLAG_CONTENT_ON_GEN
#define FLAG_CONTENT_ON_GEN
Definition: define.h:365
mtar_header_t::type
unsigned type
Definition: microtar.h:43
init_regions
void init_regions(BufferReader *reader, const char *filename)
Definition: region.cpp:311
stringbuffer_new
StringBuffer * stringbuffer_new(void)
Definition: stringbuffer.cpp:57
QuestWriter.h
init_attackmess
void init_attackmess(BufferReader *reader, const char *filename)
Definition: init.cpp:570
mtar_t
Definition: microtar.h:51
MessageWriter.h
Faces::findById
const Face * findById(uint16_t id)
Definition: Faces.cpp:44
guildoracle.list
list
Definition: guildoracle.py:87
ASSETS_MESSAGES
#define ASSETS_MESSAGES
Definition: assets.h:26
mtar_header_t::size
unsigned size
Definition: microtar.h:41
AssetsManager::animations
AllAnimations * animations()
Definition: AssetsManager.h:49
find_faceset
face_sets * find_faceset(int id)
Definition: assets.cpp:328
face_op
void(* face_op)(const Face *)
Definition: assets.h:43
ArtifactWriter.h
FaceWriter
Definition: FaceWriter.h:19
FaceWriter.h
TreasureLoader
Definition: TreasureLoader.h:25
MAX_PACK
#define MAX_PACK
Settings::assets_tracker
class AssetsTracker * assets_tracker
Definition: global.h:336
find_treasurelist
treasurelist * find_treasurelist(const char *name)
Definition: assets.cpp:249
TreasureLoader.h
mtar_header_t::mtime
unsigned mtime
Definition: microtar.h:42
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
Quests::visibleCount
size_t visibleCount() const
Definition: Quests.h:24
npc_dialog.filename
filename
Definition: npc_dialog.py:99
assets_free
void assets_free()
Definition: assets.cpp:72
check_generators
static void check_generators(void)
Definition: assets.cpp:154
find_face
const Face * find_face(const char *name)
Definition: assets.cpp:282
buf
StringBuffer * buf
Definition: readable.cpp:1551
getManager
AssetsManager * getManager()
Definition: assets.cpp:305
AssetsCollection::find
T * find(const Key &name)
Definition: AssetsCollection.h:108
AssetCollector::collect
void collect(const std::string &directory)
Definition: AssetCollector.cpp:54
AnimationWriter
Definition: AnimationWriter.h:19
FacesetLoader
Definition: FacesetLoader.h:21
ASSETS_QUESTS
#define ASSETS_QUESTS
Definition: assets.h:30
quest
Definition: quest.py:1
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.cpp:76
item.q
q
Definition: item.py:32
mtar_header_t::name
char name[100]
Definition: microtar.h:44
mtar_close
int mtar_close(mtar_t *tar)
Definition: microtar.cpp:211
AnimationWriter.h
mtar_open
int mtar_open(mtar_t *tar, const char *filename, const char *mode)
Definition: microtar.cpp:177
QuestLoader
Definition: QuestLoader.h:24
recipelist
Definition: recipe.h:37
AssetsCollection
Definition: AssetsCollection.h:55
AssetsManager::treasures
Treasures * treasures()
Definition: AssetsManager.h:54
ASSETS_FACES
#define ASSETS_FACES
Definition: assets.h:21
ArchetypeLoader
Definition: ArchetypeLoader.h:22
check_formulae
void check_formulae(void)
Definition: recipe.cpp:295
microtar.h
treasurelist
Definition: treasure.h:85
split_string
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Definition: utils.cpp:473
ASSETS_ARCHETYPES
#define ASSETS_ARCHETYPES
Definition: assets.h:20
treasurelist::name
sstring name
Definition: treasure.h:86
build_filename
static void build_filename(const char *name, const char *prefix, char *dest, size_t max)
Definition: assets.cpp:360
mtar_finalize
int mtar_finalize(mtar_t *tar)
Definition: microtar.cpp:373
mtar_write_data
int mtar_write_data(mtar_t *tar, const void *data, unsigned size)
Definition: microtar.cpp:357
FacesetWriter
Definition: FacesetWriter.h:20
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:544
check_summoned
void check_summoned(void)
Definition: assets.cpp:181
navar-midane_time.data
data
Definition: navar-midane_time.py:11
Facesets::findById
face_sets * findById(int id)
Definition: Facesets.cpp:35
pack_formulae
static void pack_formulae(StringBuffer *buf)
Definition: assets.cpp:351
ArtifactWriter
Definition: ArtifactWriter.h:19
FacesetWriter.h
artifactlist
Definition: artifact.h:24
QuestWriter
Definition: QuestWriter.h:19
sstring
const typedef char * sstring
Definition: global.h:47
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:510
Settings::hooks_filename
const char * hooks_filename[20]
Definition: global.h:333
AssetCollector::addLoader
void addLoader(AssetLoader *loader)
Definition: AssetCollector.h:40
archetype
Definition: object.h:472
pack_images
static void pack_images(mtar_t *tar)
Definition: assets.cpp:406
AssetsCollection::get
T * get(const Key &name)
Definition: AssetsCollection.h:89
AssetsCollection::each
void each(std::function< void(T *)> op)
Definition: AssetsCollection.h:158
get_face_by_id
const Face * get_face_by_id(uint16_t id)
Definition: assets.cpp:315
mtar_header_t
Definition: microtar.h:38
quest_get_by_code
quest_definition * quest_get_by_code(sstring code)
Definition: assets.cpp:531
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:29
AssetsCollection::next
T * next(T *current)
Definition: AssetsCollection.h:139
image.h
get_message_from_identifier
const GeneralMessage * get_message_from_identifier(const char *identifier)
Definition: assets.cpp:324
ASSETS_REGIONS
#define ASSETS_REGIONS
Definition: assets.h:31
fatal
void fatal(enum fatal_error err)
Definition: utils.cpp:570
ASSETS_ARTIFACTS
#define ASSETS_ARTIFACTS
Definition: assets.h:27
AssetsManager::archetypes
Archetypes * archetypes()
Definition: AssetsManager.h:44
ASSETS_TREASURES
#define ASSETS_TREASURES
Definition: assets.h:24
mtar_write_header
int mtar_write_header(mtar_t *tar, const mtar_header_t *h)
Definition: microtar.cpp:323
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:278
StringBuffer
Definition: stringbuffer.cpp:25
is_valid_types_gen.found
found
Definition: is_valid_types_gen.py:39
mtar_header_t::mode
unsigned mode
Definition: microtar.h:39
check_recipes
void check_recipes()
Definition: recipe.cpp:148
quest_find_by_code
quest_definition * quest_find_by_code(sstring code)
Definition: assets.cpp:520
MessageLoader
Definition: MessageLoader.h:22
add_to_tar
static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename)
Definition: assets.cpp:383
make_face_from_files.out
out
Definition: make_face_from_files.py:75
QuestLoader.h
MTAR_TREG
@ MTAR_TREG
Definition: microtar.h:29
llevInfo
@ llevInfo
Definition: logger.h:12
Floor.t
t
Definition: Floor.py:62
MessageWriter
Definition: MessageWriter.h:19
ArtifactLoader
Definition: ArtifactLoader.h:18
stringbuffer_delete
void stringbuffer_delete(StringBuffer *sb)
Definition: stringbuffer.cpp:71
item
Definition: item.py:1
Faces.h
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:258
Animations
Definition: face.h:25
AssetCollector
Definition: AssetCollector.h:24
MTAR_ESUCCESS
@ MTAR_ESUCCESS
Definition: microtar.h:17
quest_definition
Definition: quest.h:37
find_archetype
archetype * find_archetype(const char *name)
Definition: assets.cpp:266
convert.dest
dest
Definition: convert.py:25
FormulaeWriter
Definition: FormulaeWriter.h:19
spell_mapping
const char *const spell_mapping[SPELL_MAPPINGS]
Definition: object.cpp:74
PngLoader.h
assets.h
ASSETS_PNG
#define ASSETS_PNG
Definition: assets.h:25
Settings::hooks
collectorHook hooks[20]
Definition: global.h:334
WrapperLoader
Definition: WrapperLoader.h:25
find_animation
Animations * find_animation(const char *name)
Definition: assets.cpp:274
FaceLoader.h
TreasureWriter
Definition: TreasureWriter.h:19
init_formulae
void init_formulae(BufferReader *reader, const char *filename)
Definition: recipe.cpp:169
first_artifactlist
artifactlist * first_artifactlist
Definition: init.cpp:109
ArchetypeLoader.h
FaceLoader
Definition: FaceLoader.h:23
faces_for_each
void faces_for_each(face_op op)
Definition: assets.cpp:297
TarLoader
Definition: TarLoader.h:8
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:270
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:286
assets_pack
void assets_pack(const char *what, const char *filename)
Definition: assets.cpp:419
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:340
ArtifactLoader.h
TreasureWriter.h
MessageLoader.h
assets_collect
void assets_collect(const char *datadir, int what)
Definition: assets.cpp:113
nroftreasures
size_t nroftreasures
Definition: assets.cpp:80
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2603
TarLoader.h
ArtifactWriter::write
virtual void write(const artifact *item, StringBuffer *buf)
Definition: ArtifactWriter.cpp:21
report.error
def error(pl)
Definition: report.py:43
arch_op
void(* arch_op)(archetype *)
Definition: assets.h:42
treasure
Definition: treasure.h:63
PngLoader
Definition: PngLoader.h:22
get_faces_count
size_t get_faces_count()
Definition: assets.cpp:293
face_sets
Definition: image.h:17
SPELL
@ SPELL
Definition: object.h:217
replace.current
current
Definition: replace.py:64
if
if(!(yy_init))
Definition: loader.c:2626
manager
static AssetsManager * manager
Definition: assets.cpp:60
AssetWriter
Definition: AssetWriter.h:22
FacesetLoader.h
AssetCollector.h
assets_init
void assets_init()
Definition: assets.cpp:65
assets_number_of_treasures
size_t assets_number_of_treasures()
Definition: assets.cpp:255
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:227
check_treasurelist
static void check_treasurelist(treasure *t, const treasurelist *tl)
Definition: assets.cpp:93
give.name
name
Definition: give.py:27
ASSETS_FORMULAE
#define ASSETS_FORMULAE
Definition: assets.h:28