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