diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 20:31:18 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 20:31:18 +0100 |
commit | d8daa3e045ca2f41edcbed533bc5a9fef1363a17 (patch) | |
tree | 6a4c0883d05607476b609e68bcac7d854e281aea /frontend/cmd | |
parent | 6e1d62955c7a7f39bc9126d709a42a70e02a1d30 (diff) |
print to backend
Diffstat (limited to 'frontend/cmd')
-rw-r--r-- | frontend/cmd/cheat.cpp | 3 | ||||
-rw-r--r-- | frontend/cmd/get.cpp | 7 | ||||
-rw-r--r-- | frontend/cmd/go.cpp | 2 | ||||
-rw-r--r-- | frontend/cmd/help.cpp | 3 | ||||
-rw-r--r-- | frontend/cmd/query.cpp | 5 | ||||
-rw-r--r-- | frontend/cmd/search.cpp | 9 | ||||
-rw-r--r-- | frontend/cmd/view.cpp | 3 |
7 files changed, 16 insertions, 16 deletions
diff --git a/frontend/cmd/cheat.cpp b/frontend/cmd/cheat.cpp index aeed5f4..7a020a3 100644 --- a/frontend/cmd/cheat.cpp +++ b/frontend/cmd/cheat.cpp @@ -1,5 +1,6 @@ +#include "backend/print.h" + #include "../Player.h" -#include "../print.h" using namespace std; diff --git a/frontend/cmd/get.cpp b/frontend/cmd/get.cpp index 12c3353..8aa2d75 100644 --- a/frontend/cmd/get.cpp +++ b/frontend/cmd/get.cpp @@ -1,7 +1,7 @@ #include "../Player.h" #include "../strings.h" -#include "../print.h" +#include "backend/print.h" #include "backend/GoldObject.h" #include "backend/Location.h" @@ -9,11 +9,10 @@ using namespace std; 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; + for (Object * object : this->location.get_visible_objects()) { if (str_lower(object->get_name().c_str()) != str_lower(target_name)) continue; target = unique_ptr<Object>(object); - this->location.remove_object(object); + this->location.remove_visible_object(object); break; } if (target == nullptr) { diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp index 624bf6c..9565e99 100644 --- a/frontend/cmd/go.cpp +++ b/frontend/cmd/go.cpp @@ -1,7 +1,7 @@ #include "backend/Location.h" +#include "backend/print.h" #include "../Player.h" -#include "../print.h" #include "../strings.h" using namespace std; diff --git a/frontend/cmd/help.cpp b/frontend/cmd/help.cpp index e614f28..b655a45 100644 --- a/frontend/cmd/help.cpp +++ b/frontend/cmd/help.cpp @@ -1,4 +1,5 @@ -#include "../print.h" +#include "backend/print.h" + #include "../Player.h" using namespace std; diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp index acd6cee..19f2584 100644 --- a/frontend/cmd/query.cpp +++ b/frontend/cmd/query.cpp @@ -1,9 +1,9 @@ #include "backend/Location.h" #include "backend/Object.h" #include "backend/Enemy.h" +#include "backend/print.h" #include "../Player.h" -#include "../print.h" using namespace std; @@ -21,8 +21,7 @@ FollowupAction Player::cmd_query(string &) { { lprtf("Zichtbare objecten: "); size_t objects = 0; - for (Object * obj : this->location.get_objects()) { - if (obj->get_hidden() == true) continue; + for (Object * obj : this->location.get_visible_objects()) { if (objects > 0) lprtf(", "); lprtf("%s", obj->get_displayname().c_str()); objects++; diff --git a/frontend/cmd/search.cpp b/frontend/cmd/search.cpp index 67b0bf1..f10709a 100644 --- a/frontend/cmd/search.cpp +++ b/frontend/cmd/search.cpp @@ -1,17 +1,16 @@ #include "../Player.h" -#include "../print.h" +#include "backend/print.h" #include "backend/Location.h" using namespace std; FollowupAction Player::cmd_search(string &) { bool found = false; - for (Object * object : this->location.get_objects()) { - if (object->get_hidden() == false) continue; + for (Object * object : this->location.get_hidden_objects()) { if (!found) lprtf("Je vindt:\n"); - lprtf("- %s\n", object->get_displayname()); - object->set_hidden(false); + lprtf("- %s\n", object->get_displayname().c_str()); + this->location.unhide_object(object); found = true; } if (!found) diff --git a/frontend/cmd/view.cpp b/frontend/cmd/view.cpp index b9d179b..a252715 100644 --- a/frontend/cmd/view.cpp +++ b/frontend/cmd/view.cpp @@ -1,7 +1,8 @@ -#include "../print.h" #include "../Player.h" #include "../strings.h" +#include "backend/print.h" + using namespace std; FollowupAction Player::cmd_view(string & target) { |