implement scrap and ship skeleton

This commit is contained in:
2026-04-20 07:32:18 +02:00
parent bf29cc40e3
commit 411be72a5c
14 changed files with 646 additions and 3 deletions

31
src/lib/sim/ShipSystem.h Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include <functional>
#include <vector>
#include <QVector2D>
#include "EntityId.h"
#include "GameConfig.h"
#include "Ship.h"
class ShipSystem
{
public:
ShipSystem(const GameConfig& config,
std::function<EntityId()> allocateId);
EntityId spawn(const std::string& blueprintId, int level, QVector2D position);
void despawn(EntityId id);
const Ship* findShip(EntityId id) const;
std::vector<Ship> allShips() const;
void forEach(std::function<void(Ship&)> fn);
private:
const ShipDef* findShipDef(const std::string& blueprintId) const;
const GameConfig& m_config;
std::function<EntityId()> m_allocateId;
std::vector<Ship> m_ships;
};