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