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