Pass lua source directly into event_init

This commit is contained in:
2023-10-23 20:19:36 -04:00
parent 7104a523b5
commit c4bb4bfb9d
4 changed files with 5 additions and 10 deletions

View File

@@ -444,8 +444,7 @@ void DrivenEngine::drv_get_animation_queues(uint32_t count, const int64_t *ids,
//////////////////////////////////////////////////////////////////////////////
void DrivenEngine::drv_initialize(uint32_t srcpklen, const char *srcpk, int argc, char **argv) {
drv_set_lua_source_pack(srcpklen, srcpk);
event_init(argc, argv);
event_init(std::string_view(srcpk, srcpklen), argc, argv);
}
void DrivenEngine::drv_clear_new_outgoing() {

View File

@@ -144,7 +144,7 @@ public:
// The init callback. You may override this in a subclass.
// This will be called once at program initialization.
//
virtual void event_init(int argc, char *argv[]) {}
virtual void event_init(std::string_view srcpk, int argc, char *argv[]) {}
// The update callback. You may override this in a subclass.
// This will be called whenever anything changes.

View File

@@ -69,7 +69,7 @@ public:
channel_.reset();
}
virtual void event_init(int argc, char *argv[]) {
virtual void event_init(std::string_view srcpk, int argc, char *argv[]) {
// Put the world into the starting state.
set_initial_state();
@@ -78,10 +78,6 @@ public:
// Set the console prompt
set_console_prompt(console_.get_prompt());
// The driver loads the lua source automatically.
// However, we don't need it. Throw it out.
get_lua_source_pack();
}
void send_invocation(const Invocation &inv) {

View File

@@ -31,12 +31,12 @@ public:
Gui gui_;
public:
virtual void event_init(int argc, char *argv[]) {
virtual void event_init(std::string_view srcpk, int argc, char *argv[]) {
// Create the master world model.
master_.reset(new World(WORLD_TYPE_MASTER));
// Update the source code of the master model.
master_->update_source(get_lua_source_pack());
master_->update_source(srcpk);
// Create an actor for administrative commands.
admin_id_ = master_->create_login_actor();