implement ship modules

This commit is contained in:
2026-05-18 08:49:51 +02:00
parent b59e392461
commit d08bf5d37b
33 changed files with 1911 additions and 56 deletions

View File

@@ -0,0 +1,38 @@
#pragma once
#include <string>
#include <vector>
#include <QWidget>
#include "ModulesConfig.h"
#include "ShipLayout.h"
class ShipLayoutPreview : public QWidget
{
Q_OBJECT
public:
explicit ShipLayoutPreview(QWidget* parent = nullptr);
void setShipAndLayout(const std::vector<std::string>& shipLayout,
const ShipLayoutConfig& layout,
const std::vector<ModuleDef>* modules);
void clear();
protected:
void paintEvent(QPaintEvent* event) override;
private:
struct CellInfo
{
bool buildable;
int moduleIndex; // -1 if empty
};
std::vector<std::vector<CellInfo>> m_grid;
std::vector<PlacedModule> m_placedModules;
const std::vector<ModuleDef>* m_modules;
int m_rows;
int m_cols;
};