aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 19:59:38 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 19:59:38 +0100
commit6e1d62955c7a7f39bc9126d709a42a70e02a1d30 (patch)
treec2505409c68d554b1e776cdb0c8104af54d375bf /frontend
parentc1d43cddee94dd370078f755d33147c9a8181852 (diff)
create backend string class
Diffstat (limited to 'frontend')
-rw-r--r--frontend/GameData.cpp2
-rw-r--r--frontend/cmd/get.cpp4
-rw-r--r--frontend/cmd/query.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/frontend/GameData.cpp b/frontend/GameData.cpp
index 739ad1e..4556621 100644
--- a/frontend/GameData.cpp
+++ b/frontend/GameData.cpp
@@ -79,7 +79,7 @@ Object * GameData::create_object(const string & name) {
if (!type_map.contains(type)) throw std::exception();
return ObjectFactory::create_object({
.name = name.c_str(),
- .description = row.col<const char *>(1),
+ .description = row.col<const char *>(1, nullptr),
.type = type_map.at(type),
.min_value = row.col<int>(2),
.max_value = row.col<int>(3),
diff --git a/frontend/cmd/get.cpp b/frontend/cmd/get.cpp
index 78c6ec1..12c3353 100644
--- a/frontend/cmd/get.cpp
+++ b/frontend/cmd/get.cpp
@@ -11,7 +11,7 @@ FollowupAction Player::cmd_get(string & target_name) {
unique_ptr<Object> target = nullptr;
for (Object * object : this->location.get_objects()) {
if (object->get_hidden() == true) continue;
- if (str_lower(object->get_name()) != str_lower(target_name)) continue;
+ if (str_lower(object->get_name().c_str()) != str_lower(target_name)) continue;
target = unique_ptr<Object>(object);
this->location.remove_object(object);
break;
@@ -31,7 +31,7 @@ FollowupAction Player::cmd_get(string & target_name) {
}
// other objects go in the inventory
- lprtf("Je voegt %s toe aan je bezit.\n", target->get_displayname());
+ lprtf("Je voegt %s toe aan je bezit.\n", target->get_displayname().c_str());
this->inventory.push_back(std::move(target));
return FollowupAction::NONE;
}
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp
index 23d2a42..acd6cee 100644
--- a/frontend/cmd/query.cpp
+++ b/frontend/cmd/query.cpp
@@ -15,8 +15,8 @@ static const unordered_map<Direction, string> direction_map = {
};
FollowupAction Player::cmd_query(string &) {
- lprtf("Je staat bij de locatie %s.\n", this->location.get_name());
- lprtf("%s\n", this->location.get_description());
+ lprtf("Je staat bij de locatie %s.\n", this->location.get_name().c_str());
+ lprtf("%s\n", this->location.get_description().c_str());
{
lprtf("Zichtbare objecten: ");
@@ -24,7 +24,7 @@ FollowupAction Player::cmd_query(string &) {
for (Object * obj : this->location.get_objects()) {
if (obj->get_hidden() == true) continue;
if (objects > 0) lprtf(", ");
- lprtf("%s", obj->get_displayname());
+ lprtf("%s", obj->get_displayname().c_str());
objects++;
}
if (objects == 0)
@@ -49,7 +49,7 @@ FollowupAction Player::cmd_query(string &) {
size_t enemies = 0;
for (Enemy * enemy : this->location.get_enemies()) {
if (enemies > 0) lprtf(", ");
- lprtf("%s", enemy->get_name());
+ lprtf("%s", enemy->get_name().c_str());
enemies++;
}
if (enemies == 0)