Go to the documentation of this file.
16 #include <QStringList>
17 #include <QMessageBox>
54 QMessageBox::critical(
nullptr,
"Fatal error",
"Error while initializing Crossfire data, make sure you have maps and archetypes correctly installed.");
59 setlocale(LC_NUMERIC,
"C");
70 bool hasWarningOrError =
false;
71 static std::function<
void(
LogLevel,
const char *, va_list)> lc = [&] (
LogLevel logLevel,
const char *format, va_list va) {
76 vsnprintf(
buf,
sizeof(
buf), format, va);
80 hasWarningOrError =
true;
92 if (hasWarningOrError) {
93 QString
msg(tr(
"The following errors occurred during asset collection:\n") +
log.join(
""));
94 QMessageBox::warning(
nullptr, tr(
"Errors during asset collection!"),
msg);
99 for (
int ing = 1; ; ing++)
105 QHash<QString, recipe*>
recipes;
106 for (
recipe* rec =
list->items; rec; rec = rec->next)
108 key = QString(
"%1_%2").arg(rec->arch_name[0], rec->title);
122 if (count < 1 || count >
myRecipes.size())
123 return QStringList();
132 if (ingredients < 1 || ingredients >
myRecipes.size())
147 goOn = callback(OTHER_ARCH, arch, nullptr, nullptr, nullptr);
153 goOn = callback(DEATH_ANIM, arch, nullptr, nullptr, nullptr);
160 for (
auto t =
list->items;
t;
t =
t->next)
164 goOn = callback(TREASURE_USE, nullptr, list, nullptr, nullptr);
169 QList<CREMapInformation*> mapuse = store->getArchetypeUse(
item);
174 goOn = callback(
MAP_USE,
nullptr,
nullptr, information,
nullptr);
176 auto allMaps =
store->allMaps();
201 for (
size_t ing = 0; ing < rec->
arch_names; ing++)
236 while (!no.empty()) {
237 auto list = no.back();
241 origins, std::vector<std::string>());
242 if (dlg.exec() == QDialog::Accepted) {
246 if (QMessageBox::question(
nullptr, tr(
"Lose changes to treasure list %1?").arg(
list->name),
247 tr(
"Really discard changes to treasure list %1?").arg(
list->name)) == QMessageBox::Yes) {
void treasureModified(treasurelist *treasure)
ModifiedAssetsManager< quest_definition > myQuests
const RMParms * parameters() const
recipelist * get_formulalist(int i)
const recipe * getRecipe(int ingredients, const QString &name) const
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
void questModified(quest_definition *quest)
ModifiedAssetsManager< artifact > myArtifacts
std::vector< std::string > files() const
LicenseManager myLicenseManager
class AssetsTracker * assets_tracker
static void archetypeUse(const archetype *item, CREMapInformationManager *store, AssetUseCallback callback)
int recipeMaxIngredients() const
const char * object_get_value(const object *op, const char *const key)
void add_server_collect_hooks()
AssetsManager * getManager()
ModifiedAssetsManager< GeneralMessage > myGeneralMessages
std::vector< T * > dirtyAssetsWithNoOrigin() const
void add_hook(const char *name, collectorHook hook)
const std::map< std::string, std::set< const archetype * > > & origins() const
void saveModifiedAssets()
void saveGeneralMessages()
QList< QHash< QString, recipe * > > myRecipes
@ store
store tags as binary type
std::function< bool(ArchetypeUse use, const archetype *, const treasurelist *, const CREMapInformation *, recipe *)> AssetUseCallback
QStringList recipes(int count) const
void readLicense(BufferReader *reader, const char *filename)
void each(std::function< void(T *)> op)
Archetypes * archetypes()
void archetypeModified(archetype *arch)
char final_exit_archetype[RM_SIZE]
void assetModified(T *asset)
const char *const loglevel_names[]
const typedef char * sstring
void assetDefined(const T *asset, const std::string &filename)
static void onFatalInit(enum fatal_error)
void generalMessageModified(GeneralMessage *message)
ModifiedAssetsManager< archetype > myArchetypes
ModifiedAssetsManager< treasurelist > myTreasures
virtual ~ResourcesManager()