Crossfire Server, Trunk
CREMapInformationManager.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 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 
13 #include <QtConcurrent/QtConcurrent>
14 
16 #include "CRESettings.h"
17 #include "MessageManager.h"
18 #include "MessageFile.h"
20 #include "scripts/ScriptFile.h"
21 #include "random_maps/RandomMap.h"
22 
23 extern "C" {
24 #include "global.h"
25 }
26 #include "assets.h"
27 #include "AssetsManager.h"
28 
29 const char* eventNames[NR_EVENTS] = {
30  "EVENT_NONE",
31  "EVENT_APPLY",
32  "EVENT_ATTACKED",
33  "EVENT_DEATH",
34  "EVENT_DROP",
35  "EVENT_PICKUP",
36  "EVENT_SAY",
37  "EVENT_STOP",
38  "EVENT_TIME",
39  "EVENT_THROW",
40  "EVENT_TRIGGER",
41  "EVENT_CLOSE",
42  "EVENT_TIMER",
43  "EVENT_DESTROY",
44  "EVENT_BORN",
45  "EVENT_CLOCK",
46  "EVENT_CRASH",
47  "EVENT_PLAYER_DEATH",
48  "EVENT_GKILL",
49  "EVENT_LOGIN",
50  "EVENT_LOGOUT",
51  "EVENT_MAPENTER",
52  "EVENT_MAPLEAVE",
53  "EVENT_MAPRESET",
54  "EVENT_REMOVE",
55  "EVENT_SHOUT",
56  "EVENT_TELL",
57  "EVENT_MUZZLE",
58  "EVENT_KICK",
59  "EVENT_MAPUNLOAD",
60  "EVENT_MAPLOAD",
61  "EVENT_USER",
62  "EVENT_SELLING",
63  "EVENT_ATTACKS",
64  "EVENT_BOUGHT",
65  "EVENT_MAPREADY",
66 };
67 
68 CREMapInformationManager::CREMapInformationManager(QObject* parent, MessageManager* messageManager, ScriptFileManager* scriptManager) : QObject(parent)
69 {
70  Q_ASSERT(messageManager != NULL);
71  Q_ASSERT(scriptManager != NULL);
72  myMessageManager = messageManager;
73  myScriptManager = scriptManager;
74  connect(this, SIGNAL(addHook(const QString &, HookInformation *)), scriptManager, SLOT(addHook(const QString &, HookInformation *)));
75 }
76 
78 {
79  qDeleteAll(myInformation);
80 }
81 
83 {
84  return myWorker.isFinished();
85 }
86 
88 {
89  if (myWorker.isRunning())
90  return;
91 
92  myWorker = QtConcurrent::run(this, &CREMapInformationManager::browseMaps);
93 }
94 
95 void CREMapInformationManager::checkItem(const object* item, CREMapInformation* information, const object* env)
96 {
97  archetype *arch = find_archetype(item->arch->name);
98  if (arch != NULL) {
99  addArchetypeUse(arch->name, information);
100  information->addArchetype(arch->name);
101  if (item->face && item->face != arch->clone.face)
102  {
103  addFaceUse(item->face->name, information);
104  information->addFace(item->face->name);
105  }
106  if (item->animation && item->animation != arch->clone.animation)
107  {
108  addAnimationUse(item->animation->name, information);
109  information->addAnimation(item->animation->name);
110  }
111  }
112  checkEvent(item, information, env);
113 
114  if (item->type == EXIT || item->type == TELEPORTER || item->type == PLAYER_CHANGER) {
115  char ep[500];
116  const char *start;
117 
118  if (!item->slaying) {
119  ep[0] = '\0';
120  /*if (warn_no_path)
121  printf(" exit without any path at %d, %d on %s\n", item->x, item->y, info->path);*/
122  } else {
123  memset(ep, 0, 500);
124  if (strcmp(item->slaying, "/!"))
125  strcpy(ep, EXIT_PATH(item));
126  else {
127  if (!item->msg) {
128  //printf(" random map without message in %s at %d, %d\n", info->path, item->x, item->y);
129  } else {
130  /* Some maps have a 'exit_on_final_map' flag, ignore it. */
131  start = strstr(item->msg, "\nfinal_map ");
132  if (!start && strncmp(item->msg, "final_map", strlen("final_map")) == 0)
133  /* Message start is final_map, nice */
134  start = item->msg;
135  if (start) {
136  const char *end = strchr(start+1, '\n');
137 
138  start += strlen("final_map")+2;
139  strncpy(ep, start, end-start);
140  }
141 
142  information->addRandomMap(new RandomMap(information, env->x, env->y, item->msg));
143  }
144  }
145 
146  if (strlen(ep)) {
147  char exit_path[500], tmppath[MAX_BUF];
148  path_combine_and_normalize(env->map->path, ep, exit_path, 500);
149  create_pathname(exit_path, tmppath, MAX_BUF);
150  if (!QFileInfo(tmppath).exists()) {
151  printf(" map %s doesn't exist in map %s, at %d, %d.\n", ep, env->map->path, env->x, env->y);
152  } else {
153  QString exit = exit_path;
154  if (!myToProcess.contains(exit))
155  myToProcess.append(exit);
156 
158  Q_ASSERT(other);
159  other->addAccessedFrom(exit);
160  information->addExitTo(exit_path);
161 
162 #if 0
163  link = get_map_info(exit_path);
164  add_map(link, &info->exits_from);
165  add_map(info, &link->exits_to);
166 
167  if (do_regions_link) {
168  mapstruct *link = ready_map_name(exit_path, 0);
169 
170  if (link && link != m) {
171  /* no need to link a map with itself. Also, if the exit points to the same map, we don't
172  * want to reset it. */
173  add_region_link(m, link, item->arch->clone.name);
174  link->reset_time = 1;
175  link->in_memory = MAP_IN_MEMORY;
176  delete_map(link);
177  }
178  }
179 #endif
180  }
181  }
182  }
183  }
184 
186  information->setExperience(information->experience() + item->stats.exp);
187 
189  {
190  checkItem(inv, information, env);
191  } FOR_INV_FINISH();
192 }
193 
194 void CREMapInformationManager::process(const QString& path2)
195 {
196  /*
197  don't ask why, but the variable gets apparently destroyed on the myToProcess.append() when it reallocated values...
198  so keep a copy to avoid messes
199  */
200  QString path(path2);
201 
202  if (myCancelled)
203  return;
204 
205  emit browsingMap(path);
206 // qDebug() << "processing" << path;
208 
209  char tmppath[MAX_BUF];
210  create_pathname(path.toLatin1(), tmppath, MAX_BUF);
211  QFileInfo info(tmppath);
212 
213  if (!info.exists())
214  {
215 // qDebug() << "non existant map" << tmppath;
216  return;
217  }
218 
219  if (!information->mapTime().isNull() && information->mapTime() >= info.lastModified())
220  {
221  foreach(QString exit, information->exitsTo())
222  {
223  if (!myToProcess.contains(exit))
224  myToProcess.append(exit);
225  }
226 // qDebug() << "skipping " << tmppath;
227  return;
228  }
229 
230  /* remove scripts to avoid duplications */
231  myScriptManager->removeMap(information);
232 
234 // qDebug() << "processing" << path << information->mapTime() << info.lastModified();
235  information->setName(m->name);
236  information->setMapTime(info.lastModified());
237  if (m->region != NULL)
238  information->setRegion(m->region->name);
239  else
240  information->setRegion("wilderness");
241  information->setDifficulty(m->difficulty);
242  m->difficulty = 0;
244  m->difficulty = information->difficulty();
245  if (m->background_music)
246  information->setBackgroundMusic(m->background_music);
247 
248  information->setShopGreed(m->shopgreed);
249  if (m->shopitems != NULL)
250  {
251  for (int i = 0; i < m->shopitems[0].index; i++)
252  {
253  information->shopItems().insert(QString(m->shopitems[i].name == NULL ? "*" : m->shopitems[i].name), m->shopitems[i].strength);
254  }
255  }
256  if (m->shoprace != NULL)
257  information->setShopRace(m->shoprace);
258  information->setShopMin(m->shopmin);
259  information->setShopMax(m->shopmax);
260 
261  char exit_path[500];
262 
263  for (int x = 0; x < 4; x++)
264  if (m->tile_path[x] != NULL) {
265  path_combine_and_normalize(m->path, m->tile_path[x], exit_path, sizeof(exit_path));
266  create_pathname(exit_path, tmppath, MAX_BUF);
267  if (!QFileInfo(tmppath).exists()) {
268  printf(" map %s doesn't exist in map %s, for tile %d.\n", exit_path, m->path, x);
269  }
270 
271  QString exit = exit_path;
272  if (!myToProcess.contains(exit))
273  myToProcess.append(exit);
274 
276  Q_ASSERT(other);
277  other->addAccessedFrom(path);
278  information->addExitTo(exit_path);
279  }
280 
281  for (int x = MAP_WIDTH(m)-1; x >= 0; x--)
282  {
283  for (int y = MAP_HEIGHT(m)-1; y >= 0; y--)
284  {
285  FOR_MAP_PREPARE(m, x, y, item)
286  {
287  checkItem(item, information, item);
288  } FOR_MAP_FINISH();
289  }
290  }
291 
292  QMutexLocker lock(&myLock);
293  if (m->region == NULL)
294  qDebug() << "map without region" << m->name << m->path;
295  myExperience[m->region ? m->region->name : "(undefined)"] += information->experience();
296 
297  m->reset_time = 1;
298  m->in_memory = MAP_IN_MEMORY;
299  delete_map(m);
300 }
301 
303 {
304  qDeleteAll(myInformation);
305  myArchetypeUse.clear();
306 
307  loadCache();
308 
309  myCancelled = false;
310  myCurrentMap = 0;
311  myToProcess.clear();
312  myToProcess.append(QString(first_map_path));
313 
314  /* try to find race-specific start maps */
315  if (first_map_ext_path[0] != 0)
316  {
317  getManager()->archetypes()->each([this] (archetype *arch)
318  {
319  if (arch->clone.type == PLAYER)
320  {
321  char path[MAX_BUF], name[MAX_BUF];
322  snprintf(name, sizeof(name), "%s/%s", first_map_ext_path, arch->name);
323  create_pathname(name, path, sizeof(path));
324  if (QFileInfo(path).exists()) {
325  myToProcess.append(name);
326  }
327  }
328  });
329  }
330 
331  /* Add style maps */
332  recurseStyleDirectory("styles");
333 
334  while (myCurrentMap < myToProcess.size())
335  {
336  process(myToProcess[myCurrentMap]);
337  myCurrentMap++;
338  if (myCancelled)
339  break;
340  }
341 
342  storeCache();
343 
344  for (auto map : myInformation) {
345  emit mapAdded(map);
346  }
347 
348  emit finished();
349 
351  qDebug() << "experience repartition:";
352  foreach(QString region, myExperience.keys())
353  {
354  qDebug() << region << myExperience[region];
355  }
356 
357  qDebug() << myToProcess.size() << "maps processed";
358 }
359 
361 {
362  myCancelled = true;
363  myWorker.waitForFinished();
364 }
365 
366 QList<CREMapInformation*> CREMapInformationManager::allMaps()
367 {
368  QMutexLocker lock(&myLock);
369  return myInformation.values();
370 }
371 
373 {
374  QMutexLocker lock(&myLock);
375  return myArchetypeUse.values(arch->name);
376 }
377 
378 QList<CREMapInformation*> CREMapInformationManager::getFaceUse(const Face* face)
379 {
380  QMutexLocker lock(&myLock);
381  return myFaceUse.values(face->name);
382 }
383 
384 QList<CREMapInformation*> CREMapInformationManager::getAnimationUse(const Animations* animation)
385 {
386  QMutexLocker lock(&myLock);
387  return myAnimationUse.values(animation->name);
388 }
389 
391 {
392  QMutexLocker lock(&myLock);
393  return myQuestUse.values(quest->quest_code);
394 }
395 
397 {
398  Q_ASSERT(myInformation.isEmpty());
399 
401  QFile file(settings.mapCacheDirectory() + QDir::separator() + "maps_cache.xml");
402  file.open(QFile::ReadOnly);
403 
404  QXmlStreamReader reader(&file);
405  bool hasMaps = false;
406  CREMapInformation* map = NULL;
407 
408  while (!reader.atEnd())
409  {
410  reader.readNext();
411 
412  if (reader.isStartElement() && reader.name() == "maps")
413  {
414  int version = reader.attributes().value("version").toString().toInt();
415  if (version < 1)
416  return;
417  hasMaps = true;
418  continue;
419  }
420 
421  if (!hasMaps)
422  continue;
423 
424  if (reader.isStartElement() && reader.name() == "map")
425  {
426  map = new CREMapInformation();
427  continue;
428  }
429  if (reader.isStartElement() && reader.name() == "path")
430  {
431  QString path = reader.readElementText();
432  map->setPath(path);
433  Q_ASSERT(!myInformation.contains(path));
435  continue;
436  }
437  if (reader.isStartElement() && reader.name() == "name")
438  {
439  map->setName(reader.readElementText());
440  continue;
441  }
442  if (reader.isStartElement() && reader.name() == "lastModified")
443  {
444  QString date = reader.readElementText();
445  map->setMapTime(QDateTime::fromString(date, Qt::ISODate));
446  continue;
447  }
448  if (reader.isStartElement() && reader.name() == "difficulty")
449  {
450  map->setDifficulty(reader.readElementText().toInt());
451  }
452  if (reader.isStartElement() && reader.name() == "computedDifficulty")
453  {
454  map->setComputedDifficulty(reader.readElementText().toInt());
455  }
456  if (reader.isStartElement() && reader.name() == "experience")
457  {
458  map->setExperience(reader.readElementText().toLongLong());
459  }
460  if (reader.isStartElement() && reader.name() == "region")
461  {
462  map->setRegion(reader.readElementText());
463  }
464  if (reader.isStartElement() && reader.name() == "arch")
465  {
466  QString arch = reader.readElementText();
467  map->addArchetype(arch);
469  continue;
470  }
471  if (reader.isStartElement() && reader.name() == "face")
472  {
473  QString face = reader.readElementText();
474  map->addFace(face);
475  addFaceUse(face, map);
476  continue;
477  }
478  if (reader.isStartElement() && reader.name() == "animation")
479  {
480  QString anim = reader.readElementText();
481  map->addAnimation(anim);
483  continue;
484  }
485  if (reader.isStartElement() && reader.name() == "exitTo")
486  {
487  QString path = reader.readElementText();
488  map->addExitTo(path);
489  continue;
490  }
491  if (reader.isStartElement() && reader.name() == "accessedFrom")
492  {
493  QString path = reader.readElementText();
494  map->addAccessedFrom(path);
495  continue;
496  }
497  if (reader.isStartElement() && reader.name() == "messageFile")
498  {
499  QString file = reader.readElementText();
500  map->addMessage(file);
502  if (message != NULL)
503  message->maps().append(map);
504  continue;
505  }
506  if (reader.isStartElement() && reader.name() == "quest")
507  {
508  QString code = reader.readElementText();
509  map->addQuest(code);
510  addQuestUse(code, map);
511  continue;
512  }
513  if (reader.isStartElement() && reader.name() == "shopItem")
514  {
515  QString item = reader.attributes().value("name").toString();
516  int strength = reader.readElementText().toInt();
517  map->shopItems()[item] = strength;
518  }
519  if (reader.isStartElement() && reader.name() == "shopGreed")
520  {
521  double greed = reader.readElementText().toDouble();
522  map->setShopGreed(greed);
523  }
524  if (reader.isStartElement() && reader.name() == "shopRace")
525  {
526  map->setShopRace(reader.readElementText());
527  }
528  if (reader.isStartElement() && reader.name() == "shopMin")
529  {
530  quint64 min = reader.readElementText().toULongLong();
531  map->setShopMin(min);
532  }
533  if (reader.isStartElement() && reader.name() == "shopMax")
534  {
535  quint64 max = reader.readElementText().toULongLong();
536  map->setShopMax(max);
537  }
538  if (reader.isStartElement() && reader.name() == "script")
539  {
540  int x = reader.attributes().value("x").toString().toInt();
541  int y = reader.attributes().value("x").toString().toInt();
542  QString item = reader.attributes().value("itemName").toString();
543  QString plugin = reader.attributes().value("pluginName").toString();
544  QString event = reader.attributes().value("eventName").toString();
545  QString script = reader.readElementText();
546  emit addHook(script, new HookInformation(map, x, y, item, plugin, event));
547  }
548  if (reader.isStartElement() && reader.name() == "random_map")
549  {
550  int x = reader.attributes().value("x").toString().toInt();
551  int y = reader.attributes().value("y").toString().toInt();
552  QString params = reader.attributes().value("params").toString();
553  map->addRandomMap(new RandomMap(map, x, y, params.toLatin1().constData()));
554  }
555  if (reader.isStartElement() && reader.name() == "background_music")
556  {
557  map->setBackgroundMusic(reader.readElementText());
558  continue;
559  }
560 
561  if (reader.isEndElement() && reader.name() == "map")
562  {
563  map = NULL;
564  continue;
565  }
566  }
567 
568 // qDebug() << "loaded maps from cache:" << myInformation.size();
569 }
570 
572 {
574  QFile file(settings.mapCacheDirectory() + QDir::separator() + "maps_cache.xml");
575  file.open(QFile::WriteOnly | QFile::Truncate);
576 
577  QXmlStreamWriter writer(&file);
578 
579  writer.setAutoFormatting(true);
580  writer.writeStartDocument();
581 
582  writer.writeStartElement("maps");
583  writer.writeAttribute("version", "1");
584 
585  QList<CREMapInformation*> maps = myInformation.values();
586  foreach(CREMapInformation* map, maps)
587  {
588  writer.writeStartElement("map");
589  writer.writeTextElement("path", map->path());
590  writer.writeTextElement("name", map->name());
591  writer.writeTextElement("lastModified", map->mapTime().toString(Qt::ISODate));
592  writer.writeTextElement("difficulty", QString::number(map->difficulty()));
593  writer.writeTextElement("computedDifficulty", QString::number(map->computedDifficulty()));
594  writer.writeTextElement("experience", QString::number(map->experience()));
595  writer.writeTextElement("region", map->region());
596  foreach(QString arch, map->archetypes())
597  {
598  writer.writeTextElement("arch", arch);
599  }
600  foreach(QString face, map->faces())
601  {
602  writer.writeTextElement("face", face);
603  }
604  foreach(QString anim, map->animations())
605  {
606  writer.writeTextElement("animation", anim);
607  }
608  foreach(QString path, map->exitsTo())
609  {
610  writer.writeTextElement("exitTo", path);
611  }
612  foreach(QString path, map->accessedFrom())
613  {
614  writer.writeTextElement("accessedFrom", path);
615  }
616  foreach(QString file, map->messages())
617  {
618  writer.writeTextElement("messageFile", file);
619  }
620  foreach(QString code, map->quests())
621  {
622  writer.writeTextElement("quest", code);
623  }
624  foreach(QString item, map->shopItems().keys())
625  {
626  writer.writeStartElement("shopItem");
627  writer.writeAttribute("name", item);
628  writer.writeCharacters(QString::number(map->shopItems()[item]));
629  writer.writeEndElement();
630  }
631  if (map->shopGreed() != 0)
632  {
633  writer.writeTextElement("shopGreed", QString::number(map->shopGreed()));
634  }
635  if (!map->shopRace().isEmpty())
636  {
637  writer.writeTextElement("shopRace", map->shopRace());
638  }
639  if (map->shopMin() != 0)
640  {
641  writer.writeTextElement("shopMin", QString::number(map->shopMin()));
642  }
643  if (map->shopMax() != 0)
644  {
645  writer.writeTextElement("shopMax", QString::number(map->shopMax()));
646  }
647 
648  QList<ScriptFile*> scripts = myScriptManager->scriptsForMap(map);
649  foreach(ScriptFile* script, scripts)
650  {
651  foreach(const HookInformation* hook, script->hooks())
652  {
653  if (hook->map() == map)
654  {
655  writer.writeStartElement("script");
656  writer.writeAttribute("x", QString::number(hook->x()));
657  writer.writeAttribute("y", QString::number(hook->y()));
658  writer.writeAttribute("itemName", hook->itemName());
659  writer.writeAttribute("pluginName", hook->pluginName());
660  writer.writeAttribute("eventName", hook->eventName());
661  writer.writeCharacters(script->path());
662  writer.writeEndElement();
663  }
664  }
665  }
666 
667  foreach(RandomMap* random, map->randomMaps())
668  {
669  writer.writeStartElement("random_map");
670  writer.writeAttribute("x", QString::number(random->x()));
671  writer.writeAttribute("y", QString::number(random->y()));
673  char* params = stringbuffer_finish(sb);
674  writer.writeAttribute("params", params);
675  free(params);
676  writer.writeEndElement();
677  }
678 
679  if (!map->backgroundMusic().isEmpty())
680  {
681  writer.writeTextElement("background_music", map->backgroundMusic());
682  }
683 
684  writer.writeEndElement();
685  }
686 
687  writer.writeEndElement();
688 
689  writer.writeEndDocument();
690 }
691 
693 {
694  if (!myInformation.contains(path))
695  {
696  CREMapInformation* information = new CREMapInformation(path);
697  myInformation[path] = information;
698  }
699  return myInformation[path];
700 }
701 
703 {
704  QMutexLocker lock(&myLock);
705  if (!myArchetypeUse.values(name).contains(map))
706  myArchetypeUse.insert(name, map);
707 }
708 
710 {
711  QMutexLocker lock(&myLock);
712  if (!myFaceUse.values(name).contains(map))
713  myFaceUse.insert(name, map);
714 }
715 
717 {
718  QMutexLocker lock(&myLock);
719  if (!myAnimationUse.values(name).contains(map))
720  myAnimationUse.insert(name, map);
721 }
722 
724  QMutexLocker lock(&myLock);
725  if (!myQuestUse.values(name).contains(map))
726  myQuestUse.insert(name, map);
727 }
728 
729 
731 {
732  const QString slaying = "/python/dialog/npc_dialog.py";
733  const QString python = "Python";
734 
735  if (item->type != EVENT_CONNECTOR)
736  return;
737 
738  if (item->subtype > 0 && item->subtype < NR_EVENTS)
739  {
740  emit addHook(item->slaying, new HookInformation(map, env->x, env->y, env->name, item->title, eventNames[item->subtype]));
741  }
742 
743  if (python != item->title)
744  return;
745 
746  if (item->subtype == EVENT_SAY && slaying == item->slaying)
747  {
748  //qDebug() << "message event in" << map->path() << item->name;
749  QString path = item->name;
750  if (!path.startsWith('/'))
751  path = '/' + path;
752 
754  if (message != NULL)
755  {
756  if (!message->maps().contains(map))
757  message->maps().append(map);
758  map->addMessage(path);
759  } else
760  qDebug() << "missing message file" << path << "in" << map->path();
761  }
762 
763  if (QString(item->slaying).startsWith("/python/quests/"))
764  {
765  //qDebug() << "quest-related Python stuff";
766  QStringList split = QString(item->name).split(' ', QString::SkipEmptyParts);
767  if (split.length() > 1)
768  {
769  //qDebug() << "definitely quest" << split[0];
770  map->addQuest(split[0]);
771  addQuestUse(split[0], map);
772  }
773  }
774 }
775 
776 QList<CREMapInformation*> CREMapInformationManager::getMapsForRegion(const QString& region)
777 {
778  QList<CREMapInformation*> list;
779 
780  foreach(CREMapInformation* map, myInformation.values())
781  {
782  if (map->region() == region)
783  list.append(map);
784  }
785 
786  return list;
787 }
788 
790 {
792  Q_ASSERT(myWorker.isFinished());
793  QFile::remove(settings.mapCacheDirectory() + QDir::separator() + "maps_cache.xml");
794 }
795 
797 {
798  QList<RandomMap*> maps;
799  foreach(CREMapInformation* map, myInformation.values())
800  {
801  maps.append(map->randomMaps());
802  }
803  return maps;
804 }
805 
807 {
808  char full[MAX_BUF];
809  create_pathname(from.toLatin1(), full, sizeof(full));
810 
811  QDir dir(full);
812  QFileInfoList items = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::DirsFirst);
813  foreach(QFileInfo info, items)
814  {
815  QString relative(from + QDir::separator() + info.baseName());
816  if (info.isDir())
817  {
818  recurseStyleDirectory(relative);
819  }
820  else
821  {
822  myToProcess.append(relative);
823  }
824  }
825 }
Face::name
sstring name
Definition: face.h:19
ScriptFileManager
Definition: ScriptFileManager.h:24
Face
Definition: face.h:14
HookInformation::x
int x() const
Definition: ScriptFile.cpp:86
ready_map_name
mapstruct * ready_map_name(const char *name, int flags)
Definition: map.c:1785
RandomMap
Definition: RandomMap.h:26
add_map
static void add_map(struct_map_info *info, struct_map_list *list)
Definition: mapper.cpp:1208
PLAYER
@ PLAYER
Definition: object.h:107
CREMapInformation::setShopGreed
void setShopGreed(double greed)
Definition: CREMapInformation.cpp:223
global.h
CREMapInformationManager::~CREMapInformationManager
virtual ~CREMapInformationManager()
Definition: CREMapInformationManager.cpp:77
RandomMap::parameters
const RMParms * parameters() const
Definition: RandomMap.cpp:39
FOR_MAP_FINISH
#define FOR_MAP_FINISH()
Definition: define.h:730
CREMapInformationManager::myCurrentMap
int myCurrentMap
Definition: CREMapInformationManager.h:65
CREMapInformationManager::randomMaps
QList< RandomMap * > randomMaps()
Definition: CREMapInformationManager.cpp:796
CREMapInformationManager::checkItem
void checkItem(const object *item, CREMapInformation *information, const object *env)
Definition: CREMapInformationManager.cpp:95
CREMapInformationManager::browsingMap
void browsingMap(const QString &path)
MAP_NO_DIFFICULTY
#define MAP_NO_DIFFICULTY
Definition: map.h:98
CREMapInformation::setComputedDifficulty
void setComputedDifficulty(int computed)
Definition: CREMapInformation.cpp:162
maps
static std::unordered_map< std::string, mapzone * > maps
Definition: citylife.cpp:94
EVENT_CONNECTOR
@ EVENT_CONNECTOR
Definition: object.h:227
NR_EVENTS
#define NR_EVENTS
Definition: events.h:58
python_init.scripts
scripts
Definition: python_init.py:11
diamondslots.x
x
Definition: diamondslots.py:15
ScriptFileManager.h
CREMapInformation::difficulty
int difficulty
Definition: CREMapInformation.h:33
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
MessageManager.h
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
AssetsManager.h
send.date
date
Definition: send.py:29
MessageManager::findMessage
MessageFile * findMessage(const QString &path)
Definition: MessageManager.cpp:63
CREMapInformationManager::start
void start()
Definition: CREMapInformationManager.cpp:87
CREMapInformation::exitsTo
QStringList exitsTo() const
Definition: CREMapInformation.cpp:125
calculate_difficulty
int calculate_difficulty(mapstruct *m)
Definition: map.c:1911
get_map_info
static struct_map_info * get_map_info(const char *path)
Definition: mapper.cpp:1301
CREMapInformationManager::addHook
void addHook(const QString &file, HookInformation *hook)
EXIT_PATH
#define EXIT_PATH(xyz)
Definition: define.h:439
CREMapInformationManager::clearCache
void clearCache()
Definition: CREMapInformationManager.cpp:789
CREMapInformation::shopItems
QHash< QString, int > & shopItems()
Definition: CREMapInformation.cpp:208
guildoracle.list
list
Definition: guildoracle.py:87
CREMapInformationManager::myWorker
QFuture< void > myWorker
Definition: CREMapInformationManager.h:66
HookInformation::map
const CREMapInformation * map() const
Definition: ScriptFile.cpp:81
commongive.inv
inv
Definition: commongive.py:28
mapdef::in_memory
uint32_t in_memory
Definition: map.h:338
mad_mage_user.file
file
Definition: mad_mage_user.py:15
create_pathname
char * create_pathname(const char *name, char *buf, size_t size)
Definition: map.c:103
CREMapInformationManager::getAnimationUse
QList< CREMapInformation * > getAnimationUse(const Animations *anim)
Definition: CREMapInformationManager.cpp:384
RandomMap::x
int x() const
Definition: RandomMap.cpp:29
path_combine_and_normalize
char * path_combine_and_normalize(const char *src, const char *dst, char *path, size_t size)
Definition: path.c:172
CREMapInformationManager::allMaps
QList< CREMapInformation * > allMaps()
Definition: CREMapInformationManager.cpp:366
CREMapInformation::setDifficulty
void setDifficulty(int difficulty)
Definition: CREMapInformation.cpp:152
CREMapInformationManager::getArchetypeUse
QList< CREMapInformation * > getArchetypeUse(const archetype *arch)
Definition: CREMapInformationManager.cpp:372
CREMapInformation::addAnimation
void addAnimation(const QString &anim)
Definition: CREMapInformation.cpp:110
CREMapInformationManager::myCancelled
bool myCancelled
Definition: CREMapInformationManager.h:67
CREMapInformationManager::process
void process(const QString &path)
Definition: CREMapInformationManager.cpp:194
EVENT_SAY
#define EVENT_SAY
Definition: events.h:28
RandomMap.h
CREMapInformationManager::addArchetypeUse
void addArchetypeUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:702
first_map_path
EXTERN char first_map_path[MAX_BUF]
Definition: global.h:141
HookInformation::itemName
QString itemName() const
Definition: ScriptFile.cpp:96
MessageFile
Definition: MessageFile.h:68
CREMapInformationManager::myExperience
QHash< QString, qint64 > myExperience
Definition: CREMapInformationManager.h:69
CREMapInformationManager::addAnimationUse
void addAnimationUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:716
getManager
AssetsManager * getManager()
Definition: assets.cpp:335
MAP_STYLE
#define MAP_STYLE
Definition: map.h:99
archt
Definition: object.h:469
settings
struct Settings settings
Definition: init.c:39
CREMapInformationManager::recurseStyleDirectory
void recurseStyleDirectory(const QString &from)
Definition: CREMapInformationManager.cpp:806
HookInformation::y
int y() const
Definition: ScriptFile.cpp:91
m
static event_registration m
Definition: citylife.cpp:427
quest
Definition: quest.py:1
CREMapInformation
Definition: CREMapInformation.h:27
CREMapInformation::setRegion
void setRegion(const QString &region)
Definition: CREMapInformation.cpp:181
MAP_IN_MEMORY
#define MAP_IN_MEMORY
Definition: map.h:131
CREMapInformation::mapTime
const QDateTime & mapTime() const
Definition: CREMapInformation.cpp:115
CREMapInformationManager::CREMapInformationManager
CREMapInformationManager(QObject *parent, MessageManager *messageManager, ScriptFileManager *scriptManager)
Definition: CREMapInformationManager.cpp:68
disinfect.map
map
Definition: disinfect.py:4
CREMapInformation::setShopMin
void setShopMin(quint64 min)
Definition: CREMapInformation.cpp:243
ScriptFile::path
const QString & path() const
Definition: ScriptFile.cpp:47
RandomMap::y
int y() const
Definition: RandomMap.cpp:34
ScriptFile.h
ScriptFileManager::scriptsForMap
QList< ScriptFile * > scriptsForMap(CREMapInformation *map)
Definition: ScriptFileManager.cpp:26
CREMapInformation::setShopRace
void setShopRace(const QString &race)
Definition: CREMapInformation.cpp:233
CRESettings.h
HookInformation::pluginName
QString pluginName() const
Definition: ScriptFile.cpp:101
python_init.path
path
Definition: python_init.py:8
ScriptFileManager::removeMap
void removeMap(CREMapInformation *map)
Definition: ScriptFileManager.cpp:50
CREMapInformationManager::myAnimationUse
QMultiHash< QString, CREMapInformation * > myAnimationUse
Definition: CREMapInformationManager.h:62
CREMapInformation::addFace
void addFace(const QString &face)
Definition: CREMapInformation.cpp:100
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.c:76
python
Definition: python.py:1
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:677
CREMapInformation::experience
qint64 experience
Definition: CREMapInformation.h:35
say.max
dictionary max
Definition: say.py:148
MessageManager
Definition: MessageManager.h:25
doors_galore.process
def process()
Definition: doors_galore.py:72
AssetsCollection::each
void each(std::function< void(T *)> op)
Definition: AssetsCollection.h:135
animate.anim
string anim
Definition: animate.py:20
mapdef
Definition: map.h:317
delete_map
void delete_map(mapstruct *m)
Definition: map.c:1722
CREMapInformationManager::myScriptManager
ScriptFileManager * myScriptManager
Definition: CREMapInformationManager.h:58
CREMapInformationManager::myArchetypeUse
QMultiHash< QString, CREMapInformation * > myArchetypeUse
Definition: CREMapInformationManager.h:60
FLAG_MONSTER
#define FLAG_MONSTER
Definition: define.h:245
MAP_WIDTH
#define MAP_WIDTH(m)
Definition: map.h:78
CREMapInformationManager::browseFinished
bool browseFinished() const
Definition: CREMapInformationManager.cpp:82
AssetsManager::archetypes
Archetypes * archetypes()
Definition: AssetsManager.h:44
env
static std::shared_ptr< inja::Environment > env
Definition: mapper.cpp:2216
MAX_BUF
#define MAX_BUF
Definition: define.h:35
CREMapInformationManager.h
CREMapInformationManager::getMapsForRegion
QList< CREMapInformation * > getMapsForRegion(const QString &region)
Definition: CREMapInformationManager.cpp:776
StringBuffer
Definition: stringbuffer.c:25
ScriptFile
Definition: ScriptFile.h:44
animations_struct::name
sstring name
Definition: face.h:26
FOR_MAP_PREPARE
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Definition: define.h:723
EXIT
@ EXIT
Definition: object.h:181
CREMapInformation::addExitTo
void addExitTo(const QString &path)
Definition: CREMapInformation.cpp:130
diamondslots.message
string message
Definition: diamondslots.py:57
animations_struct
Definition: face.h:25
MessageFile.h
CREMapInformationManager::myLock
QMutex myLock
Definition: CREMapInformationManager.h:68
CREMapInformationManager::myFaceUse
QMultiHash< QString, CREMapInformation * > myFaceUse
Definition: CREMapInformationManager.h:61
add_region_link
static void add_region_link(mapstruct *source, mapstruct *dest)
Definition: mapper.cpp:1399
CREMapInformation::setBackgroundMusic
void setBackgroundMusic(const QString &music)
Definition: CREMapInformation.cpp:79
CREMapInformationManager::getOrCreateMapInformation
CREMapInformation * getOrCreateMapInformation(const QString &path)
Definition: CREMapInformationManager.cpp:692
CREMapInformation::addRandomMap
void addRandomMap(RandomMap *map)
Definition: CREMapInformation.cpp:263
CREMapInformation::setMapTime
void setMapTime(const QDateTime &date)
Definition: CREMapInformation.cpp:120
CREMapInformationManager::myToProcess
QStringList myToProcess
Definition: CREMapInformationManager.h:64
CREMapInformationManager::addQuestUse
void addQuestUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:723
CREMapInformationManager::browseMaps
void browseMaps()
Definition: CREMapInformationManager.cpp:302
item
Definition: item.py:1
CREMapInformation::setShopMax
void setShopMax(quint64 max)
Definition: CREMapInformation.cpp:253
CREMapInformationManager::addFaceUse
void addFaceUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:709
PLAYER_CHANGER
@ PLAYER_CHANGER
Definition: object.h:162
CRESettings
Definition: CRESettings.h:21
quest_definition
Definition: quest.h:42
find_archetype
archetype * find_archetype(const char *name)
Definition: assets.cpp:284
CREMapInformationManager::checkEvent
void checkEvent(const object *item, CREMapInformation *map, const object *env)
Definition: CREMapInformationManager.cpp:730
roll-o-matic.params
params
Definition: roll-o-matic.py:193
diamondslots.y
y
Definition: diamondslots.py:16
assets.h
mapdef::reset_time
uint32_t reset_time
Definition: map.h:324
CREMapInformation::setName
void setName(const QString &name)
Definition: CREMapInformation.cpp:69
CREMapInformationManager::cancel
void cancel()
Definition: CREMapInformationManager.cpp:360
MAP_HEIGHT
#define MAP_HEIGHT(m)
Definition: map.h:80
CREMapInformationManager::loadCache
void loadCache()
Definition: CREMapInformationManager.cpp:396
do_regions_link
static bool do_regions_link
Definition: mapper.cpp:385
region
struct regiondef region
CREMapInformation::addArchetype
void addArchetype(const QString &archetype)
Definition: CREMapInformation.cpp:89
CREMapInformationManager::myInformation
QHash< QString, CREMapInformation * > myInformation
Definition: CREMapInformationManager.h:59
first_map_ext_path
EXTERN char first_map_ext_path[MAX_BUF]
Definition: global.h:142
animate.event
event
DIALOGCHECK MINARGS 1 MAXARGS 2
Definition: animate.py:17
CREMapInformationManager::getMapsForQuest
QList< CREMapInformation * > getMapsForQuest(const quest_definition *quest)
Definition: CREMapInformationManager.cpp:390
CREMapInformationManager::myMessageManager
MessageManager * myMessageManager
Definition: CREMapInformationManager.h:57
CREMapInformationManager::getFaceUse
QList< CREMapInformation * > getFaceUse(const Face *face)
Definition: CREMapInformationManager.cpp:378
CREMapInformationManager::myQuestUse
QMultiHash< QString, CREMapInformation * > myQuestUse
Definition: CREMapInformationManager.h:63
CREMapInformation::addAccessedFrom
void addAccessedFrom(const QString &path)
Definition: CREMapInformation.cpp:141
ScriptFile::hooks
QList< HookInformation * > hooks() const
Definition: ScriptFile.cpp:42
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2655
say.item
dictionary item
Definition: say.py:149
connect
Definition: connect.py:1
CREMapInformation::setExperience
void setExperience(qint64 experience)
Definition: CREMapInformation.cpp:172
HookInformation
Definition: ScriptFile.h:23
TELEPORTER
@ TELEPORTER
Definition: object.h:141
eventNames
const char * eventNames[NR_EVENTS]
Definition: CREMapInformationManager.cpp:29
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:670
write_map_parameters_to_string
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
Definition: random_map.c:750
CREMapInformationManager::storeCache
void storeCache()
Definition: CREMapInformationManager.cpp:571
mapfile_load
mapstruct * mapfile_load(const char *map, int flags)
Definition: map.c:1214
give.name
name
Definition: give.py:27
HookInformation::eventName
QString eventName() const
Definition: ScriptFile.cpp:106
regiondef
Definition: map.h:275