trainoverlord: switch from train based blocking to tag based blocking
This commit is contained in:
parent
29b887504d
commit
96638d6f8d
16 changed files with 291 additions and 202 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "block.h"
|
||||
#include "overlorditemstore.h"
|
||||
#include "blockborder.h"
|
||||
#include "microcontroller.h"
|
||||
#include "itemstore.h"
|
||||
|
|
@ -18,13 +19,15 @@ private:
|
|||
private:
|
||||
std::vector<std::shared_ptr<Block>> blocks_;
|
||||
std::vector<std::shared_ptr<BlockBorder>> borders_;
|
||||
std::vector<std::pair<std::weak_ptr<Train>, std::weak_ptr<BlockBorder>>> trainLimbo_;
|
||||
std::vector<std::pair<NfcUid, std::weak_ptr<BlockBorder>>> limbo_;
|
||||
|
||||
void removeTrainFromAllBlocks(std::shared_ptr<Train> train);
|
||||
void registerTrainInLimbo(std::shared_ptr<Train> train, std::shared_ptr<BlockBorder>);
|
||||
void removeTagFromAllBlocks(const NfcUid& tag);
|
||||
void registerTagInLimbo(const NfcUid& tag, std::shared_ptr<BlockBorder>);
|
||||
|
||||
OverlordItemStore *items_;
|
||||
|
||||
public:
|
||||
explicit Layout(QObject *parent = nullptr);
|
||||
explicit Layout(OverlordItemStore *items, QObject *parent = nullptr);
|
||||
void addBlock(std::shared_ptr<Block> block);
|
||||
void addBorder(std::shared_ptr<BlockBorder> border);
|
||||
void store(QJsonObject& json);
|
||||
|
|
@ -33,11 +36,7 @@ public:
|
|||
std::shared_ptr<Block> getBlock(uint32_t id);
|
||||
|
||||
public slots:
|
||||
void trainArrivedAtReader(uint8_t reader, std::shared_ptr<Train> train, int tagType);
|
||||
void itemAdded(std::weak_ptr<Item> item);
|
||||
|
||||
signals:
|
||||
void trainArrivedAtBorder(std::weak_ptr<BlockBorder>, std::weak_ptr<Train> train, int tagType);
|
||||
void tagArrivedAtReader(uint8_t reader, NfcUid tag);
|
||||
};
|
||||
|
||||
#endif // BLOCKSTORE_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue