aboutsummaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-16 11:23:27 -0400
committerYour Name <you@example.com>2021-04-16 11:23:27 -0400
commit4618763c0e3a723bf4bb43c7b9edbce87240e0af (patch)
treea18aa4bf7da05ac02b4e37b199aeeb82da977aea /src/item.cc
parentdfce4d0398a8bafbb7ad7a31345af181c0269c09 (diff)
downloaddmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.tar.gz
dmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.tar.bz2
dmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.zip
Rebased feature/item on entry
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc11
1 files changed, 9 insertions, 2 deletions
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 <iostream>
#include <memory>
+#include <sstream>
using namespace std;
typedef nlohmann::json json;
-namespace item {
-
+namespace entry {
shared_ptr<Item> Item::create(const json& data) {
if(data["type"] == "weapon") {
return utils::loadDFromJson<Item, Weapon>(data);
@@ -19,4 +19,11 @@ namespace item {
}
return shared_ptr<Item>(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();
+ }
}