mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Move count to checkpoint manager
This commit is contained in:
parent
18d33e8589
commit
1366f43ddd
2 changed files with 5 additions and 8 deletions
|
|
@ -37,7 +37,6 @@ struct MobjList
|
||||||
{
|
{
|
||||||
ptr->next(front());
|
ptr->next(front());
|
||||||
front(ptr);
|
front(ptr);
|
||||||
count_++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void erase(T* node)
|
void erase(T* node)
|
||||||
|
|
@ -46,7 +45,6 @@ struct MobjList
|
||||||
{
|
{
|
||||||
front(node->next());
|
front(node->next());
|
||||||
node->next(nullptr);
|
node->next(nullptr);
|
||||||
count_--;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +69,6 @@ struct MobjList
|
||||||
{
|
{
|
||||||
prev->next(node->next());
|
prev->next(node->next());
|
||||||
node->next(nullptr);
|
node->next(nullptr);
|
||||||
count_--;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,12 +85,9 @@ struct MobjList
|
||||||
auto begin() const { return view().begin(); }
|
auto begin() const { return view().begin(); }
|
||||||
auto end() const { return view().end(); }
|
auto end() const { return view().end(); }
|
||||||
|
|
||||||
auto count() { return count_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void front(T* ptr) { Mobj::ManagedPtr {Head} = ptr; }
|
void front(T* ptr) { Mobj::ManagedPtr {Head} = ptr; }
|
||||||
auto view() const { return MobjListView(front(), [](T* node) { return node->next(); }); }
|
auto view() const { return MobjListView(front(), [](T* node) { return node->next(); }); }
|
||||||
UINT32 count_ = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace srb2
|
}; // namespace srb2
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,7 @@ struct CheckpointManager
|
||||||
if (chk->linetag())
|
if (chk->linetag())
|
||||||
lines_.try_emplace(chk->linetag(), std::move(tagged_lines(chk->linetag())));
|
lines_.try_emplace(chk->linetag(), std::move(tagged_lines(chk->linetag())));
|
||||||
list_.push_front(chk);
|
list_.push_front(chk);
|
||||||
|
count_ += 1; // Mobjlist can't have a count on it, so we keep it here
|
||||||
}
|
}
|
||||||
|
|
||||||
chk->gingerbread();
|
chk->gingerbread();
|
||||||
|
|
@ -506,9 +507,10 @@ struct CheckpointManager
|
||||||
{
|
{
|
||||||
lines_.clear();
|
lines_.clear();
|
||||||
list_.clear();
|
list_.clear();
|
||||||
|
count_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto count() { return list_.count(); }
|
auto count() { return count_; }
|
||||||
|
|
||||||
const srb2::Vector<line_t*>* lines_for(const Checkpoint* chk) const
|
const srb2::Vector<line_t*>* lines_for(const Checkpoint* chk) const
|
||||||
{
|
{
|
||||||
|
|
@ -517,6 +519,7 @@ struct CheckpointManager
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
INT32 count_;
|
||||||
srb2::MobjList<Checkpoint, svg_checkpoints> list_;
|
srb2::MobjList<Checkpoint, svg_checkpoints> list_;
|
||||||
srb2::HashMap<INT32, srb2::Vector<line_t*>> lines_;
|
srb2::HashMap<INT32, srb2::Vector<line_t*>> lines_;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue