aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/CMakeLists.txt1
-rw-r--r--backend/Dungeon.cpp6
-rw-r--r--backend/Dungeon.h2
-rw-r--r--frontend/CMakeLists.txt2
-rw-r--r--frontend/Player.cpp64
-rw-r--r--frontend/Player.h8
-rw-r--r--frontend/cmd/CMakeLists.txt17
-rw-r--r--frontend/cmd/cheat.cpp6
-rw-r--r--frontend/cmd/equip.cpp6
-rw-r--r--frontend/cmd/get.cpp6
-rw-r--r--frontend/cmd/go.cpp6
-rw-r--r--frontend/cmd/help.cpp15
-rw-r--r--frontend/cmd/hit.cpp6
-rw-r--r--frontend/cmd/put.cpp6
-rw-r--r--frontend/cmd/query.cpp6
-rw-r--r--frontend/cmd/quit.cpp6
-rw-r--r--frontend/cmd/restart.cpp6
-rw-r--r--frontend/cmd/search.cpp6
-rw-r--r--frontend/cmd/use.cpp6
-rw-r--r--frontend/cmd/view.cpp12
-rw-r--r--frontend/cmd/wait.cpp6
-rw-r--r--frontend/main.cpp2
22 files changed, 134 insertions, 67 deletions
diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt
index c9232f4..6d94517 100644
--- a/backend/CMakeLists.txt
+++ b/backend/CMakeLists.txt
@@ -3,5 +3,6 @@ target_sources(main PUBLIC
LocationFactory.cpp
Object.cpp
ObjectFactory.cpp
+ Dungeon.cpp
)
diff --git a/backend/Dungeon.cpp b/backend/Dungeon.cpp
new file mode 100644
index 0000000..45158a6
--- /dev/null
+++ b/backend/Dungeon.cpp
@@ -0,0 +1,6 @@
+#include "Dungeon.h"
+
+void Dungeon::update() {
+
+}
+
diff --git a/backend/Dungeon.h b/backend/Dungeon.h
index 34fa776..60faa09 100644
--- a/backend/Dungeon.h
+++ b/backend/Dungeon.h
@@ -1,6 +1,8 @@
#pragma once
class Dungeon {
+public:
+ void update();
};
diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt
index 9a383ce..ef64ee2 100644
--- a/frontend/CMakeLists.txt
+++ b/frontend/CMakeLists.txt
@@ -6,3 +6,5 @@ target_sources(main PUBLIC
Player.cpp
)
+add_subdirectory(cmd)
+
diff --git a/frontend/Player.cpp b/frontend/Player.cpp
index d1f3052..adf4e44 100644
--- a/frontend/Player.cpp
+++ b/frontend/Player.cpp
@@ -49,67 +49,3 @@ FollowupAction Player::cmd(Argv argv) {
return FollowupAction::NONE;
}
-FollowupAction Player::cmd_query(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_search(Argv argv) {
- return FollowupAction::UPDATE;
-}
-
-FollowupAction Player::cmd_go(Argv argv) {
- return FollowupAction::UPDATE;
-}
-
-FollowupAction Player::cmd_get(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_put(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_view(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_hit(Argv argv) {
- return FollowupAction::UPDATE;
-}
-
-FollowupAction Player::cmd_equip(Argv argv) {
- return FollowupAction::UPDATE;
-}
-
-FollowupAction Player::cmd_wait(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_use(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_help(Argv argv) {
- lprtf("De beschikbare commando's zijn: ");
- bool first = true;
- for (auto & [ key, _ ] : this->cmds) {
- if (!first) lprtf(", ");
- lprtf("%s", key.c_str());
- first = false;
- }
- lprtf(".\n");
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_cheat(Argv argv) {
- return FollowupAction::NONE;
-}
-
-FollowupAction Player::cmd_quit(Argv argv) {
- return FollowupAction::EXIT;
-}
-
-FollowupAction Player::cmd_restart(Argv argv) {
- return FollowupAction::RESTART;
-}
-
diff --git a/frontend/Player.h b/frontend/Player.h
index c5fbb1e..ae3c520 100644
--- a/frontend/Player.h
+++ b/frontend/Player.h
@@ -18,8 +18,12 @@ class Player {
typedef FollowupAction Cmd(Argv);
private:
- unsigned int health_points = 0;
- unsigned int attack_chance = 0;
+ std::string name;
+ unsigned int health_points = 20;
+ float attack_chance = 0.4;
+ // TODO: WeaponObject[]
+ // TODO: GoldObject[]
+ // TODO: ArmorObject[]
public:
Player(Dungeon & dungeon);
diff --git a/frontend/cmd/CMakeLists.txt b/frontend/cmd/CMakeLists.txt
new file mode 100644
index 0000000..61feb84
--- /dev/null
+++ b/frontend/cmd/CMakeLists.txt
@@ -0,0 +1,17 @@
+target_sources(main PUBLIC
+ cheat.cpp
+ equip.cpp
+ get.cpp
+ go.cpp
+ help.cpp
+ hit.cpp
+ put.cpp
+ query.cpp
+ quit.cpp
+ restart.cpp
+ search.cpp
+ use.cpp
+ view.cpp
+ wait.cpp
+)
+
diff --git a/frontend/cmd/cheat.cpp b/frontend/cmd/cheat.cpp
new file mode 100644
index 0000000..ed4e452
--- /dev/null
+++ b/frontend/cmd/cheat.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_cheat(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/equip.cpp b/frontend/cmd/equip.cpp
new file mode 100644
index 0000000..a713bd2
--- /dev/null
+++ b/frontend/cmd/equip.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_equip(Argv argv) {
+ return FollowupAction::UPDATE;
+}
+
diff --git a/frontend/cmd/get.cpp b/frontend/cmd/get.cpp
new file mode 100644
index 0000000..8c8194b
--- /dev/null
+++ b/frontend/cmd/get.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_get(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/go.cpp b/frontend/cmd/go.cpp
new file mode 100644
index 0000000..2aaec08
--- /dev/null
+++ b/frontend/cmd/go.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_go(Argv argv) {
+ return FollowupAction::UPDATE;
+}
+
diff --git a/frontend/cmd/help.cpp b/frontend/cmd/help.cpp
new file mode 100644
index 0000000..1ae1fde
--- /dev/null
+++ b/frontend/cmd/help.cpp
@@ -0,0 +1,15 @@
+#include "../print.h"
+#include "../Player.h"
+
+FollowupAction Player::cmd_help(Argv argv) {
+ lprtf("De beschikbare commando's zijn: ");
+ bool first = true;
+ for (auto & [ key, _ ] : this->cmds) {
+ if (!first) lprtf(", ");
+ lprtf("%s", key.c_str());
+ first = false;
+ }
+ lprtf(".\n");
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/hit.cpp b/frontend/cmd/hit.cpp
new file mode 100644
index 0000000..740c348
--- /dev/null
+++ b/frontend/cmd/hit.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_hit(Argv argv) {
+ return FollowupAction::UPDATE;
+}
+
diff --git a/frontend/cmd/put.cpp b/frontend/cmd/put.cpp
new file mode 100644
index 0000000..ebf30da
--- /dev/null
+++ b/frontend/cmd/put.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_put(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp
new file mode 100644
index 0000000..48cbb55
--- /dev/null
+++ b/frontend/cmd/query.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_query(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/quit.cpp b/frontend/cmd/quit.cpp
new file mode 100644
index 0000000..24aa7c9
--- /dev/null
+++ b/frontend/cmd/quit.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_quit(Argv argv) {
+ return FollowupAction::EXIT;
+}
+
diff --git a/frontend/cmd/restart.cpp b/frontend/cmd/restart.cpp
new file mode 100644
index 0000000..aac5833
--- /dev/null
+++ b/frontend/cmd/restart.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_restart(Argv argv) {
+ return FollowupAction::RESTART;
+}
+
diff --git a/frontend/cmd/search.cpp b/frontend/cmd/search.cpp
new file mode 100644
index 0000000..334c997
--- /dev/null
+++ b/frontend/cmd/search.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_search(Argv argv) {
+ return FollowupAction::UPDATE;
+}
+
diff --git a/frontend/cmd/use.cpp b/frontend/cmd/use.cpp
new file mode 100644
index 0000000..fca40c3
--- /dev/null
+++ b/frontend/cmd/use.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_use(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/view.cpp b/frontend/cmd/view.cpp
new file mode 100644
index 0000000..8b08a2c
--- /dev/null
+++ b/frontend/cmd/view.cpp
@@ -0,0 +1,12 @@
+#include "../print.h"
+#include "../Player.h"
+
+FollowupAction Player::cmd_view(Argv argv) {
+ if (argv.size() == 0) {
+ lprtf("Fout, gebruik: Bekijk <Zelf|VIJHAND|OBJECT>\n");
+ return FollowupAction::NONE;
+ }
+
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/cmd/wait.cpp b/frontend/cmd/wait.cpp
new file mode 100644
index 0000000..d2bc908
--- /dev/null
+++ b/frontend/cmd/wait.cpp
@@ -0,0 +1,6 @@
+#include "../Player.h"
+
+FollowupAction Player::cmd_wait(Argv argv) {
+ return FollowupAction::NONE;
+}
+
diff --git a/frontend/main.cpp b/frontend/main.cpp
index 776525c..b9322ee 100644
--- a/frontend/main.cpp
+++ b/frontend/main.cpp
@@ -33,7 +33,7 @@ FollowupAction game_main() {
switch (action) {
case NONE: break;
case UPDATE: {
- printf("TODO: update!\n");
+ dungeon->update();
break;
}
default: return action;