From 4618763c0e3a723bf4bb43c7b9edbce87240e0af Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 16 Apr 2021 11:23:27 -0400 Subject: Rebased feature/item on entry --- src/item.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/item.cc') diff --git a/src/item.cc b/src/item.cc index f602be2..6c91206 100644 --- a/src/item.cc +++ b/src/item.cc @@ -5,12 +5,12 @@ #include "utils.h" #include #include +#include using namespace std; typedef nlohmann::json json; -namespace item { - +namespace entry { shared_ptr Item::create(const json& data) { if(data["type"] == "weapon") { return utils::loadDFromJson(data); @@ -19,4 +19,11 @@ namespace item { } return shared_ptr(new Item(data)); } + + string genText(const Substantial& s) { + stringstream text; + text << "Cost: " << s.getCost() << " cp, i.e., " << utils::getCostString(s.getCost()); + text << ". Weight: " << s.getWeight() << " lbs."; + return text.str(); + } } -- cgit v1.2.3