Refactor to remove dependency of DrivenEngine on World

This commit is contained in:
2026-02-24 22:36:01 -05:00
parent 8889a36ba3
commit a7027873ab
10 changed files with 194 additions and 92 deletions

View File

@@ -23,6 +23,8 @@ using ClientVector = eng::vector<UniqueClient>;
class LpxServer : public DrivenEngine {
public:
EngineWrapper *wrapper_;
std::unique_ptr<World> world_;
ClientVector clients_;
PrintChanneler print_channeler_;
HttpChannelMap http_client_channels_;
@@ -32,13 +34,14 @@ public:
lua_State *lua_syntax_checker_;
public:
LpxServer()
LpxServer(EngineWrapper *w) : wrapper_(w)
{
// Create a little lua interpreter for syntax checking only.
lua_syntax_checker_ = LuaCoreStack::newstate(eng::l_alloc);
// Create the master world model.
world_.reset(new World(WORLD_TYPE_MASTER));
world_->expose_world_to_driver(wrapper_);
// Create the admin actor. Note: there isn't any 'init' function yet.
actor_id_ = world_->create_login_actor();
@@ -60,6 +63,7 @@ public:
}
~LpxServer() {
unexpose_world_to_driver(wrapper_);
lua_close(lua_syntax_checker_);
}