26 lines
495 B
C++
26 lines
495 B
C++
#include "overlorditemstore.h"
|
|
#include <QDebug>
|
|
#include "train.h"
|
|
|
|
OverlordItemStore::OverlordItemStore(QObject *parent): ItemStore(parent)
|
|
{
|
|
}
|
|
|
|
void OverlordItemStore::gotNfcTag(NfcUid uid)
|
|
{
|
|
for(std::shared_ptr<Item> item : items_)
|
|
{
|
|
Train* train = dynamic_cast<Train*>(item.get());
|
|
if(!train)
|
|
continue;
|
|
for(const NfcUid& trainUid : train->tags)
|
|
{
|
|
if(trainUid == uid)
|
|
{
|
|
if(train->passedReader(uid))
|
|
train->setValue(0-train->getValue());
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|