Move readline functionality into device-independent code

This commit is contained in:
2021-10-12 12:46:11 -04:00
parent 315bf6e3b1
commit 995219d965
6 changed files with 122 additions and 42 deletions

View File

@@ -170,18 +170,19 @@ void TextGame::check_redirects() {
}
}
void TextGame::event_init()
{
world_.reset(new World(util::WORLD_TYPE_STANDALONE));
world_->update_source(get_lua_source());
world_->run_unittests();
actor_id_ = world_->create_login_actor();
std::cerr << "Login actor ID: " << actor_id_ << std::endl;
get_stdio_channel()->out()->write_bytes(console_.get_prompt());
}
void TextGame::event_update()
{
if (world_ == nullptr) {
world_.reset(new World(util::WORLD_TYPE_STANDALONE));
world_->update_source(get_lua_source());
world_->run_unittests();
actor_id_ = world_->create_login_actor();
std::cerr << "Login actor ID: " << actor_id_ << std::endl;
get_stdio_channel()->out()->write_bytes(console_.get_prompt());
}
world_->update_source(get_lua_source());
while (true) {
std::string line = get_stdio_channel()->in()->readline();
if (line == "") break;