RPG库存系统教程C++

RPG Inventory System Tutorial C++

本文关键字:教程 C++ 系统 RPG      更新时间:2023-10-16

嘿,伙计,我想知道是否有C++ RPG库存系统的教程或示例代码。我浏览过网站,我只发现制作两个类,项目和库存,并将它们中的每一个用于项目的详细信息并将项目保存在链表中。

这就是我到目前为止所拥有的..

using namespace std;
int maxWeight;
class inventory {  //manages the entire inventory
public:
    inventory();
    inventory::inventory(int defaultWeight = maxWeight);
private:
    int maxWeight = 100;

};
class item {  //holds the details about a particular item
public:
    item();
    item(char* name, double weight);    
private:
    char* name;
    double weight;
};

我希望我对这样一个教程的长时间搜索可以结束。.

谢谢。

基本上,根据我目前的理解,您正在寻找的是库存中的链表来存储所有项目。了解链表的工作原理,然后从那里继续。您可能需要

    添加项目
  1. (在添加项目之前检查当前链表的权重)。
  2. 删除项目。
  3. 打印链表中的任何内容。