Implement technology tree, research queue by least remaining work, and unit/building tech availability & obsolescence
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#ifndef TECHCONFIG_H
|
||||
#define TECHCONFIG_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <vector>
|
||||
|
||||
struct TechConfig {
|
||||
QString id;
|
||||
QString name;
|
||||
int scienceCost;
|
||||
QStringList prerequisites;
|
||||
int column;
|
||||
int row;
|
||||
QString iconPath;
|
||||
QString description;
|
||||
|
||||
TechConfig()
|
||||
: id(""), name(""), scienceCost(1000), column(0), row(0),
|
||||
iconPath("images/resources/kennis.png"), description("") {}
|
||||
};
|
||||
|
||||
class TechTreeManager {
|
||||
public:
|
||||
TechTreeManager();
|
||||
|
||||
bool loadConfigFile(const QString &filePath);
|
||||
const TechConfig* getTech(const QString &id) const;
|
||||
const QMap<QString, TechConfig>& getAllTechs() const { return m_techs; }
|
||||
const std::vector<QString>& getOrderedTechIds() const { return m_orderedTechIds; }
|
||||
|
||||
int getMaxColumn() const { return m_maxColumn; }
|
||||
int getMaxRow() const { return m_maxRow; }
|
||||
|
||||
private:
|
||||
int computeTechDepth(const QString &techId, QMap<QString, int> &visited) const;
|
||||
|
||||
QMap<QString, TechConfig> m_techs;
|
||||
std::vector<QString> m_orderedTechIds;
|
||||
int m_maxColumn;
|
||||
int m_maxRow;
|
||||
};
|
||||
|
||||
#endif // TECHCONFIG_H
|
||||
Reference in New Issue
Block a user