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 <unordered_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 name has no '.', then just name.prefix
363  if (!dot) {
364  snprintf(dest, max, "%s.%s", name, prefix);
365  return;
366  }
367 
368  // filename for name.111 is name.prefix.111.png
369  memset(dest, 0, max);
370  dot++;
371 
372  snprintf(dest, max, "%.*s%s.%s.png", (int)(dot - name), name, prefix, dot);
373 }
374 
382 static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename) {
383  mtar_header_t h;
384  memset(&h, 0, sizeof(h));
385  strncpy(h.name, filename, sizeof(h.name));
386  h.size = len;
387  h.type = MTAR_TREG;
388  h.mode = 0664;
389  h.mtime = time(NULL);
390  /* Build raw header and write */
391  if (MTAR_ESUCCESS != mtar_write_header(tar, &h)) {
392  LOG(llevError, "Failed to write tar header for %s\n", filename);
394  }
395  if (MTAR_ESUCCESS != mtar_write_data(tar, data, len)) {
396  LOG(llevError, "Failed to write tar data for %s\n", filename);
398  }
399 }
400 
405 static void pack_images(mtar_t *tar) {
406  manager->faces()->each([&tar] (const auto face) {
407  manager->facesets()->each([&tar, &face] (const auto fs) {
408  if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
409  return;
410  }
411  char filename[500];
412  build_filename(face->name, fs->prefix, filename, sizeof(filename));
413  add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen, filename);
414  });
415  });
416 }
417 
418 void assets_pack(const char *what, const char *filename) {
419 #define MAX_PACK 100
420  char *split[MAX_PACK];
421  char *dup = strdup_local(what);
422  size_t count = split_string(dup, split, MAX_PACK, '+');
423  if (count == 0) {
424  LOG(llevError, "Invalid pack type %s\n", what);
426  }
427  bool isTar = (count > 1) || (strcmp(split[0], "images") == 0);
428  mtar_t tar;
429  if (isTar) {
430  if (MTAR_ESUCCESS != mtar_open(&tar, filename, "w")) {
431  LOG(llevError, "Failed to open tar file %s\n", filename);
433  }
434  }
435 
436  for (size_t t = 0; t < count; t++) {
437  const char *type = split[t];
438  const char *name = nullptr;
439 
441  if (strcmp(type, "treasures") == 0) {
443  name = "crossfire.trs";
444  } else if (strcmp(type, "faces") == 0) {
445  do_pack(new FaceWriter(), manager->faces(), buf);
447  name = "crossfire.face";
448  } else if (strcmp(type, "archs") == 0) {
450  name = "crossfire.arc";
451  } else if (strcmp(type, "messages") == 0) {
453  name = "messages";
454  } else if (strcmp(type, "facesets") == 0) {
456  name = "image_info";
457  } else if (strcmp(type, "artifacts") == 0) {
459  name = "artifacts";
460  } else if (strcmp(type, "formulae") == 0) {
462  name = "formulae";
463  } else if (strcmp(type, "quests") == 0) {
464  do_pack(new QuestWriter(), manager->quests(), buf);
465  name = "crossfire.quests";
466  } else if (strcmp(type, "images") == 0) {
467  pack_images(&tar);
469  continue; // Already stored in tar.
470  } else {
471  LOG(llevError, "Invalid asset type '%s'\n", type);
473  }
474 
475  size_t length = stringbuffer_length(buf);
476  char *data = stringbuffer_finish(buf);
477 
478  if (isTar) {
479  add_to_tar(&tar, data, length, name);
480  } else {
481  FILE *out = fopen(filename, "w+");
482  if (!out) {
483  LOG(llevError, "Failed to open file '%s'\n", filename);
485  }
486  if (fwrite(static_cast<void*>(data), 1, length, out) != length) {
487  LOG(llevError, "Failed to write all data for %s!\n", filename);
488  fclose(out);
490  }
491  fclose(out);
492  }
493  free(data);
494  }
495 
496  if (isTar) {
497  if (MTAR_ESUCCESS != mtar_finalize(&tar)) {
498  LOG(llevError, "Failed to finalize tar file %s\n", filename);
500  }
501  if (MTAR_ESUCCESS != mtar_close(&tar)) {
502  LOG(llevError, "Failed to closed tar file %s\n", filename);
504  }
505  }
506  free(dup);
507 }
508 
510  manager->archetypes()->each([] (archetype *arch) {
511  object *op = &arch->clone;
512  if (op->speed < 0) {
513  op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
514  op->speed = -op->speed; // Make this always positive
515  }
516  });
517 }
518 
521 
522  quest = quest_get_by_code(code);
523  if (!quest) {
524  LOG(llevError, "quest %s required but not found!\n", code);
525  return NULL;
526  }
527  return quest;
528 }
529 
531  return manager->quests()->find(code);
532 }
533 
539 void quest_for_each(quest_op op, void *user) {
540  manager->quests()->each([&op, &user] (auto q) { op(q, user); });
541 }
542 
543 size_t quests_count(bool includeSystem) {
544  return includeSystem ? manager->quests()->count() : manager->quests()->visibleCount();
545 }
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:139
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:539
ArchetypeWriter
Definition: ArchetypeWriter.h:19
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:58
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
if
if(!(yy_init))
Definition: loader.cpp:36428
QuestWriter.h
init_attackmess
void init_attackmess(BufferReader *reader, const char *filename)
Definition: init.cpp:572
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
check_recipes
bool check_recipes()
Definition: recipe.cpp:147
find_face
const Face * find_face(const char *name)
Definition: assets.cpp:282
buf
StringBuffer * buf
Definition: readable.cpp:1565
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
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
check_formulae
bool check_formulae(void)
Definition: recipe.cpp:292
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:543
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
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:509
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:483
pack_images
static void pack_images(mtar_t *tar)
Definition: assets.cpp:405
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:530
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:590
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
quest_find_by_code
quest_definition * quest_find_by_code(sstring code)
Definition: assets.cpp:519
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:382
make_face_from_files.out
out
Definition: make_face_from_files.py:81
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
sstring
const typedef char * sstring
Definition: sstring.h:2
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:166
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:418
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:2606
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:219
replace.current
current
Definition: replace.py:64
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