mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Mod Handler class. It is connected with engine, but doesn't do anything yet.
This commit is contained in:
71
lib/CModHandler.cpp
Normal file
71
lib/CModHandler.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include "StdInc.h"
|
||||
#include "CModHandler.h"
|
||||
|
||||
/*
|
||||
* CModHandler.h, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
class CArtHandler;
|
||||
class CHeroHandler;
|
||||
class CCreatureHandler;
|
||||
class CSpellHandler;
|
||||
class CBuildingHandler;
|
||||
class CObjectHandler;
|
||||
class CDefObjInfoHandler;
|
||||
class CTownHandler;
|
||||
class CGeneralTextHandler;
|
||||
|
||||
CModHandler::CModHandler()
|
||||
{
|
||||
VLC->modh = this;
|
||||
|
||||
//CResourceHandler::loadModsFilesystems(); //scan for all mods
|
||||
//TODO: mod filesystem is already initialized at LibClasses launch
|
||||
//TODO: load default (last?) config
|
||||
}
|
||||
artID CModHandler::addNewArtifact (CArtifact * art)
|
||||
{
|
||||
int id = artifacts.size();
|
||||
artifacts.push_back (art);
|
||||
return id;
|
||||
}
|
||||
creID CModHandler::addNewCreature (CCreature * cre)
|
||||
{
|
||||
int id = creatures.size();
|
||||
creatures.push_back (cre);
|
||||
return id;
|
||||
}
|
||||
|
||||
void CModHandler::loadConfigFromFile (std::string name)
|
||||
{}
|
||||
void CModHandler::saveConfigToFile (std::string name)
|
||||
{}
|
||||
void CModHandler::recreateHandlers()
|
||||
{
|
||||
//TODO: consider some template magic to unify all handlers?
|
||||
|
||||
VLC->arth->artifacts.clear();
|
||||
VLC->creh->creatures.clear(); //TODO: what about items from original game?
|
||||
|
||||
BOOST_FOREACH (auto mod, activeMods)
|
||||
{
|
||||
BOOST_FOREACH (auto art, allMods[mod].artifacts)
|
||||
{
|
||||
VLC->arth->artifacts.push_back (artifacts[art]);
|
||||
}
|
||||
BOOST_FOREACH (auto creature, allMods[mod].creatures)
|
||||
{
|
||||
VLC->creh->creatures.push_back (creatures[creature]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CModHandler::~CModHandler()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user