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