15 #include "../ResourcesManager.h"
16 #include "../CREPixmap.h"
19 #include "ArchetypeLoader.h"
20 #include "AssetsManager.h"
33 StringBuffer* dump = stringbuffer_new();
35 char*
final = stringbuffer_finish(dump);
40 myRaw.replace(0, 4,
"Object");
42 if (
more != std::string::npos) {
83 while (index > 0 && part) {
100 while (part !=
child && part) {
116 auto other = getManager()->treasures()->find(t->name);
130 if (!arch->clone.randomitems || !fleshFace)
133 std::vector<const archetype *> sources;
134 getManager()->archetypes()->each([&sources, &fleshFace] (
const archetype * candidate) {
135 if (candidate->clone.face == fleshFace)
136 sources.push_back(candidate);
139 for (
auto source : sources) {
148 auto face =
dynamic_cast<const FaceWrapper *
>(asset);
149 if (face !=
nullptr) {
150 auto key = object_get_value(&
myWrappedItem->clone,
"identified_face");
151 if (face->wrappedItem() ==
myWrappedItem->clone.face || (key && strcmp(face->wrappedItem()->name, key) == 0)) {
156 if (strncmp(
myWrappedItem->name, face->wrappedItem()->name, len) == 0 && face->wrappedItem()->name[len] ==
'_') {
157 auto flesh = getManager()->faces()->find(face->wrappedItem()->name + len + 1);
168 auto key = object_get_value(&
myWrappedItem->clone,
"identified_animation");
169 if (anim->wrappedItem() ==
myWrappedItem->clone.animation || (key && strcmp(anim->wrappedItem()->name, key) == 0)) {
180 if (
wrappedItem()->clone.other_arch == arch->wrappedItem()) {
184 sstring death_anim = NULL;
185 if ((death_anim = object_get_value(&
myWrappedItem->clone,
"death_animation")) && strcmp(death_anim, arch->wrappedItem()->name) == 0) {
186 hint =
"death animation";
190 auto sound =
dynamic_cast<const SoundFile *
>(asset);
195 bool uses = std::any_of(sound->events().cbegin(), sound->events().cend(), [
this] (
const std::string &event) {
196 return event == myWrappedItem->name || event == myWrappedItem->clone.name;
208 std::function<bool(
const treasure *item)> ci = [&] (
const treasure *item) {
212 if (item->next_yes && ci(item->next_yes)) {
215 if (item->next_no && ci(item->next_no)) {
218 if (item->next && ci(item->next)) {
223 auto cl = [&] (
const treasurelist *item) {
return item->items && ci(item->items); };
224 return getManager()->treasures()->first(cl) !=
nullptr;
228 return QString::fromStdString(
myRaw);
234 BufferReader *br = bufferreader_init_from_memory(
nullptr,
myRaw.data(),
myRaw.length());
237 ArchetypeLoader loader(getManager()->archetypes(),
nullptr);
238 loader.load(br, origin);
239 bufferreader_destroy(br);