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