QUEUE.H
资源名称:tc3d.zip [点击查看]
上传用户:abcdshs
上传日期:2007-01-07
资源大小:1858k
文件大小:2k
源码类别:
游戏
开发平台:
Visual C++
- // (C) Copyright 1996 by Anthony J. Carin. All Rights Reserved.
- #ifndef QUEUE_H
- #define QUEUE_H
- enum queuetype
- {
- NONE = 0x0000,
- ANTAGONIST = 0x0001,
- HANDHELD = 0x0002,
- BASEOBJECT = 0x0004,
- LANDSCAPE = 0x0008,
- GATEWAY = 0x0010,
- DUDEHOLDER = 0x0020,
- WEAPONHOLDER = 0x0040,
- TELEPORTER = 0x0080
- };
- class qentry
- {
- public:
- friend class drawqueue;
- qentry() { Next = Prev = 0; m_type = NONE; }
- virtual ~qentry() { detach(); }
- virtual void draw() = 0;
- virtual queuetype type() { return m_type; }
- void detach();
- char IsANTAGONIST() { return (char)(m_type == ANTAGONIST); }
- char IsHANDHELD() { return (char)(m_type == HANDHELD ); }
- char IsBASEOBJECT() { return (char)(m_type == BASEOBJECT); }
- char IsLANDSCAPE() { return (char)(m_type == LANDSCAPE ); }
- char IsGATEWAY() { return (char)(m_type == GATEWAY ); }
- char IsDUDEHOLDER() { return (char)(m_type == DUDEHOLDER); }
- char IsWEAPONHOLDER() { return (char)(m_type == WEAPONHOLDER); }
- char IsTELEPORTER() { return (char)(m_type == TELEPORTER); }
- protected:
- queuetype m_type;
- qentry *Next;
- qentry *Prev;
- };
- class drawqueue
- {
- public:
- friend qentry;
- drawqueue() { First = searchpos = mdead = 0; }
- ~drawqueue() { purge(); }
- void run();
- void add(qentry *q);
- void *first(short qtype);
- void *next(short qtype);
- void purge(queuetype p = NONE);
- void KillLater(qentry *dead) { mdead = dead; }
- private:
- qentry *First;
- qentry *searchpos;
- qentry *mdead;
- };
- #endif