aboutsummaryrefslogtreecommitdiff
path: root/frontend/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/main.cpp')
-rw-r--r--frontend/main.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/frontend/main.cpp b/frontend/main.cpp
index 2d66888..776525c 100644
--- a/frontend/main.cpp
+++ b/frontend/main.cpp
@@ -3,25 +3,51 @@
#include <memory>
#include "backend/Dungeon.h"
+#include "Player.h"
-#include "cli.h"
+#include "rl.h"
#include "strings.h"
#include "print.h"
using namespace std;
-int main() {
+FollowupAction game_main() {
auto dungeon = make_unique<Dungeon>();
print_string(strings::INTRO);
- string filename = cli_readline();
+ string filename = rl();
if (filename.size() == 0) {
lprtf("TODO: generate dungeon\n");
} else {
lprtf("TODO: load %s\n", filename.c_str());
}
- cli_main();
+ Player player { *dungeon };
+
+ while (1) {
+ string line = rl();
+ if (line.length() == 0) continue;
+ vector<string> argv = split_string(line, " ");
+ FollowupAction action = player.cmd(argv);
+
+ switch (action) {
+ case NONE: break;
+ case UPDATE: {
+ printf("TODO: update!\n");
+ break;
+ }
+ default: return action;
+ }
+ }
+}
+
+int main() {
+ FollowupAction action;
+
+ do {
+ action = game_main();
+ if (action == EXIT) break;
+ } while (action == RESTART);
return EXIT_SUCCESS;
}