rename EntityId to BuildingId
This commit is contained in:
@@ -62,9 +62,9 @@ BlueprintPanel::BlueprintPanel(Simulation* sim, const GameConfig* config, QWidge
|
||||
connect(m_loadBtn, &QPushButton::clicked, this, &BlueprintPanel::onLoadClicked);
|
||||
}
|
||||
|
||||
void BlueprintPanel::onSelectionChanged(const std::vector<EntityId>& ids)
|
||||
void BlueprintPanel::onSelectionChanged(const std::vector<BuildingId>& ids)
|
||||
{
|
||||
m_selectedIds = ids;
|
||||
m_selectedBuildingIds = ids;
|
||||
refreshButtonStates();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void BlueprintPanel::clearActiveBlueprintButton()
|
||||
|
||||
void BlueprintPanel::onCreateClicked()
|
||||
{
|
||||
if (m_selectedIds.empty()) { return; }
|
||||
if (m_selectedBuildingIds.empty()) { return; }
|
||||
|
||||
Blueprint bp = createBlueprintFromSelection();
|
||||
if (bp.buildings.empty()) { return; }
|
||||
@@ -144,9 +144,9 @@ Blueprint BlueprintPanel::createBlueprintFromSelection() const
|
||||
const Building* building;
|
||||
};
|
||||
std::vector<Entry> entries;
|
||||
entries.reserve(m_selectedIds.size());
|
||||
entries.reserve(m_selectedBuildingIds.size());
|
||||
|
||||
for (const EntityId id : m_selectedIds)
|
||||
for (const BuildingId id : m_selectedBuildingIds)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (!b) { continue; }
|
||||
@@ -320,7 +320,7 @@ void BlueprintPanel::onLoadClicked()
|
||||
void BlueprintPanel::refreshButtonStates()
|
||||
{
|
||||
const bool anyPlaceable = [&]() {
|
||||
for (const EntityId id : m_selectedIds)
|
||||
for (const BuildingId id : m_selectedBuildingIds)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (!b) { continue; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Blueprint.h"
|
||||
#include "EntityId.h"
|
||||
#include "BuildingId.h"
|
||||
#include "GameConfig.h"
|
||||
#include "Tick.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
BlueprintPanel(Simulation* sim, const GameConfig* config, QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void onSelectionChanged(const std::vector<EntityId>& ids);
|
||||
void onSelectionChanged(const std::vector<BuildingId>& ids);
|
||||
void onStateUpdated(Tick tick, int blocks, double speed);
|
||||
void clearActiveBlueprintButton();
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
|
||||
Simulation* m_sim;
|
||||
const GameConfig* m_config;
|
||||
std::vector<EntityId> m_selectedIds;
|
||||
std::vector<BuildingId> m_selectedBuildingIds;
|
||||
int m_currentBlocks;
|
||||
int m_activeIndex;
|
||||
std::vector<Blueprint> m_blueprints;
|
||||
|
||||
@@ -116,7 +116,7 @@ GameWorldView::GameWorldView(Simulation* sim, const GameConfig* config,
|
||||
, m_ghostValid(false)
|
||||
, m_dragging(false)
|
||||
, m_demolishMode(false)
|
||||
, m_demolishHoverId(kInvalidEntityId)
|
||||
, m_demolishHoverBuildingId(kInvalidBuildingId)
|
||||
, m_debugDraw(false)
|
||||
, m_rng(std::random_device{}())
|
||||
, m_boxSelecting(false)
|
||||
@@ -412,7 +412,7 @@ bool GameWorldView::isValidPlacement(BuildingType type, QPoint anchor,
|
||||
return true;
|
||||
}
|
||||
|
||||
EntityId GameWorldView::buildingAtTile(QPoint tile) const
|
||||
BuildingId GameWorldView::buildingAtTile(QPoint tile) const
|
||||
{
|
||||
for (const Building& b : m_sim->buildings().allBuildings())
|
||||
{
|
||||
@@ -424,10 +424,10 @@ EntityId GameWorldView::buildingAtTile(QPoint tile) const
|
||||
}
|
||||
}
|
||||
}
|
||||
return kInvalidEntityId;
|
||||
return kInvalidBuildingId;
|
||||
}
|
||||
|
||||
EntityId GameWorldView::siteAtTile(QPoint tile) const
|
||||
BuildingId GameWorldView::siteAtTile(QPoint tile) const
|
||||
{
|
||||
for (const ConstructionSite& s : m_sim->buildings().allSites())
|
||||
{
|
||||
@@ -439,7 +439,7 @@ EntityId GameWorldView::siteAtTile(QPoint tile) const
|
||||
}
|
||||
}
|
||||
}
|
||||
return kInvalidEntityId;
|
||||
return kInvalidBuildingId;
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ void GameWorldView::placeBlueprintAtTile(QPoint center)
|
||||
for (const BlueprintBuilding& bb : bp.buildings)
|
||||
{
|
||||
const QPoint anchor = center + bb.offset;
|
||||
const std::optional<EntityId> rotateTarget =
|
||||
const std::optional<BuildingId> rotateTarget =
|
||||
m_sim->buildings().findRotateInPlaceTarget(bb.type, anchor, bb.rotation);
|
||||
if (rotateTarget.has_value())
|
||||
{
|
||||
@@ -503,8 +503,8 @@ void GameWorldView::placeBlueprintAtTile(QPoint center)
|
||||
continue;
|
||||
}
|
||||
|
||||
const EntityId id = m_sim->tryPlaceBuilding(bb.type, anchor, bb.rotation);
|
||||
if (id == kInvalidEntityId || bb.recipeId.empty()) { continue; }
|
||||
const BuildingId id = m_sim->tryPlaceBuilding(bb.type, anchor, bb.rotation);
|
||||
if (id == kInvalidBuildingId || bb.recipeId.empty()) { continue; }
|
||||
|
||||
if (bb.type == BuildingType::Shipyard)
|
||||
{
|
||||
@@ -533,7 +533,7 @@ void GameWorldView::placeAtTile(QPoint tile)
|
||||
return;
|
||||
}
|
||||
|
||||
const std::optional<EntityId> rotateTarget =
|
||||
const std::optional<BuildingId> rotateTarget =
|
||||
m_sim->buildings().findRotateInPlaceTarget(type, tile, m_ghostRotation);
|
||||
if (rotateTarget.has_value())
|
||||
{
|
||||
@@ -549,9 +549,9 @@ void GameWorldView::placeAtTile(QPoint tile)
|
||||
}
|
||||
if (!m_sim->buildings().isTileOccupied(tile))
|
||||
{
|
||||
const EntityId id = m_sim->tryPlaceBuilding(
|
||||
const BuildingId id = m_sim->tryPlaceBuilding(
|
||||
type, tile, m_ghostRotation);
|
||||
if (id != kInvalidEntityId)
|
||||
if (id != kInvalidBuildingId)
|
||||
{
|
||||
m_beltDragTiles.insert(tile);
|
||||
}
|
||||
@@ -563,8 +563,8 @@ void GameWorldView::placeAtTile(QPoint tile)
|
||||
{
|
||||
if (!m_sim->buildings().isTileOccupied(tile))
|
||||
{
|
||||
const EntityId id = m_sim->tryPlaceBuilding(type, tile, m_ghostRotation);
|
||||
if (id != kInvalidEntityId)
|
||||
const BuildingId id = m_sim->tryPlaceBuilding(type, tile, m_ghostRotation);
|
||||
if (id != kInvalidBuildingId)
|
||||
{
|
||||
if (type == BuildingType::TunnelEntry)
|
||||
{
|
||||
@@ -677,7 +677,7 @@ void GameWorldView::drawBuildings(QPainter& painter)
|
||||
}
|
||||
|
||||
bool selected = false;
|
||||
for (EntityId selId : m_selectedIds)
|
||||
for (BuildingId selId : m_selectedBuildingIds)
|
||||
{
|
||||
if (selId == b.id) { selected = true; break; }
|
||||
}
|
||||
@@ -957,9 +957,9 @@ void GameWorldView::drawOverlays(QPainter& painter)
|
||||
}
|
||||
|
||||
// Demolish hover tint
|
||||
if (m_demolishMode && m_demolishHoverId != kInvalidEntityId)
|
||||
if (m_demolishMode && m_demolishHoverBuildingId != kInvalidBuildingId)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(m_demolishHoverId);
|
||||
const Building* b = m_sim->buildings().findBuilding(m_demolishHoverBuildingId);
|
||||
if (b)
|
||||
{
|
||||
for (const QPoint& cell : b->bodyCells)
|
||||
@@ -1168,55 +1168,55 @@ void GameWorldView::mousePressEvent(QMouseEvent* event)
|
||||
}
|
||||
else if (m_demolishMode)
|
||||
{
|
||||
EntityId hovered = buildingAtTile(tile);
|
||||
if (hovered == kInvalidEntityId)
|
||||
BuildingId hovered = buildingAtTile(tile);
|
||||
if (hovered == kInvalidBuildingId)
|
||||
{
|
||||
hovered = siteAtTile(tile);
|
||||
}
|
||||
if (hovered != kInvalidEntityId)
|
||||
if (hovered != kInvalidBuildingId)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(hovered);
|
||||
const bool isProtected = b && b->type == BuildingType::Hq;
|
||||
if (!isProtected)
|
||||
{
|
||||
m_sim->demolish(hovered);
|
||||
m_demolishHoverId = kInvalidEntityId;
|
||||
m_demolishHoverBuildingId = kInvalidBuildingId;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityId id = buildingAtTile(tile);
|
||||
if (id == kInvalidEntityId)
|
||||
BuildingId id = buildingAtTile(tile);
|
||||
if (id == kInvalidBuildingId)
|
||||
{
|
||||
id = siteAtTile(tile);
|
||||
}
|
||||
if (id != kInvalidEntityId)
|
||||
if (id != kInvalidBuildingId)
|
||||
{
|
||||
if (event->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
bool found = false;
|
||||
std::vector<EntityId> newSel;
|
||||
for (EntityId sel : m_selectedIds)
|
||||
std::vector<BuildingId> newSel;
|
||||
for (BuildingId sel : m_selectedBuildingIds)
|
||||
{
|
||||
if (sel == id) { found = true; }
|
||||
else { newSel.push_back(sel); }
|
||||
}
|
||||
if (!found) { newSel.push_back(id); }
|
||||
m_selectedIds = newSel;
|
||||
m_selectedBuildingIds = newSel;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedIds = { id };
|
||||
m_selectedBuildingIds = { id };
|
||||
}
|
||||
emit selectionChanged(m_selectedIds);
|
||||
emit selectionChanged(m_selectedBuildingIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(event->modifiers() & Qt::ControlModifier))
|
||||
{
|
||||
m_selectedIds.clear();
|
||||
emit selectionChanged(m_selectedIds);
|
||||
m_selectedBuildingIds.clear();
|
||||
emit selectionChanged(m_selectedBuildingIds);
|
||||
}
|
||||
m_boxSelecting = true;
|
||||
m_boxStartTile = tile;
|
||||
@@ -1245,7 +1245,7 @@ void GameWorldView::mouseMoveEvent(QMouseEvent* event)
|
||||
}
|
||||
else if (m_demolishMode)
|
||||
{
|
||||
m_demolishHoverId = buildingAtTile(tile);
|
||||
m_demolishHoverBuildingId = buildingAtTile(tile);
|
||||
}
|
||||
else if (m_boxSelecting)
|
||||
{
|
||||
@@ -1272,7 +1272,7 @@ void GameWorldView::mouseReleaseEvent(QMouseEvent* event)
|
||||
const int x1 = std::max(m_boxStartTile.x(), m_boxCurrentTile.x());
|
||||
const int y1 = std::max(m_boxStartTile.y(), m_boxCurrentTile.y());
|
||||
|
||||
std::vector<EntityId> boxSel;
|
||||
std::vector<BuildingId> boxSel;
|
||||
for (const Building& b : m_sim->buildings().allBuildings())
|
||||
{
|
||||
for (const QPoint& cell : b.bodyCells)
|
||||
@@ -1300,21 +1300,21 @@ void GameWorldView::mouseReleaseEvent(QMouseEvent* event)
|
||||
|
||||
if (!(event->modifiers() & Qt::ControlModifier))
|
||||
{
|
||||
m_selectedIds = boxSel;
|
||||
m_selectedBuildingIds = boxSel;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (EntityId id : boxSel)
|
||||
for (BuildingId id : boxSel)
|
||||
{
|
||||
bool found = false;
|
||||
for (EntityId sel : m_selectedIds)
|
||||
for (BuildingId sel : m_selectedBuildingIds)
|
||||
{
|
||||
if (sel == id) { found = true; break; }
|
||||
}
|
||||
if (!found) { m_selectedIds.push_back(id); }
|
||||
if (!found) { m_selectedBuildingIds.push_back(id); }
|
||||
}
|
||||
}
|
||||
emit selectionChanged(m_selectedIds);
|
||||
emit selectionChanged(m_selectedBuildingIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1327,7 +1327,7 @@ void GameWorldView::toggleDemolishMode()
|
||||
if (m_demolishMode)
|
||||
{
|
||||
m_demolishMode = false;
|
||||
m_demolishHoverId = kInvalidEntityId;
|
||||
m_demolishHoverBuildingId = kInvalidBuildingId;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1393,9 +1393,9 @@ void GameWorldView::resetForNewGame()
|
||||
m_ghostRotation = Rotation::East;
|
||||
m_ghostValid = false;
|
||||
m_demolishMode = false;
|
||||
m_demolishHoverId = kInvalidEntityId;
|
||||
m_demolishHoverBuildingId = kInvalidBuildingId;
|
||||
emit demolishModeChanged(false);
|
||||
m_selectedIds.clear();
|
||||
m_selectedBuildingIds.clear();
|
||||
m_boxSelecting = false;
|
||||
m_scrollXTiles = 0.0f;
|
||||
m_scrollLeft = false;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "Blueprint.h"
|
||||
#include "SchematicDropEvent.h"
|
||||
#include "BuildingType.h"
|
||||
#include "EntityId.h"
|
||||
#include "BuildingId.h"
|
||||
#include "FireEvent.h"
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
const VisualsConfig* visuals, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void selectionChanged(const std::vector<EntityId>& ids);
|
||||
void selectionChanged(const std::vector<BuildingId>& ids);
|
||||
void stateUpdated(Tick tick, int blocks, double speed);
|
||||
void gameOver();
|
||||
void builderModeExited();
|
||||
@@ -104,8 +104,8 @@ private:
|
||||
|
||||
bool isValidPlacement(BuildingType type, QPoint anchor, Rotation rot) const;
|
||||
const BuildingDef* findBuildingDef(BuildingType type) const;
|
||||
EntityId buildingAtTile(QPoint tile) const;
|
||||
EntityId siteAtTile(QPoint tile) const;
|
||||
BuildingId buildingAtTile(QPoint tile) const;
|
||||
BuildingId siteAtTile(QPoint tile) const;
|
||||
|
||||
void drawPortGlyph(QPainter& painter, QPoint bodyTile,
|
||||
Rotation direction, const QColor& color);
|
||||
@@ -162,10 +162,10 @@ private:
|
||||
QPoint m_blueprintGhostTile;
|
||||
|
||||
bool m_demolishMode;
|
||||
EntityId m_demolishHoverId;
|
||||
BuildingId m_demolishHoverBuildingId;
|
||||
bool m_debugDraw;
|
||||
|
||||
std::vector<EntityId> m_selectedIds;
|
||||
std::vector<BuildingId> m_selectedBuildingIds;
|
||||
bool m_boxSelecting;
|
||||
QPoint m_boxStartTile;
|
||||
QPoint m_boxCurrentTile;
|
||||
|
||||
@@ -219,7 +219,7 @@ void MainWindow::onEscapeMenuRequested()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onLayoutDialogRequested(EntityId shipyardId)
|
||||
void MainWindow::onLayoutDialogRequested(BuildingId shipyardId)
|
||||
{
|
||||
const double prevSpeed = m_gameWorldView->gameSpeed();
|
||||
m_gameWorldView->setGameSpeed(0.0);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "EntityId.h"
|
||||
#include "BuildingId.h"
|
||||
#include "ShipLayoutBlueprint.h"
|
||||
#include "Tick.h"
|
||||
#include "VisualsConfig.h"
|
||||
@@ -34,7 +34,7 @@ private slots:
|
||||
void onGameOver();
|
||||
void onStateUpdated(Tick tick, int blocks, double speed);
|
||||
void onEscapeMenuRequested();
|
||||
void onLayoutDialogRequested(EntityId shipyardId);
|
||||
void onLayoutDialogRequested(BuildingId shipyardId);
|
||||
|
||||
private:
|
||||
void layoutPanels();
|
||||
|
||||
@@ -86,7 +86,7 @@ SelectedBuildingPanel::SelectedBuildingPanel(Simulation* sim,
|
||||
: QWidget(parent)
|
||||
, m_sim(sim)
|
||||
, m_config(config)
|
||||
, m_singleId(kInvalidEntityId)
|
||||
, m_singleBuildingId(kInvalidBuildingId)
|
||||
, m_splitterTile(0, 0)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
@@ -125,9 +125,9 @@ SelectedBuildingPanel::SelectedBuildingPanel(Simulation* sim,
|
||||
connect(m_clearBeltBtn, &QPushButton::clicked,
|
||||
this, &SelectedBuildingPanel::onClearBelt);
|
||||
connect(m_configureLayoutBtn, &QPushButton::clicked, this, [this]() {
|
||||
if (m_singleId != kInvalidEntityId)
|
||||
if (m_singleBuildingId != kInvalidBuildingId)
|
||||
{
|
||||
emit layoutDialogRequested(m_singleId);
|
||||
emit layoutDialogRequested(m_singleBuildingId);
|
||||
}
|
||||
});
|
||||
connect(m_filterAList, &QListWidget::itemChanged,
|
||||
@@ -138,31 +138,31 @@ SelectedBuildingPanel::SelectedBuildingPanel(Simulation* sim,
|
||||
buildEmpty();
|
||||
}
|
||||
|
||||
void SelectedBuildingPanel::onSelectionChanged(const std::vector<EntityId>& ids)
|
||||
void SelectedBuildingPanel::onSelectionChanged(const std::vector<BuildingId>& ids)
|
||||
{
|
||||
m_selection = ids;
|
||||
m_selectedBuildingIds = ids;
|
||||
rebuild();
|
||||
}
|
||||
|
||||
void SelectedBuildingPanel::rebuild()
|
||||
{
|
||||
if (m_selection.empty())
|
||||
if (m_selectedBuildingIds.empty())
|
||||
{
|
||||
buildEmpty();
|
||||
}
|
||||
else if (m_selection.size() == 1)
|
||||
else if (m_selectedBuildingIds.size() == 1)
|
||||
{
|
||||
buildSingle(m_selection[0]);
|
||||
buildSingle(m_selectedBuildingIds[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
buildMulti(m_selection);
|
||||
buildMulti(m_selectedBuildingIds);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectedBuildingPanel::buildEmpty()
|
||||
{
|
||||
m_singleId = kInvalidEntityId;
|
||||
m_singleBuildingId = kInvalidBuildingId;
|
||||
m_titleLabel->hide();
|
||||
m_recipeCombo->hide();
|
||||
m_layoutPreview->hide();
|
||||
@@ -175,9 +175,9 @@ void SelectedBuildingPanel::buildEmpty()
|
||||
m_buffersLabel->hide();
|
||||
}
|
||||
|
||||
void SelectedBuildingPanel::buildSingle(EntityId id)
|
||||
void SelectedBuildingPanel::buildSingle(BuildingId id)
|
||||
{
|
||||
m_singleId = id;
|
||||
m_singleBuildingId = id;
|
||||
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (!b)
|
||||
@@ -490,8 +490,8 @@ const ShipDef* SelectedBuildingPanel::findShipDef(const std::string& id) const
|
||||
|
||||
void SelectedBuildingPanel::onStateUpdated(Tick /*tick*/, int /*blocks*/, double /*speed*/)
|
||||
{
|
||||
if (m_singleId == kInvalidEntityId) { return; }
|
||||
const Building* b = m_sim->buildings().findBuilding(m_singleId);
|
||||
if (m_singleBuildingId == kInvalidBuildingId) { return; }
|
||||
const Building* b = m_sim->buildings().findBuilding(m_singleBuildingId);
|
||||
if (b)
|
||||
{
|
||||
// If the panel was last showing this id as a construction site, the
|
||||
@@ -506,7 +506,7 @@ void SelectedBuildingPanel::onStateUpdated(Tick /*tick*/, int /*blocks*/, double
|
||||
}
|
||||
return;
|
||||
}
|
||||
const ConstructionSite* s = m_sim->buildings().findSite(m_singleId);
|
||||
const ConstructionSite* s = m_sim->buildings().findSite(m_singleBuildingId);
|
||||
if (s)
|
||||
{
|
||||
rebuild();
|
||||
@@ -515,9 +515,9 @@ void SelectedBuildingPanel::onStateUpdated(Tick /*tick*/, int /*blocks*/, double
|
||||
buildEmpty();
|
||||
}
|
||||
|
||||
void SelectedBuildingPanel::buildMulti(const std::vector<EntityId>& ids)
|
||||
void SelectedBuildingPanel::buildMulti(const std::vector<BuildingId>& ids)
|
||||
{
|
||||
m_singleId = kInvalidEntityId;
|
||||
m_singleBuildingId = kInvalidBuildingId;
|
||||
m_recipeCombo->hide();
|
||||
m_clearBeltBtn->hide();
|
||||
m_filterALabel->hide();
|
||||
@@ -527,7 +527,7 @@ void SelectedBuildingPanel::buildMulti(const std::vector<EntityId>& ids)
|
||||
m_buffersLabel->hide();
|
||||
|
||||
std::map<BuildingType, int> counts;
|
||||
for (EntityId id : ids)
|
||||
for (BuildingId id : ids)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (b)
|
||||
@@ -564,12 +564,12 @@ void SelectedBuildingPanel::buildMulti(const std::vector<EntityId>& ids)
|
||||
|
||||
void SelectedBuildingPanel::onRecipeChanged(int comboIndex)
|
||||
{
|
||||
if (m_singleId == kInvalidEntityId)
|
||||
if (m_singleBuildingId == kInvalidBuildingId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const QString recipeId = m_recipeCombo->itemData(comboIndex).toString();
|
||||
m_sim->buildings().setRecipe(m_singleId, recipeId.toStdString());
|
||||
m_sim->buildings().setRecipe(m_singleBuildingId, recipeId.toStdString());
|
||||
rebuild();
|
||||
}
|
||||
|
||||
@@ -619,7 +619,7 @@ void SelectedBuildingPanel::buildSplitterFilters(QPoint splitterTile)
|
||||
|
||||
void SelectedBuildingPanel::onSplitterFilterChanged()
|
||||
{
|
||||
if (m_singleId == kInvalidEntityId)
|
||||
if (m_singleBuildingId == kInvalidBuildingId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ std::vector<std::string> SelectedBuildingPanel::allItemIds() const
|
||||
void SelectedBuildingPanel::onClearBelt()
|
||||
{
|
||||
std::vector<QPoint> tiles;
|
||||
for (EntityId id : m_selection)
|
||||
for (BuildingId id : m_selectedBuildingIds)
|
||||
{
|
||||
const Building* b = m_sim->buildings().findBuilding(id);
|
||||
if (b && isBeltLike(b->type))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Building.h"
|
||||
#include "EntityId.h"
|
||||
#include "BuildingId.h"
|
||||
#include "GameConfig.h"
|
||||
#include "RecipesConfig.h"
|
||||
#include "ShipLayout.h"
|
||||
@@ -31,10 +31,10 @@ public:
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void layoutDialogRequested(EntityId shipyardId);
|
||||
void layoutDialogRequested(BuildingId shipyardId);
|
||||
|
||||
public slots:
|
||||
void onSelectionChanged(const std::vector<EntityId>& ids);
|
||||
void onSelectionChanged(const std::vector<BuildingId>& ids);
|
||||
void onStateUpdated(Tick tick, int blocks, double speed);
|
||||
|
||||
private slots:
|
||||
@@ -46,8 +46,8 @@ private:
|
||||
void rebuild();
|
||||
void clearContent();
|
||||
void buildEmpty();
|
||||
void buildSingle(EntityId id);
|
||||
void buildMulti(const std::vector<EntityId>& ids);
|
||||
void buildSingle(BuildingId id);
|
||||
void buildMulti(const std::vector<BuildingId>& ids);
|
||||
void refreshBuffers(const Building* b);
|
||||
void buildSplitterFilters(QPoint splitterTile);
|
||||
const RecipeDef* findRecipe(const Building* b) const;
|
||||
@@ -56,7 +56,7 @@ private:
|
||||
|
||||
Simulation* m_sim;
|
||||
const GameConfig* m_config;
|
||||
std::vector<EntityId> m_selection;
|
||||
std::vector<BuildingId> m_selectedBuildingIds;
|
||||
|
||||
QVBoxLayout* m_layout;
|
||||
QLabel* m_titleLabel;
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
ShipLayoutPreview* m_layoutPreview;
|
||||
QPushButton* m_configureLayoutBtn;
|
||||
|
||||
EntityId m_singleId;
|
||||
BuildingId m_singleBuildingId;
|
||||
QPoint m_splitterTile;
|
||||
std::string m_currentRecipeId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user