Add invocation queue to DrivenEngine, use it for lua source

This commit is contained in:
2023-10-23 20:57:47 -04:00
parent c4bb4bfb9d
commit 600ae7cef9
9 changed files with 50 additions and 188 deletions

View File

@@ -31,7 +31,7 @@ public:
Gui gui_;
public:
virtual void event_init(std::string_view srcpk, int argc, char *argv[]) {
virtual void event_init(std::string_view srcpk, int argc, char *argv[]) override {
// Create the master world model.
master_.reset(new World(WORLD_TYPE_MASTER));
@@ -166,9 +166,13 @@ public:
return true;
}
virtual void event_update() {
// If the driver has reloaded the source, put it into master model.
master_->update_source(get_lua_source_pack());
virtual void event_update() override {
// Execute any queued invocations.
// We just feed these directly into the master model.
eng::vector<UniqueInvocation> invocations = get_queued_invocations();
for (const UniqueInvocation &inv : invocations) {
master_->invoke(*inv);
}
// Check for keyboard input on stdin.
while (true) {