⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charics.h

📁 [游戏开发参考书-用DirectX编写RPG游戏]这是一个系列的丛书如果你都看并且懂的话你就可以你工作啦!
💻 H
字号:
#ifndef _CHARICS_H_
#define _CHARICS_H_

typedef struct sCharItem
{
  long      ItemNum;          // MIL item number
  long      Quantity;         // Quantity of item (ie coins)

  sCharItem  *Prev, *Next;    // linked list pointers

  long       Index;           // This items index #
  long       Owner;           // Owner index #
  sCharItem  *Parent;         // Parent of a contained item

  sCharItem()
  { 
    Prev = Next = Parent = NULL;
    Index = 0; Owner = -1;
   }
   
  ~sCharItem() { delete Next; } 
} sCharItem;

class cCharICS
{
  private:
    long      m_NumItems;     // # items in inventory
    sCharItem *m_ItemParent;  // Linked list parent item
    
    // Functions to read in next long or float # in file
    long  GetNextLong(FILE *fp);
    float GetNextFloat(FILE *fp);

  public:
    cCharICS();   // Constructor
    ~cCharICS();  // Destructor

    // Load, save, and free a list of items
    BOOL Load(char *Filename);
    BOOL Save(char *Filename);
    BOOL Free();

    // Add and remove an item
    BOOL Add(long ItemNum, long Quantity,    
             sCharItem *OwnerItem = NULL);
    BOOL Remove(sCharItem *Item);

    // Retrieve # items or parent linked list object
    long      GetNumItems();
    sCharItem *GetParentItem();
    sCharItem *GetItem(long Num);

    // Re-ordering functions
    BOOL Arrange();
    BOOL MoveUp(sCharItem *Item);
    BOOL MoveDown(sCharItem *Item);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -