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

📄 mapics.h

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

typedef struct sMapItem
{
  long      ItemNum;          // MIL item number
  long      Quantity;         // Quantity of item (ie coins)
  float     XPos, YPos, ZPos; // Map coordinates

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

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

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

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

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

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

    // Add and remove an item on map
    BOOL Add(long ItemNum, long Quantity,                     \
             float XPos, float YPos, float ZPos,              \
             sMapItem *OwnerItem = NULL);
    BOOL Remove(sMapItem *Item);

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

#endif

⌨️ 快捷键说明

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