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 <vector>
41 #include <string>
42 #include <set>
43 #include <algorithm>
44 #include <map>
45 #include <memory>
46 
47 #include "AssetWriter.h"
48 #include "TreasureWriter.h"
49 #include "FaceWriter.h"
50 #include "AnimationWriter.h"
51 #include "ArchetypeWriter.h"
52 #include "MessageWriter.h"
53 #include "image.h"
54 #include "FacesetWriter.h"
55 #include "ArtifactWriter.h"
56 #include "FormulaeWriter.h"
57 #include "QuestWriter.h"
58 
59 #include "microtar.h"
60 #include "TarLoader.h"
61 
62 static AssetsManager *manager = nullptr;
63 
67 void assets_init() {
68  manager = new AssetsManager();
69 }
70 
74 void assets_free() {
75  delete manager;
76  manager = nullptr;
77 }
78 
82 size_t nroftreasures = 0;
83 
95 static void check_treasurelist(treasure *t, const treasurelist *tl) {
96  if (t->item == NULL && t->name == NULL)
97  LOG(llevError, "Treasurelist %s has element with no name or archetype\n", tl->name);
98  if (t->chance >= 100 && t->next_yes && (t->next || t->next_no))
99  LOG(llevError, "Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", tl->name);
100  if (t->name && strcmp(t->name, "NONE"))
101  find_treasurelist(t->name);
102  if (t->next)
103  check_treasurelist(t->next, tl);
104  if (t->next_yes)
105  check_treasurelist(t->next_yes, tl);
106  if (t->next_no)
107  check_treasurelist(t->next_no, tl);
108 }
109 
115 void assets_collect(const char* datadir, int what) {
116  LOG(llevInfo, "Starting to collect assets from %s\n", datadir);
117 
118  auto tracker = static_cast<AssetsTracker *>(settings.archetypes_tracker);
119 
120  AssetCollector collector;
121  if (what & ASSETS_TREASURES)
122  collector.addLoader(new TreasureLoader(manager->treasures(), manager->archetypes(), tracker));
123  if (what & ASSETS_ARCHETYPES)
124  collector.addLoader(new ArchetypeLoader(manager->archetypes(), tracker));
125  if (what & ASSETS_PNG)
126  collector.addLoader(new PngLoader(manager->faces(), manager->facesets()));
127  if (what & ASSETS_FACESETS)
128  collector.addLoader(new FacesetLoader(manager->facesets()));
129  if (what & ASSETS_FACES)
130  collector.addLoader(new FaceLoader(manager->faces(), manager->animations()));
131  if (what & ASSETS_MESSAGES)
132  collector.addLoader(new MessageLoader(manager->messages(), tracker));
133  if (what & ASSETS_ARTIFACTS) {
134  collector.addLoader(new ArtifactLoader(tracker));
135  }
136  if (what & ASSETS_FORMULAE) {
137  collector.addLoader(new WrapperLoader("/formulae", init_formulae));
138  collector.addLoader(new WrapperLoader(".formulae", init_formulae));
139  }
140  if (what & ASSETS_ATTACK_MESSAGES)
141  collector.addLoader(new WrapperLoader("/attackmess", init_attackmess));
142  if (what & ASSETS_QUESTS)
143  collector.addLoader(new QuestLoader(manager->quests(), manager->faces(), tracker));
144  if (what & ASSETS_REGIONS)
145  collector.addLoader(new WrapperLoader("regions.reg", init_regions));
146  for (uint8_t hook = 0; hook < settings.hooks_count; hook++) {
147  collector.addLoader(new WrapperLoader(settings.hooks_filename[hook], settings.hooks[hook]));
148  }
149  collector.addLoader(new TarLoader(&collector));
150  collector.collect(datadir);
151 
152  LOG(llevInfo, "Finished collecting assets from %s\n", datadir);
153 }
154 
158 static void check_generators(void) {
159  int abort = 0;
160 
161  manager->archetypes()->each([&abort] (const auto& arch) {
162  if (!QUERY_FLAG(&arch->clone, FLAG_GENERATOR))
163  return;
164 
165  if (!QUERY_FLAG(&arch->clone, FLAG_CONTENT_ON_GEN) && arch->clone.other_arch == NULL) {
166  LOG(llevError, "Fatal: %s is generator without content_on_gen but lacks other_arch.\n", arch->name);
167  abort = 1;
168  return;
169  }
170  if (QUERY_FLAG(&arch->clone, FLAG_CONTENT_ON_GEN) && arch->clone.inv == NULL) {
171  LOG(llevError, "Fatal: %s is generator with content_on_gen but lacks inventory.\n", arch->name);
172  abort = 1;
173  return;
174  }
175  });
176 
177  if (abort)
179 }
180 
185 void check_summoned(void) {
186  manager->archetypes()->each([] (const auto& arch) {
187  if (arch->clone.type == SPELL && arch->clone.subtype == SP_SUMMON_GOLEM && arch->clone.other_arch) {
188  if (arch->clone.other_arch->clone.move_type == 0) {
189  LOG(llevError, "Summonable archetype %s [%s] has no move_type defined!\n", arch->clone.other_arch->name, arch->clone.other_arch->clone.name);
190  fatal(SEE_LAST_ERROR);
191  }
192  }
193  });
194 }
195 
202 static void check_spells(void) {
203  int abort = 0;
204 
205  manager->archetypes()->each([&abort] (const auto& arch) {
206  if (arch->clone.type == SPELL && arch->clone.skill) {
207  auto skill = manager->archetypes()->first([&arch] (const archetype *skill) {
208  return skill->clone.type == SKILL && arch->clone.skill == skill->clone.name;
209  });
210  if (!skill) {
211  LOG(llevError, "Spell %s has improper associated skill %s\n", arch->name, arch->clone.skill);
212  abort = 1;
213  }
214  }
215  });
216 
217  for (size_t i = 0; i < sizeof(spell_mapping) / sizeof(spell_mapping[0]); i++) {
219  LOG(llevError, "Unable to find spell mapping %s (%zu)\n", spell_mapping[i], i);
220  abort = 1;
221  }
222  }
223 
224  if (abort)
226 }
227 
233  check_spells();
234  check_summoned();
235  manager->treasures()->each([] (auto list) {
236  if (list->items) {
237  check_treasurelist(list->items, list);
238  }
239  });
240  check_recipes();
241  check_formulae();
242 }
243 
254  if (!strcmp(name, "none"))
255  return NULL;
256  return manager->treasures()->get(name);
257 }
258 
260  return nroftreasures;
261 }
263  return manager->treasures()->count();
264 }
265 
267  return manager->archetypes()->next(current);
268 }
269 
271  return manager->archetypes()->get(name);
272 }
273 
275  return manager->archetypes()->find(name);
276 }
277 
279  return manager->animations()->get(name);
280 }
281 
283  return manager->animations()->find(name);
284 }
285 
286 const Face *find_face(const char *name) {
287  return manager->faces()->get(name);
288 }
289 
290 const Face *try_find_face(const char *name, const Face *error) {
291  auto found = manager->faces()->find(name);
292  if (found)
293  return found;
294  return error;
295 }
296 
297 size_t get_faces_count() {
298  return manager->faces()->count();
299 }
300 
302  manager->faces()->each(*op);
303 }
304 
306  manager->archetypes()->each(*op);
307 }
308 
310  return manager;
311 }
312 
319 const Face *get_face_by_id(uint16_t id) {
320  return manager->faces()->findById(id);
321 }
322 
328 const GeneralMessage *get_message_from_identifier(const char *identifier) {
329  return manager->messages()->find(identifier);
330 }
331 
333  return manager->facesets()->findById(id);
334 }
335 
336 template<class T>
337 static void do_pack(AssetWriter<T> *writer, AssetsCollection<T> *assets, StringBuffer *buf) {
338  assets->each([writer, buf] (T *asset) {
339  writer->write(asset, buf);
340  });
341  delete writer;
342 }
343 
345  ArtifactWriter writer;
347  while (list) {
348  auto item = list->items;
349  while (item) {
350  writer.write(item, buf);
351  item = item->next;
352  }
353  list = list->next;
354  }
355 }
356 
358  FormulaeWriter writer;
360  while (list) {
361  writer.write(list, buf);
362  list = list->next;
363  }
364 }
365 
366 static void build_filename(const char *name, const char *prefix, char *dest, size_t max) {
367  auto dot = strrchr(name, '.');
368  if (!dot) {
369  snprintf(dest, max, "%s.%s", name, prefix);
370  return;
371  }
372  memset(dest, 0, max);
373  dot++;
374 
375  memcpy(dest, name, dot - name);
376  strncat(dest, prefix, max);
377  strncat(dest, ".", max);
378  strncat(dest, dot, max);
379  strncat(dest, ".png", max);
380 }
381 
389 static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename) {
390  mtar_header_t h;
391  memset(&h, 0, sizeof(h));
392  strncpy(h.name, filename, sizeof(h.name));
393  h.size = len;
394  h.type = MTAR_TREG;
395  h.mode = 0664;
396  h.mtime = time(NULL);
397  /* Build raw header and write */
398  if (MTAR_ESUCCESS != mtar_write_header(tar, &h)) {
399  LOG(llevError, "Failed to write tar header for %s\n", filename);
401  }
402  if (MTAR_ESUCCESS != mtar_write_data(tar, data, len)) {
403  LOG(llevError, "Failed to write tar data for %s\n", filename);
405  }
406 }
407 
412 static void pack_images(mtar_t *tar) {
413  manager->faces()->each([&tar] (const auto face) {
414  manager->facesets()->each([&tar, &face] (const auto fs) {
415  if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
416  return;
417  }
418  char filename[500];
419  build_filename(face->name, fs->prefix, filename, sizeof(filename));
420  add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen, filename);
421  });
422  });
423 }
424 
425 void assets_pack(const char *what, const char *filename) {
426 #define MAX_PACK 100
427  char *split[MAX_PACK];
428  char *dup = strdup_local(what);
429  size_t count = split_string(dup, split, MAX_PACK, '+');
430  if (count == 0) {
431  LOG(llevError, "Invalid pack type %s\n", what);
433  }
434  bool isTar = (count > 1) || (strcmp(split[0], "images") == 0);
435  mtar_t tar;
436  if (isTar) {
437  if (MTAR_ESUCCESS != mtar_open(&tar, filename, "w")) {
438  LOG(llevError, "Failed to open tar file %s\n", filename);
440  }
441  }
442 
443  for (size_t t = 0; t < count; t++) {
444  const char *type = split[t];
445  const char *name = nullptr;
446 
448  if (strcmp(type, "treasures") == 0) {
450  name = "crossfire.trs";
451  } else if (strcmp(type, "faces") == 0) {
452  do_pack(new FaceWriter(), manager->faces(), buf);
454  name = "crossfire.face";
455  } else if (strcmp(type, "archs") == 0) {
457  name = "crossfire.arc";
458  } else if (strcmp(type, "messages") == 0) {
460  name = "messages";
461  } else if (strcmp(type, "facesets") == 0) {
463  name = "image_info";
464  } else if (strcmp(type, "artifacts") == 0) {
466  name = "artifacts";
467  } else if (strcmp(type, "formulae") == 0) {
469  name = "formulae";
470  } else if (strcmp(type, "quests") == 0) {
471  do_pack(new QuestWriter(), manager->quests(), buf);
472  name = "crossfire.quests";
473  } else if (strcmp(type, "images") == 0) {
474  pack_images(&tar);
476  continue; // Already stored in tar.
477  } else {
478  LOG(llevError, "Invalid asset type '%s'\n", type);
480  }
481 
482  size_t length = stringbuffer_length(buf);
483  char *data = stringbuffer_finish(buf);
484 
485  if (isTar) {
486  add_to_tar(&tar, data, length, name);
487  } else {
488  FILE *out = fopen(filename, "w+");
489  if (!out) {
490  LOG(llevError, "Failed to open file '%s'\n", filename);
492  }
493  if (fwrite(static_cast<void*>(data), 1, length, out) != length) {
494  LOG(llevError, "Failed to write all data for %s!\n", filename);
495  fclose(out);
497  }
498  fclose(out);
499  }
500  free(data);
501  }
502 
503  if (isTar) {
504  if (MTAR_ESUCCESS != mtar_finalize(&tar)) {
505  LOG(llevError, "Failed to finalize tar file %s\n", filename);
507  }
508  if (MTAR_ESUCCESS != mtar_close(&tar)) {
509  LOG(llevError, "Failed to closed tar file %s\n", filename);
511  }
512  }
513  free(dup);
514 }
515 
517  manager->archetypes()->each([] (archetype *arch) {
518  object *op = &arch->clone;
519  if (op->speed < 0) {
520  op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
521  op->speed = -op->speed; // Make this always positive
522  }
523  });
524 }
525 
528 
529  quest = quest_get_by_code(code);
530  if (!quest) {
531  LOG(llevError, "quest %s required but not found!\n", code);
532  return NULL;
533  }
534  return quest;
535 }
536 
538  return manager->quests()->find(code);
539 }
540 
546 void quest_for_each(quest_op op, void *user) {
547  manager->quests()->each([&op, &user] (auto q) { op(q, user); });
548 }
549 
550 size_t quests_count(bool includeSystem) {
551  return includeSystem ? manager->quests()->count() : manager->quests()->visibleCount();
552 }
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:337
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:97
FormulaeWriter.h
AssetWriter.h
ArchetypeWriter.h
Settings::archetypes_tracker
void * archetypes_tracker
Definition: global.h:336
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:546
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:51
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:305
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:266
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:315
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:577
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:332
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
find_treasurelist
treasurelist * find_treasurelist(const char *name)
Definition: assets.cpp:253
TreasureLoader.h
mtar_header_t::mtime
unsigned mtime
Definition: microtar.h:42
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
treasureliststruct::name
sstring name
Definition: treasure.h:86
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:74
check_generators
static void check_generators(void)
Definition: assets.cpp:158
find_face
const Face * find_face(const char *name)
Definition: assets.cpp:286
buf
StringBuffer * buf
Definition: readable.cpp:1611
getManager
AssetsManager * getManager()
Definition: assets.cpp:309
treasurestruct
Definition: treasure.h:63
AssetsCollection::find
T * find(const Key &name)
Definition: AssetsCollection.h:108
AssetCollector::collect
void collect(const std::string &directory)
Definition: AssetCollector.cpp:55
archt
Definition: object.h:472
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
AssetsTracker
Definition: AssetsTracker.h:26
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
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:294
microtar.h
split_string
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Definition: utils.cpp:483
ASSETS_ARCHETYPES
#define ASSETS_ARCHETYPES
Definition: assets.h:20
build_filename
static void build_filename(const char *name, const char *prefix, char *dest, size_t max)
Definition: assets.cpp:366
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:550
check_summoned
void check_summoned(void)
Definition: assets.cpp:185
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:357
ArtifactWriter
Definition: ArtifactWriter.h:19
FacesetWriter.h
artifactliststruct
Definition: artifact.h:26
QuestWriter
Definition: QuestWriter.h:19
sstring
const typedef char * sstring
Definition: global.h:43
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:516
Settings::hooks_filename
const char * hooks_filename[20]
Definition: global.h:333
AssetCollector::addLoader
void addLoader(AssetLoader *loader)
Definition: AssetCollector.h:40
pack_images
static void pack_images(mtar_t *tar)
Definition: assets.cpp:412
AssetsCollection::get
T * get(const Key &name)
Definition: AssetsCollection.h:89
recipeliststruct
Definition: recipe.h:37
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:319
mtar_header_t
Definition: microtar.h:38
quest_get_by_code
quest_definition * quest_get_by_code(sstring code)
Definition: assets.cpp:537
AssetsManager::facesets
Facesets * facesets()
Definition: AssetsManager.h:65
check_spells
static void check_spells(void)
Definition: assets.cpp:202
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:328
ASSETS_REGIONS
#define ASSETS_REGIONS
Definition: assets.h:31
fatal
void fatal(enum fatal_error err)
Definition: utils.cpp:580
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:282
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:147
quest_find_by_code
quest_definition * quest_find_by_code(sstring code)
Definition: assets.cpp:526
MessageLoader
Definition: MessageLoader.h:22
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:389
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:262
AssetCollector
Definition: AssetCollector.h:24
MTAR_ESUCCESS
@ MTAR_ESUCCESS
Definition: microtar.h:17
quest_definition
Definition: quest.h:38
find_archetype
archetype * find_archetype(const char *name)
Definition: assets.cpp:270
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:278
FaceLoader.h
TreasureWriter
Definition: TreasureWriter.h:19
init_formulae
void init_formulae(BufferReader *reader, const char *filename)
Definition: recipe.cpp:168
first_artifactlist
artifactlist * first_artifactlist
Definition: init.cpp:109
ArchetypeLoader.h
FaceLoader
Definition: FaceLoader.h:22
faces_for_each
void faces_for_each(face_op op)
Definition: assets.cpp:301
TarLoader
Definition: TarLoader.h:8
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:274
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:290
assets_pack
void assets_pack(const char *what, const char *filename)
Definition: assets.cpp:425
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:344
ArtifactLoader.h
TreasureWriter.h
MessageLoader.h
assets_collect
void assets_collect(const char *datadir, int what)
Definition: assets.cpp:115
nroftreasures
size_t nroftreasures
Definition: assets.cpp:82
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2671
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
PngLoader
Definition: PngLoader.h:22
get_faces_count
size_t get_faces_count()
Definition: assets.cpp:297
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:62
AssetWriter
Definition: AssetWriter.h:22
FacesetLoader.h
AssetCollector.h
assets_init
void assets_init()
Definition: assets.cpp:67
assets_number_of_treasures
size_t assets_number_of_treasures()
Definition: assets.cpp:259
treasureliststruct
Definition: treasure.h:85
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:231
check_treasurelist
static void check_treasurelist(treasure *t, const treasurelist *tl)
Definition: assets.cpp:95
give.name
name
Definition: give.py:27
ASSETS_FORMULAE
#define ASSETS_FORMULAE
Definition: assets.h:28