#ifndef LOADER_H #define LOADER_H #include #include #include #include #include #include #include #include "game_data.h" struct tbAlien { int id; QString name; float speed; float health; float armor; float regeneration; int imgType; unsigned int prise; }; struct tbSplash { int id; QString name; float speed; float radius; unsigned int lifetime; bool autoControl; int imgType; }; struct tbTrigger { enum triggerType { onDestination, onTimer, onAlienInRadius }; int id; float damage; triggerType type; unsigned int timer; int count; float randomPosRadius; }; struct tbTower { int id; QString name; float radius; unsigned int price; unsigned int reload; unsigned int buildTime; float expByShot; float expByKill; float expByDamage; int splashId; }; struct tbMorph { int fromId; int toId; int cost; float expRequired; }; struct tbWavePart { int waveId; int alienId; unsigned int count; }; struct tbWave { int id; unsigned int timeout; unsigned int prise; int type; }; struct tbWaveOnLevel { int levelId; int waveId; }; struct tbMap { int id; QString name; unsigned int maxPlayers; QVector < QVector > cells; int imgType; }; struct tbTowerOnLevel { int levelId; int towerId; int enableWaveId; }; struct tbLevel { int id; QString name; int mapId; }; class Loader : public QObject { Q_OBJECT public: explicit Loader(QObject *parent = 0); void create(); void reload(); void loadlevel(Game_Data * gd); signals: public slots: private: QDomDocument * doc; QFile * file; QHash aliens; QHash maps; QHash levels; QHash morphs; QHash splashes; QHash towers; QHash levTowers; QHash triggers; QHash waves; QMultiHash levWaves; QMultiHash waveParts; void readAliens(); void readMaps(); void readLevels(); void readMorphs(); void readSplashes(); void readTowers(); void readLevTowers(); void readTriggers(); void readWaves(); void readLevWaves(); void readWaveParts(); void validate(); void load(); QString CreateMapExample(); }; #endif // LOADER_H