From 917cf44defae5d304f590c8754e448b875d56357 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 23 Jan 2021 02:36:13 +0300 Subject: script coronas --- src/leeds/base/sList.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/leeds/base/sList.h (limited to 'src/leeds/base/sList.h') diff --git a/src/leeds/base/sList.h b/src/leeds/base/sList.h new file mode 100644 index 00000000..378d8e31 --- /dev/null +++ b/src/leeds/base/sList.h @@ -0,0 +1,35 @@ +#pragma once + +namespace base +{ + +template +class cSList +{ +public: + struct tSItem + { + tSItem* next; + T item; + }; + // extra field on PS2 + tSItem* first; + + cSList() { first = nil; } + void Insert(tSItem* item) { tSItem* n = first; first = item; item->next = n; } + void Remove(tSItem* item) { + if (first == item) { + first = item->next; + return; + } + tSItem* i = first; + while (i && i->next != item) + i = i->next; + assert(i); + i->next = item->next; + + } + +}; + +} \ No newline at end of file -- cgit v1.2.3