🐛 fixed last commit

This commit is contained in:
EntireTwix 2021-04-21 19:11:56 -07:00
parent 3b36ec90cc
commit 57c755c415
2 changed files with 7 additions and 6 deletions

View file

@ -109,21 +109,22 @@ public:
if (state)
{
//if user lacks a log, one is created, this is to reduce usage
Transaction temp(a_name, b_name, amount, false);
Transaction temp(a_name, b_name, amount);
Transaction temp2(a_name, b_name, amount);
if (!logs.contains(a_name))
{
logs.try_emplace(a_name);
}
logs.modify_if(a_name, [&temp](Log &l) {
l.AddTrans(temp);
l.AddTrans(std::move(temp));
});
if (!logs.contains(b_name))
{
logs.try_emplace(b_name);
}
temp.recieving = true;
logs.modify_if(b_name, [&temp](Log &l) {
l.AddTrans(temp);
logs.modify_if(b_name, [&temp2](Log &l) {
l.AddTrans(std::move(temp2));
});
}

View file

@ -6,7 +6,7 @@
struct Log
{
std::array<Transaction, 100> data;
void AddTrans(const Transaction &v)
void AddTrans(Transaction &&v)
{
std::rotate(data.begin(), data.begin() + 1, data.end());
data[99] = std::move(v);