Less serialization and deserialization of Lua Source, also, Invocation is now simpler
This commit is contained in:
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
// The driver loads the lua source automatically.
|
||||
// However, we don't need it. Throw it out.
|
||||
get_lua_source();
|
||||
get_lua_source_pack();
|
||||
}
|
||||
|
||||
void send_invocation(const Invocation &inv) {
|
||||
@@ -97,11 +97,8 @@ public:
|
||||
inv.serialize(sb);
|
||||
}
|
||||
|
||||
void send_lua_source(const util::LuaSourceVec &sv) {
|
||||
StreamBuffer serial;
|
||||
SourceDB::serialize_source(sv, &serial);
|
||||
eng::string sstr(serial.view());
|
||||
Invocation inv(Invocation::KIND_LUA_SOURCE, actor_id_, actor_id_, sstr);
|
||||
void send_lua_source(std::string_view sourcepack) {
|
||||
Invocation inv(Invocation::KIND_LUA_SOURCE, actor_id_, actor_id_, sourcepack);
|
||||
send_invocation(inv);
|
||||
}
|
||||
|
||||
@@ -239,10 +236,10 @@ public:
|
||||
virtual void event_update() {
|
||||
// Check for lua source code. If this returns non-null,
|
||||
// it is because somebody typed CPL.
|
||||
util::LuaSourcePtr lua_source = get_lua_source();
|
||||
if (lua_source != nullptr) {
|
||||
send_lua_source(*lua_source);
|
||||
lua_source.reset();
|
||||
eng::string lua_source_pack = get_lua_source_pack();
|
||||
if (!lua_source_pack.empty()) {
|
||||
send_lua_source(lua_source_pack);
|
||||
lua_source_pack.clear();
|
||||
}
|
||||
|
||||
// Check for keyboard input on stdin.
|
||||
|
||||
Reference in New Issue
Block a user