Crossfire Server, Trunk
QuestsWrapper.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include <QtWidgets>
14 
15 #include "QuestsWrapper.h"
16 #include "AssetsManager.h"
18 
19 void QuestsWrapper::fillMenu(QMenu *menu) {
20  connect(menu->addAction(tr("Add quest")), &QAction::triggered, [this] () { addQuest(); });
21 }
22 
24  auto origins = myResources->questFiles();
25  auto keys = getManager()->quests()->keys();
26 
28  if (aqd.exec() != QDialog::Accepted) {
29  return;
30  }
31  qDebug() << aqd.code() << aqd.file();
32 
33  quest_definition *qd = quest_create(aqd.code().toStdString().c_str());
35  getManager()->quests()->define(qd->quest_code, qd);
36  myResources->assetDefined(qd, aqd.file().toStdString());
39  myAssets.push_back(myResources->wrap(qd, this));
41 }
AssetWrapper::AfterChildAdd
@ AfterChildAdd
Definition: AssetWrapper.h:32
AssetsManager.h
QuestsWrapper::addQuest
void addQuest()
Definition: QuestsWrapper.cpp:23
ResourcesManager::questModified
void questModified(quest_definition *quest)
Definition: ResourcesManager.cpp:225
ResourcesManager::questFiles
std::vector< std::string > questFiles() const
Definition: ResourcesManager.h:112
ResourcesManager::wrap
ArchetypeWrapper * wrap(archt *arch, AssetWrapper *parent)
Definition: ResourcesManager.h:126
hall_of_fame.keys
keys
Definition: hall_of_fame.py:43
getManager
AssetsManager * getManager()
Definition: assets.cpp:309
AssetsCollection::keys
std::vector< Key > keys() const
Definition: AssetsCollection.h:183
quest_definition::quest_title
sstring quest_title
Definition: quest.h:40
AssetOriginAndCreationDialog::CreateAsset
@ CreateAsset
Definition: AssetOriginAndCreationDialog.h:24
AssetWrapper::BeforeChildAdd
@ BeforeChildAdd
Definition: AssetWrapper.h:32
AssetsCollection::define
T * define(const Key &name, T *asset)
Definition: AssetsCollection.h:120
AssetOriginAndCreationDialog.h
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
quest_definition::quest_code
sstring quest_code
Definition: quest.h:39
QuestsWrapper::myResources
ResourcesManager * myResources
Definition: QuestsWrapper.h:39
AssetOriginAndCreationDialog
Definition: AssetOriginAndCreationDialog.h:21
AssetsManager::quests
Quests * quests()
Definition: AssetsManager.h:71
ResourcesManager::assetDefined
virtual void assetDefined(const archt *arch, const std::string &filename) override
Definition: ResourcesManager.h:101
QuestsWrapper.h
quest_definition
Definition: quest.h:38
AssetWrapper::markModified
void markModified(ChangeType change, int extra=0)
Definition: AssetWrapper.h:54
AssetsCollectionWrapper< quest_definition >::myAssets
QVector< AssetWrapper * > myAssets
Definition: AssetsCollectionWrapper.h:41
AssetOriginAndCreationDialog::Quest
@ Quest
Definition: AssetOriginAndCreationDialog.h:23
connect
Definition: connect.py:1
quest_create
quest_definition * quest_create(const char *name)
Definition: Quests.cpp:63
AssetOriginAndCreationDialog::code
QString code() const
Definition: AssetOriginAndCreationDialog.h:36
AssetOriginAndCreationDialog::file
QString file() const
Definition: AssetOriginAndCreationDialog.h:37
QuestsWrapper::fillMenu
virtual void fillMenu(QMenu *menu) override
Definition: QuestsWrapper.cpp:19