Add invocation queue to DrivenEngine, use it for lua source
This commit is contained in:
@@ -35,6 +35,9 @@ public:
|
||||
|
||||
// Clear the unack command queue.
|
||||
unack_.clear();
|
||||
|
||||
// Export stuff to the graphics engine.
|
||||
set_visible_world_and_actor(world_.get(), actor_id_);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,11 +96,6 @@ public:
|
||||
inv.serialize(sb);
|
||||
}
|
||||
|
||||
void send_lua_source(std::string_view sourcepack) {
|
||||
Invocation inv(Invocation::KIND_LUA_SOURCE, actor_id_, actor_id_, sourcepack);
|
||||
send_invocation(inv);
|
||||
}
|
||||
|
||||
void do_luainvoke_command(const StringVec &words) {
|
||||
send_invocation(Invocation(Invocation::KIND_LUA, actor_id_, actor_id_, words[1]));
|
||||
}
|
||||
@@ -176,6 +174,7 @@ public:
|
||||
stdostream() << "Actor ID changing: " << actor_id << std::endl;
|
||||
print_channeler_.reset();
|
||||
actor_id_ = actor_id;
|
||||
set_visible_world_and_actor(world_.get(), actor_id_);
|
||||
}
|
||||
|
||||
void receive_ack_from_server(StreamBuffer *sb) {
|
||||
@@ -230,12 +229,10 @@ public:
|
||||
}
|
||||
|
||||
virtual void event_update() {
|
||||
// Check for lua source code. If this returns non-null,
|
||||
// it is because somebody typed CPL.
|
||||
eng::string lua_source_pack = get_lua_source_pack();
|
||||
if (!lua_source_pack.empty()) {
|
||||
send_lua_source(lua_source_pack);
|
||||
lua_source_pack.clear();
|
||||
// Send invocations. We execute these using predictive execution.
|
||||
eng::vector<UniqueInvocation> invocations = get_queued_invocations();
|
||||
for (const UniqueInvocation &inv : invocations) {
|
||||
send_invocation(*inv);
|
||||
}
|
||||
|
||||
// Check for keyboard input on stdin.
|
||||
|
||||
Reference in New Issue
Block a user