// ListNode.cpp: interface and implementation of the ListNode class.
//
/////////////////////////////////////////////////////////////////////////////////
#include "stdhdrs.h"
#include "strbuf.h"
#include "listnode.h"
CBaseEntity* ListList :: EPop()
{
if (head == NULL) return NULL;
ListNode* old = head;
CBaseEntity* value = head->ent;
if (head->next) head = head->next;
else
{
head = NULL;
tail = NULL;
}
delete old;
return value;
}
StrBuf ListList :: SPop()
{
if (head == NULL) return StrBuf();
ListNode* old = head;
StrBuf value = head->buf;
if (head->next) head = head->next;
else
{
head = NULL;
tail = NULL;
}
delete old;
return value;
}
void ListList :: EKill(CBaseEntity* target)
{
if (head == NULL) return;
ListNode* seek = head;
if (seek->ent == target)
{
head = seek->next;
delete seek;
return;
}
ListNode* prev = seek;
seek = seek->next;
while (seek != NULL)
{
if (seek->ent == target)
{
prev->next = seek->next;
delete seek;
return;
}
prev = seek;
seek = seek->next;
}
}
void ListList::Append(CBaseEntity* ent)
{
if (head == NULL) {
head = new ListNode(ent);
tail = head;
}
else
{
tail->next = new ListNode(ent);
tail = tail->next;
}
}
void ListList::Append(StrBuf buf)
{
if (head == NULL) {
head = new ListNode(buf);
tail = head;
}
else
{
tail->next = new ListNode(buf);
tail = tail->next;
}
}
ListList::ListList()
{
head = NULL;
tail = NULL;
}
ListList::~ListList()
{
if (head) head->Clean();
}
ListNode::ListNode()
{
next = NULL;
}
ListNode::ListNode(CBaseEntity* tent)
{
ent = tent;
next = NULL;
}
ListNode::ListNode(StrBuf tbuf)
{
buf = StrBuf();
buf.Append(tbuf.Text());
next = NULL;
}
ListNode::~ListNode()
{
}
void ListNode::Clean()
{
if(next) next->Clean();
delete this;
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 1689 | Sam Stafford |
Integrate 02.1 API and code cleanup to P4HL. Lots of work. Phew. |
||
| #1 | 937 | Sam Stafford |
Renaming my guest directory to the more conventional sam_stafford. |
||
| //guest/samwise/p4hl/src/dlls/ListNode.cpp | |||||
| #1 | 936 | Sam Stafford |
Adding P4HL to the public depot. See relnotes.txt for installation instructions; all relevant files are under p4hl/dist. Source code is under p4hl/src in the form of a VC++ project. |
||